def config(self): """ Perform any configuration for the simulation based on the previously provided parameters. """ self.ts.log('Checking on HIL HW settings...') hw = model.get_hw_settings() self.ts.log_debug('HIL hardware is %s' % (hw, )) self.load_schematic() self.compile_model() self.load_model_on_hil() self.init_sim_settings() self.ts.log("HIL simulation successfully prepared for execution.") self.ts.log("Starting Simulation...") self.start_simulation() # let the inverter startup sleeptime = 15 for i in range(1, sleeptime): print( "Waiting another %d seconds until the inverter starts. Power = %f." % ((sleeptime - i), cp.read_analog_signal(name='Pdc'))) self.ts.sleep(1)
def config(self): """ Perform any configuration for the simulation based on the previously provided parameters. """ self.ts.log('Checking on HIL HW settings...') hw = model.get_hw_settings() self.ts.log_debug('HIL hardware is %s' % hw) # model.set_simulation_time_step(self.sim_time_step) try: self.__loadHandler__() except: raise self.init_sim_settings() self.ts.log("HIL simulation successfully prepared for execution.") self.ts.log("Starting Simulation...") self.start_simulation() """ This is a rather crude way to wait for EUT to start up! """ # let the inverter startup sleeptime = 15 try: # perturb irradiance cp.set_pv_amb_params("PV1", illumination=995.) self.ts.sleep(1) cp.set_pv_amb_params("PV1", illumination=1000.) except Exception as e: self.ts.log( 'Attempted to perturb PV1 irradiance to get inverter to start. This failed. %s' % e) for i in range(1, sleeptime): print(("Waiting another %d seconds until the inverter starts." % (sleeptime - i))) self.ts.sleep(1)
sys.path.insert( 0, r'C:/Typhoon HIL Control Center/python_portable/Lib/site-packages') #sys.path.insert(0, r'C:/Typhoon HIL Control Center/python_portable/Scripts') sys.path.insert(0, r'C:/Typhoon HIL Control Center/python_portable') sys.path.insert(0, r'C:/Typhoon HIL Control Center') #sys.path.insert(0, r'C:/Typhoon HIL Control Center/typhoon/conf') #sys.path.insert(0, r'C:/Typhoon HIL Control Center/typhoon/conf/components') import typhoon.api.hil_control_panel as hil from typhoon.api.schematic_editor import model import os hil.set_debug_level(level=1) hil.stop_simulation() model.get_hw_settings() #model_dir = r'D:/SVP/SVP Directories 11-7-16/UL 1741 SA Dev/Lib/Typhoon/' #print model_dir, os.path.isfile(model_dir) if not model.load( r'D:/SVP/SVP Directories 11-7-16/UL 1741 SA Dev/Lib/Typhoon/ASGC_AI.tse' ): print "Model did not load!" if not model.compile(): print "Model did not compile!" # first we need to load model hil.load_model( file= r'D:/SVP/SVP Directories 11-7-16/UL 1741 SA Dev/Lib/Typhoon/ASGC_AI Target files/ASGC_AI.cpd' )
def info(self): hw = model.get_hw_settings() return 'HIL hardware version: %s' % (hw, )