def profile_start(self): if self.sas is not None: profile_name = self.profile_name if profile_name != 'None' and profile_name is not None: self.sas.profile_start() self.ts.log('Starting PV profile') else: raise pvsim.PVSimError('Simulation channel not specified') else: raise pvsim.PVSimError('PV Sim not initialized')
def power_on(self): if self.tsas is not None: c = self.channel if c is not None: channel = self.tsas.channels[c] # turn on output if off if not channel.output_is_on(): channel.output_set_on() self.ts.log('TerraSAS channel %d turned on' % c) else: raise pvsim.PVSimError('Simulation channel not specified') else: raise pvsim.PVSimError('Not initialized')
def irradiance_set(self, irradiance=1000): if self.tsas is not None: c = self.channel if c is not None: channel = self.tsas.channels[c] channel.irradiance_set(irradiance=irradiance) self.ts.log( 'TerraSAS irradiance changed to %0.2f on channel %d.' % (irradiance, c)) else: raise pvsim.PVSimError( 'Simulation irradiance not specified because there is no channel specified.' ) else: raise pvsim.PVSimError('Irradiance was not changed.')
def irradiance_set(self, irradiance=1000): if self.sas is not None: self.irradiance = irradiance self.sas.irradiance_set(self.irradiance, self.voc, self.isc, self.pmp, self.vmp) self.ts.log('chroma irradiance changed to %0.2f' % (irradiance)) else: raise pvsim.PVSimError('Irradiance was not changed.')
def power_off(self): #wanbin if self.sas is not None: self.sas.power_off() #self.ts.log('chroma channel %d turned on' % c) self.ts.log('chroma channel turned off') else: raise pvsim.PVSimError('Not initialized')
def power_off(self): if self.tsas is not None: for c in self.channel: channel = self.tsas.channels[c] # turn off output if on if channel.output_is_on(): channel.output_set_off() self.ts.log('TerraSAS channel %d turned off' % c) else: raise pvsim.PVSimError('Not initialized')
def profile_start(self): if self.tsas is not None: profile_name = self.profile_name if profile_name != 'None' and profile_name is not None: for c in self.channel: channel = self.tsas.channels[c] channel.profile_start() self.ts.log('Starting PV profile') else: raise pvsim.PVSimError('PV Sim not initialized')
def irradiance_set(self, irradiance=1000): if self.tsas is not None: # spread across active channels count = len(self.channel) if count > 1: irradiance = irradiance / count for c in self.channel: if c is not None: channel = self.tsas.channels[c] channel.irradiance_set(irradiance=irradiance) self.ts.log( 'TerraSAS irradiance changed to %0.2f on channel %d.' % (irradiance, c)) else: raise pvsim.PVSimError( 'Simulation irradiance not specified because there is no channel specified.' ) else: raise pvsim.PVSimError('Irradiance was not changed.')
def profile_load(self, profile_name): if profile_name != 'None' and profile_name is not None: self.ts.log('Loading irradiance profile %s' % profile_name) self.profile_name = profile_name profiles = self.sas.profiles_get() if profile_name not in profiles: self.sas.profile(profile_name) if self.sas is not None: c = self.channel if c is not None: channel = self.sas.channels[c] channel.profile_set(profile_name) self.ts.log('chroma Profile is configured.') else: raise pvsim.PVSimError('chroma Profile could not be configured.') else: raise pvsim.PVSimError('chroma Profile was not changed.') else: self.ts.log('No irradiance profile loaded')
def power_set(self, power): if self.sas is not None: # spread across active channels count = 1 if count > 1: power = power / count if power > self.pmp: self.ts.log_warning( 'Requested power > Pmp so irradiance will be > 1000 W/m^2)' ) # convert to irradiance for now irradiance = (power * 1000) / self.pmp self.irradiance_set(irradiance=irradiance) # self.ts.log('TerraSAS power output changed to %0.2f on channel %d.' % (power, c)) else: raise pvsim.PVSimError('Power was not changed.')
def close(self): """ Close any open communications resources associated with the grid simulator. """ if self.comm == 'Serial': raise NotImplementedError('The driver for serial connection (RS232/RS485) is not implemented yet') elif self.comm == 'GPIB': raise NotImplementedError('The driver for plain GPIB is not implemented yet.') elif self.comm == 'VISA': try: if self.rm is not None: if self.conn is not None: self.conn.close() self.rm.close() time.sleep(1) except Exception, e: raise pvsim.PVSimError(str(e))
def __init__(self, ts, group_name): pvsim.PVSim.__init__(self, ts, group_name) self.ts = ts self.tsas = None try: self.ipaddr = self._param_value('ipaddr') self.pmp = self._param_value('pmp') self.vmp = self._param_value('vmp') self.channel = [] self.irr_start = self._param_value('irr_start') chans = str(self._param_value('channel')).split(',') for c in chans: try: self.channel.append(int(c)) except ValueError: raise pvsim.PVSimError('Invalid channel number: %s' % c) self.profile_name = None self.ts.log( 'Initializing PV Simulator with Pmp = %d and Vmp = %d.' % (self.pmp, self.vmp)) self.tsas = terrasas.TerraSAS(ipaddr=self.ipaddr) self.tsas.scan() for c in self.channel: channel = self.tsas.channels[c] if channel.profile_is_active(): channel.profile_abort() # re-add EN50530 curve with active parameters self.tsas.curve_en50530(pmp=self.pmp, vmp=self.vmp) channel.curve_set(terrasas.EN_50530_CURVE) except Exception: if self.tsas is not None: self.tsas.close() raise
def irradiance_set(self, irradiance=1000): if self.ts.confirm('Please change the irradiance to %0.1f W/m^2.' % irradiance) is False: raise pvsim.PVSimError('Aborted PV simulation')
def power_on(self): if self.sas is not None: self.sas.power_on() self.ts.log('chroma channel %d turned on' % c) else: raise pvsim.PVSimError('Not initialized')
def power_set(self, power): if self.ts.confirm( 'Please change the power to %0.1f%% power.' % power) is False: raise pvsim.PVSimError('Aborted PV simulation')
def power_on(self): if self.ts.confirm( 'Please turn on PV simulator to give EUT DC power.') is False: raise pvsim.PVSimError('Aborted PV simulation')
def profile_start(self): if self.ts.confirm('Please run the PV simulator profile.') is False: raise pvsim.PVSimError('Aborted PV simulation')