光伏电池测控系统python代码

'''
硬件keithley万用表和程控电源
visa是VXIplug&play系统联盟制定的一套标准。
python实现VISA,形成pyviva模块
'''
#
##IV测试系统的部分程序代码 from visa import * from string import * from math import * class CurrentMiter(Instrument): CurrentValue=[] datapoints=1 Atrr="" def __init__(self,DelayTime=0.2,DPs=111): self=instrument("GPIB::23") self.timeout=30 datapoints=DPs self.delay=DelayTime self.write("*Rst") self.write(":SYST:PRES") self.write(":FORM:DATA ASCII") self.write(":TRIgger:delay 0") self.write(":trigger:source external") self.write(":INITiate:CONTinuous On") self.write(":trigger:count 1") self.write(":Data:clear") self.write(":data:points %d" % datapoints) self.write(":data:feed:control next") self.write(":data:feed sense") self.write(":FUNC 'CURRent:DC'") self.write(":CURRent:DC:RANGe:Auto 1") self.write(":CURRent:DC:DIGits 7") self.write(":CURRent:DC:AVERage:STATe off") def newAsk(self,cmd): return self.ask_for_values(cmd) class SourceGenerator(Instrument): VRangeSelect="" VStart=1 VStop=0 VStep=1 TimeStep=1 def __init__(self,DelayTime=0.2,V0=1.0,Vt=-0.1,Vs=0.01,Ts=0.1,Vr=4): 146 self=instrument("GPIB::1") self.delay=DelayTime self.VRangeSelect=Vr self.VStart=V0 self.VStop=Vt self.VStep=Vs self.TimeStep=Ts self.write("C") self.write("RP1") self.write("PM2") self.write("V%s" % str(self.VRangeSelect)) cmd="SP"+str(self.TimeStep)+"SN"+str(self.VStart)+","+str(self.VStop)+","+str(self.VStep)+ " ST0" self.write(cmd) Points=abs((self.VStop - self.VStart)/ (self.VStep))+1 K2000=CurrentMiter(0.2,Points) self.write("E") self.write("*CLS ISE1 *SRE8 S0") self.write("*TRG") self.wait_for_srq() ##主程序 from IVKeithley import * from IVSource import * from visa import * if __name__ ="__main__": Keithley=CurrentMiter(0.1,10) Source=SourceGenerator(0.2) Source.StartTest() Source.write("*TRG") #Source.write("H")

 

转载于:https://www.cnblogs.com/milliard/p/7903853.html

你可能感兴趣的:(光伏电池测控系统python代码)