added averaging current, and put calibration in generation programs