def re_measure(cycle=1): Temp = Uc = Uc_m = Ic = Ue = Ue_m = Ib = 0.0 if ag.temperature() >= 50.0: print "High temperature! Cooler!!!!" ag.stop_output("all") ag.state_output() while ag.temperature() >= 40.0: print "Current Temperature: %.2f, Delay: %d sec" % (ag.temperature(), 60 * DELAY_MEASURE) print "Delay" for sec in xrange(12 * DELAY_MEASURE): print "%d, " % (sec * 5), time.sleep(5) ag.start_output("all") for i in xrange(cycle): time.sleep(DELAY_MEASURE) Temp += ag.temperature() Uc += ag.source_value(2, "volt") Uc_m += ag.measure(2, "volt") Ic += ag.measure(2, "cur") Ue += ag.source_value(1, "volt") Ue_m += ag.measure(1, "volt") Ib += ag.measure(1, "cur") cycle = float(cycle) Measurements["Temp"] = Temp / cycle Measurements["Uc"] = Uc / cycle Measurements["Uc_m"] = Uc_m / cycle Measurements["Ic"] = Ic / cycle Measurements["Ue"] = Ue / cycle Measurements["Ue_m"] = Ue_m / cycle Measurements["Ib"] = Ib / cycle
def re_measure(cycle=1): Temp = Ud = Ud_m = Id = 0. if ag.temperature() >= 50.0: print "Hi, temperature! Cool!" ag.stop_output("all") ag.state_output() while ag.temperature() >= 40.0: print "Current Temperature: %.2f, Delay: %d sec" % ( ag.temperature(),60 * MEASURE_DELAY ) print "Delay" for sec in xrange( 12 * MEASURE_DELAY ): print "%d, " % (sec*5), time.sleep(5) ag.start_output("all") for i in xrange(cycle): time.sleep( MEASURE_DELAY ) Temp += ag.temperature() Ud += ag.source_value(1,"volt") Ud_m += ag.measure(1,"volt") Id += ag.measure(1,"cur") cycle = float(cycle) Measurements["Temp"] = Temp / cycle Measurements["Ud"] = Ud / cycle Measurements["Ud_m"] = Ud_m / cycle Measurements["Id"] = Id / cycle
def re_measure(cycle=1): Temp = Uc = Uc_m = Ic = Ue = Ib = Ib_m = 0. if ag.temperature() >= 50.0: ag.cooler(36.0) for i in xrange(cycle): time.sleep( DELAY_MEASURE ) Temp += ag.temperature() Uc += ag.source_value(2,"volt") Uc_m += ag.measure(2,"volt") Ic += ag.measure(2,"cur") Ue += ag.measure(1,"volt") Ib += ag.source_value(1,"c") Ib_m += ag.measure(1,"cur") cycle = float(cycle) Measurements["Temp"] = Temp / cycle Measurements["Uc"] = Uc / cycle Measurements["Uc_m"] = Uc_m / cycle Measurements["Ic"] = Ic / cycle Measurements["Ue"] = Ue / cycle Measurements["Ib_m"] = Ib_m / cycle Measurements["Ib"] = Ib / cycle
def re_measure(cycle=1): global Measurements if ag.temperature() >= 50.0: print "High temperature! Cooler!!!!" ag.stop_output("all") ag.state_output() while ag.temperature() >= 40.0: print "Current Temperature: %.2f, Delay: %d sec" % ( ag.temperature(),60 * MEASURE_DELAY ) print "Delay" for sec in xrange( 12 * MEASURE_DELAY ): print "%d, " % (sec*5), time.sleep(5) ag.start_output("all") Ids = Uds = Uds_m = Ugs = Ugs_m = Ubs = Ubs_m = Temp = 0.0 for i in xrange(cycle): # Impulse measure time.sleep( MEASURE_DELAY ) _measures = deepcopy(ag.measure_all()) Ids += _measures['ch1']['curr']['meas'] Uds += _measures['ch1']['volt']['sour'] Uds_m += _measures['ch1']['volt']['meas'] Ugs += _measures['ch2']['volt']['sour'] Ugs_m += _measures['ch2']['volt']['meas'] Ubs += _measures['ch3']['volt']['sour'] Ubs_m += _measures['ch3']['volt']['meas'] Temp += _measures['temp'] Measurements['Ids'] = Ids / float(cycle) Measurements['Uds'] = Uds / float(cycle) Measurements['Uds_m'] = Uds_m / float(cycle) Measurements['Ugs'] = Ugs / float(cycle) Measurements['Ugs_m'] = Ugs_m / float(cycle) Measurements['Ubs'] = Ubs / float(cycle) Measurements['Ubs_m'] = Ubs_m / float(cycle) Measurements['Temp'] = Temp / float(cycle)
return True finally: pass #ag.debug() return True if INCLUDE_GRAPHICS: plt.figure(1,figsize=(18, 9), dpi=80, facecolor='w', edgecolor='k') print "Current temperature: %.2f" % ( ag.temperature() ) write2file( fmeasure,"@COLS:Ue,Ib,Uc,Ic" ) # Записываем как будут располагаться колонки style = 0 for Uc in Uc_RANGES: style+=1; label_uc = "Uc=%.2f" % (Uc) GRAPH_2_Y = []