name=ifc_name, baudrate=baudrate, parity=parity, ipaddr=ipaddr, ipport=ipport) try: inv.read() except Exception, e: ts.log('Unable to read EUT.') return script.RESULT_FAIL if inv.controls.Conn == '0' and INV1 == 'yes': ts.log('Inverter in disconnected state, setting state to connected') state = inverter.CONN_CONNECT inverter.set_conn_state(inv, state, time_window=0, timeout_period=0) ts.log('INV1 Reset - Inverter operating.') if INV2 == 'yes': inverter.set_power_limit(inv, time_window=0, timeout_period=0, ramp_time=0, power_limit_pct=100, enable=0) ts.log('INV2 Disabled.') if INV3 == 'yes': inverter.set_power_factor(inv, time_window=0, timeout_period=0,
print INV1, INV2, INV3, VV inv = client.SunSpecClientDevice(ifc_type, slave_id=slave_id, name=ifc_name, baudrate=baudrate, parity=parity, ipaddr=ipaddr, ipport=ipport) try: inv.read() except Exception, e: ts.log('Unable to read EUT.') return script.RESULT_FAIL if inv.controls.Conn == '0' and INV1 == 'yes': ts.log('Inverter in disconnected state, setting state to connected') state = inverter.CONN_CONNECT inverter.set_conn_state(inv, state, time_window=0, timeout_period=0) ts.log('INV1 Reset - Inverter operating.') if INV2 == 'yes': inverter.set_power_limit(inv, time_window=0, timeout_period=0, ramp_time=0, power_limit_pct=100, enable=0) ts.log('INV2 Disabled.') if INV3 == 'yes': inverter.set_power_factor(inv, time_window=0, timeout_period=0, ramp_time=0, power_factor=1, enable=0) ts.log('INV3 Disabled.') if VV == 'yes': inverter.set_volt_var(inv, n_points=0, time_window=0, timeout_period=0, ramp_time=0, curve_num=1, deptRef=2, enable=0) ts.log('VV Functions Disabled.')
def test_run(): result = script.RESULT_FAIL data = None trigger = None inv = None pv = None disable = None try: # UL 1741 Test Protocol # a. Connect the EUT according to the Requirements in Sec. 11.2.4 and specifications provided by the # manufacturer. Set the EUT to maximum power factor. # b. Set all AC source parameters to the nominal operating conditions for the EUT. # c. Set the input power level to provide Ilow from the EUT. Note: for units that do not adjust output # current as a function of their input such as units with energy storage or multimode products the output # power is to be commanded. # d. Turn on the EUT. Allow the EUT to reach steady state, e.g., maximum power point. # e. Set the EUT ramp rate parameters according to Test 1 in Table SA 11.1. # f. Begin recording the time domain response of the EUT AC voltage and current, and DC voltage and current. # g. Increase the available input power to provide Irated from the EUT according to the step function # described in SA 11. # h. Stop recording the time domain response after the ramp duration plus a manufacturer-specified dwell # time. Ramp duration is defined by 100/RRnorm_up as appropriate for the test settings. # i. Repeat steps c-h two times for a total of 3 repetitions. # j. Repeat steps c-i for Tests 2-3 in Table SA 11.1. # EUT communication parameters ifc_type = ts.param_value('comm.ifc_type') ifc_name = ts.param_value('comm.ifc_name') if ifc_type == client.MAPPED: ifc_name = ts.param_value('comm.map_name') baudrate = ts.param_value('comm.baudrate') parity = ts.param_value('comm.parity') ipaddr = ts.param_value('comm.ipaddr') ipport = ts.param_value('comm.ipport') slave_id = ts.param_value('comm.slave_id') # RR parameters RRnorm_up_min = ts.param_value('rr.RRnorm_up_min') RRnorm_up_max = ts.param_value('rr.RRnorm_up_max') Ilow = ts.param_value('rr.Ilow') Irated = ts.param_value('rr.Irated') MSARR = ts.param_value('rr.MSARR') t_dwell = ts.param_value('rr.t_dwell') # Script timing and pass/fail criteria pretest_delay = ts.param_value('invt.pretest_delay') verification_delay = ts.param_value('invt.verification_delay') posttest_delay = ts.param_value('invt.posttest_delay') power_threshold = ts.param_value('invt.power_threshold') disable = ts.param_value('invt.disable') # initialize data acquisition system daq = das.das_init(ts) data = daq.data_init() trigger = daq.trigger_init() # Step b. Set all AC source parameters to the nominal operating conditions for the EUT. # Initialize pv simulation - This is before step (a) because PV power may be required for communications to EUT pv = pvsim.pvsim_init(ts) pv.power_on() # Communication is established between the Utility Management System Simulator and EUT ts.log('Scanning EUT') try: inv = client.SunSpecClientDevice(ifc_type, slave_id=slave_id, name=ifc_name, baudrate=baudrate, parity=parity, ipaddr=ipaddr, ipport=ipport) except Exception, e: raise script.ScriptFail('Error: %s' % e) # Step a. Connect the EUT according to the Requirements in Sec. 11.2.4 and specifications provided by the # manufacturer. Set the EUT to maximum power factor. # It is assumed that the Grid Simulator (if used) is connected to the EUT and operating properly inverter.set_power_factor(inv, power_factor=1., enable=0) # UL 1741 Step j. Repeat steps c-i for Tests 2-3 in Table SA 11.1. for ramp in [RRnorm_up_min, (RRnorm_up_min + RRnorm_up_max)/2, RRnorm_up_max]: for i in xrange(3): # UL 1741 Step i. Repeat steps c-h two times for a total of 3 repetitions. ts.log('Running test number %d with ramp rate %0.3f %%Irated/sec.' % (i+1, ramp)) # Step c. Set the input power level to provide Ilow from the EUT. Note: for units that do not adjust # output current as a function of their input such as units with energy storage or multimode # products the output power is to be commanded. pv.irradiance_set(irradiance=Ilow*10) # Step d. Turn on the EUT. Allow the EUT to reach steady state, e.g., maximum power point. if pretest_delay > 0: ts.log('Waiting for pre-test delay of %d seconds' % pretest_delay) ts.sleep(pretest_delay) # Verify EUT is in correct state before running the test. if inverter.get_conn_state(inv) is False: ts.log('Inverter not in correct state, setting state to connected.') inverter.set_conn_state(inv, state=1) if verify_conn_state_change(inv, orig_state=0, verification_delay=verification_delay, threshold=power_threshold, data=data) is False: raise script.ScriptFail() # Step e. Set the EUT ramp rate parameters according to Test 1 in Table SA 11.1. try: inv.settings.read() if inv.settings.WGra is not None: inv.settings.WGra = ramp else: ts.log_error('Unable to change ramp rate in the EUT.') except Exception, e: ts.log_error('Error changing ramp rate in the EUT: %s' % str(e)) # Step g. Increase the available input power to provide Irated from the EUT according to the step # function described in SA 11. pv.irradiance_set(irradiance=1000) start_time = time.time() # Step h. Stop recording the time domain response after the ramp duration plus a # manufacturer-specified dwell time. data_update_rate = 1 # Hz check_duration = (Irated-Ilow)/ramp test_duration = t_dwell + check_duration duration = 0 while duration < test_duration+verification_delay: duration = time.time()-start_time ts.log_debug('duration = %0.2f, check duration = %0.2f' % (duration, check_duration)) if duration <= check_duration: # only check the ramp response during the check_duration ramp_in_bounds = verify_ramp(inv, ramp=ramp, t_since_step=duration, Ilow=Ilow, Irated=Irated, MSARR=MSARR, data=data) if ramp_in_bounds is False: ts.log_error('Ramp response was not within limits') # raise script.ScriptFail() else: # The EUT shall reach at least 95% of Irated at the end of the dwell time. ts.log('EUT completed ramping. Waiting for dwell time to check current output. ' 'Remaining time: %0.3f' % (test_duration - duration)) if duration >= test_duration: current_pct = inverter.get_power_norm(inv=inv, das=data)*100 ts.log_error('EUT current is %0.3f%%' % current_pct) if current_pct < 95: ts.log_error('EUT did not reach at least 95% of Irated at the end of the dwell time.') raise script.ScriptFail() break time.sleep(1/data_update_rate) # todo: should improve the loop timing if posttest_delay > 0: ts.log('Waiting for post-test delay of %d seconds' % posttest_delay) ts.sleep(posttest_delay)
def test_run(): result = script.RESULT_FAIL data = None trigger = None inv = None pv = None disable = None try: # EUT communication parameters ifc_type = ts.param_value('comm.ifc_type') ifc_name = ts.param_value('comm.ifc_name') if ifc_type == client.MAPPED: ifc_name = ts.param_value('comm.map_name') baudrate = ts.param_value('comm.baudrate') parity = ts.param_value('comm.parity') ipaddr = ts.param_value('comm.ipaddr') ipport = ts.param_value('comm.ipport') slave_id = ts.param_value('comm.slave_id') # INV1 parameters operation = ts.param_value('inv1.operation') time_window = ts.param_value('inv1.time_window') timeout_period = ts.param_value('inv1.timeout_period') # Script timing and pass/fail criteria pretest_delay = ts.param_value('invt.pretest_delay') verification_delay = ts.param_value('invt.verification_delay') posttest_delay = ts.param_value('invt.posttest_delay') power_threshold = ts.param_value('invt.power_threshold') disable = ts.param_value('invt.disable') # initialize data acquisition system daq = das.das_init(ts) data = daq.data_init() trigger = daq.trigger_init() # initialize pv simulation pv = pvsim.pvsim_init(ts) pv.power_on() # It is assumed that the PV and Grid Simulators (if used) are connected to the EUT and operating properly # prior to running this test script. if pretest_delay > 0: ts.log('Waiting for pre-test delay of %d seconds' % pretest_delay) ts.sleep(pretest_delay) # Sandia Test Protocol: Communication is established between the Utility Management System Simulator and EUT ts.log('Scanning EUT') try: inv = client.SunSpecClientDevice(ifc_type, slave_id=slave_id, name=ifc_name, baudrate=baudrate, parity=parity, ipaddr=ipaddr, ipport=ipport) except Exception, e: raise script.ScriptFail('Error: %s' % e) # Define operation states (connected/disconnected) # Default state is required for timeout_periods because the EUT will return to that mode of operation default_state = inverter.CONN_CONNECT if operation == 'Connect': orig_state = inverter.CONN_DISCONNECT state = inverter.CONN_CONNECT elif operation == 'Disconnect': orig_state = inverter.CONN_CONNECT state = inverter.CONN_DISCONNECT else: ts.log('Unknown operation requested: %s' % operation) raise script.ScriptFail() # Sandia Test Protocol Step 1: Request Status of EUT. # Sandia Test Protocol Step 2: UMS receives response to the DS93 command. # Verify EUT is in correct state before running the test. if inverter.verify_conn_state(inv, orig_state, threshold=power_threshold, das=data) is False: # todo: update inverter module with das changed to data ts.log('Inverter not in correct state, setting state to: %s' % (inverter.conn_state_str(orig_state))) # EUT put into state where INV1 can be verified inverter.set_conn_state(inv, orig_state) if verify_conn_state_change(inv, orig_state, verification_delay=verification_delay, threshold=power_threshold, data=data) is False: raise script.ScriptFail() # Sandia Test Protocol Step 3: Inverter output is measured and logged. log_conn_state(inv, data=data) # Sandia Test Protocol Step 4: UMS issues the INV1 command. ts.log('Executing %s' % operation) inverter.set_conn_state(inv, state, time_window=time_window, timeout_period=timeout_period, trigger=trigger) # Sandia Test Protocol Step 5: Verify the INV1 command was successfully executed. if verify_conn_state_change(inv, state, time_window=time_window, verification_delay=verification_delay, threshold=power_threshold, data=data) is False: raise script.ScriptFail() # Verify revert (timeout) to default state if timeout period specified if timeout_period > 0: if verify_conn_state_change(inv, default_state, timeout_period=timeout_period, verification_delay=verification_delay, threshold=power_threshold, data=data) is False: raise script.ScriptFail() if posttest_delay > 0: ts.log('Waiting for post-test delay of %d seconds' % posttest_delay) ts.sleep(posttest_delay) result = script.RESULT_PASS
def test_run(): result = script.RESULT_FAIL das = None trigger = None inv = None pv = None disable = None try: # UL 1741 Test Protocol # SA 11.3.2 The soft-start test shall be carried out as follows: # a) Connect the EUT according to the instructions and specifications provided by the manufacturer. # b) Set all AC source parameters to the nominal operating conditions for the EUT. # c) Set the input source power level to provide Irated from the EUT. Note: for units that do not # adjust output current as a function of their input such as units with energy storage or multimode products # the output power is to be commanded. # d) Turn on the EUT. Set the EUT ramp rate parameters according to Test 1 in Table SA 11.2. # e) Adjust the AC voltage or frequency outside the near nominal range for a period exceeding setting the # AC voltage to zero for longer than the must-trip duration. # f) Begin recording the time domain response of the EUT AC voltage and current, and DC voltage and current. # g) Adjust the AC source to the rated nominal operating conditions for the EUT. The EUT shall not # commence exporting output current until nominal conditions have been achieved. # h) Stop recording the time domain response after at least the reconnect time of the inverter # (e.g. 30 sec. to 5 minutes), plus ramp duration plus a manufacturer-specified dwell time as shown in SA 11. # Ramp duration is defined by 100/RRss as appropriate. # i) Repeat steps e-h for a total of 3 repetitions. # j) Repeat steps d-i for Tests 2-3 in Table 11.2. # EUT communication parameters ifc_type = ts.param_value('comm.ifc_type') ifc_name = ts.param_value('comm.ifc_name') if ifc_type == client.MAPPED: ifc_name = ts.param_value('comm.map_name') baudrate = ts.param_value('comm.baudrate') parity = ts.param_value('comm.parity') ipaddr = ts.param_value('comm.ipaddr') ipport = ts.param_value('comm.ipport') slave_id = ts.param_value('comm.slave_id') # RR parameters RRss_min = ts.param_value('ss.RRss_min') RRss_max = ts.param_value('ss.RRss_max') #Ilow = ts.param_value('ss.Ilow') Irated = 100. MSARR = ts.param_value('ss.MSARR') t_dwell = ts.param_value('ss.t_dwell') # Script timing and pass/fail criteria pretest_delay = ts.param_value('invt.pretest_delay') verification_delay = ts.param_value('invt.verification_delay') posttest_delay = ts.param_value('invt.posttest_delay') power_threshold = ts.param_value('invt.power_threshold') disable = ts.param_value('invt.disable') # Data acquisition and triggering methods datamethod = ts.param_value('datatrig.dsm_method') trigmethod = ts.param_value('datatrig.trigger_method') # Step f. Begin recording the time domain response of the EUT AC voltage and current, and DC voltage and current. # Step h. Stop recording the time domain response after at least the reconnect time of the inverter # (e.g. 30 sec. to 5 minutes), plus ramp duration plus a manufacturer-specified dwell time as shown in # SA 11. Ramp duration is defined by 100/RRss as appropriate. if datamethod == 'Sandia LabView DSM': import sandia_dsm as dsm das = dsm.Data() computer = ts.param_value('datatrig.das_comp') if computer == '10 node': node = ts.param_value('datatrig.node') # Setup trigger if available if trigmethod == 'Create Local File for Sandia LabView DSM': import sandia_dsm as dsm trigger = dsm.Trigger() trigger.off() # Step b. Set all AC source parameters to the nominal operating conditions for the EUT. # Initialize pv simulation - This is before step (a) because PV power may be required for communications to EUT pv = pvsim.pvsim_init(ts) pv.power_on() grid = gridsim.gridsim_init(ts) # Communication is established between the Utility Management System Simulator and EUT ts.log('Scanning EUT') try: inv = client.SunSpecClientDevice(ifc_type, slave_id=slave_id, name=ifc_name, baudrate=baudrate, parity=parity, ipaddr=ipaddr, ipport=ipport) except Exception, e: raise script.ScriptFail('Error: %s' % e) # Step a. Connect the EUT according to the instructions and specifications provided by the manufacturer. # It is assumed that the Grid Simulator (if used) is connected to the EUT and operating properly inverter.set_power_factor(inv, power_factor=1., enable=0) # Step c. Set the input source power level to provide Irated from the EUT. Note: for units that do not # adjust output current as a function of their input such as units with energy storage or multimode # products the output power is to be commanded. pv.irradiance_set(irradiance=1000) # UL 1741 Step j. Repeat steps d-i for Tests 2-3 in Table 11.2. for ramp in [RRss_min, (RRss_min + RRss_max)/2, RRss_max]: # Step d. Turn on the EUT. Set the EUT ramp rate parameters according to Test 1 in Table SA 11.2. if pretest_delay > 0: ts.log('Waiting for pre-test delay of %d seconds' % pretest_delay) ts.sleep(pretest_delay) # Verify EUT is in correct state before running the test. if inverter.get_conn_state(inv) is False: ts.log('Inverter not in correct state, setting state to connected.') inverter.set_conn_state(inv, state=1) if verify_conn_state_change(inv, orig_state=0, verification_delay=verification_delay, threshold=power_threshold, das=das) is False: raise script.ScriptFail() ''' Revise when SS ramp rate exists in a SunSpec Model try: inv.settings.read() if inv.settings.SSWGra is not None: inv.settings.SSWGra = ramp else: ts.log_error('Unable to change ss ramp rate in the EUT.') except Exception, e: ts.log_error('Error changing ss ramp rate in the EUT: %s' % str(e)) ''' for i in xrange(3): # UL 1741 Step i. Repeat steps e-h two times for a total of 3 repetitions. ts.log('Running test number %d with ramp rate %0.3f %%Irated/sec.' % (i+1, ramp)) # e) Adjust the AC voltage or frequency outside the near nominal range for a period exceeding # setting the AC voltage to zero for longer than the must-trip duration. grid.voltage(0) time.sleep(1) # g) Adjust the AC source to the rated nominal operating conditions for the EUT. The EUT shall not # commence exporting output current until nominal conditions have been achieved. grid.voltage(grid.v_nom()) start_time = time.time() # Determine reconnection time t_reconnection = 0 while inverter.get_conn_state(inv) is False: t_reconnection = time.time()-start_time # Reconnection time updates until the inverter reconnects time.sleep(0.1) data_update_rate = 1 # Hz ... parameterize sometime... check_duration = 100./ramp test_duration = t_dwell + check_duration duration = 0 while duration < test_duration+verification_delay: duration = time.time()-start_time-t_reconnection if duration <= check_duration: # only check the ramp response during the check_duration ramp_in_bounds = verify_ramp(inv, ramp=ramp, t_since_start=duration, Irated=Irated, MSARR=MSARR, das=das) if ramp_in_bounds is False: ts.log_error('Ramp response was not within limits') # raise script.ScriptFail() else: # The EUT shall reach at least 95% of Irated at the end of the dwell time. ts.log('EUT completed ramping. Waiting for dwell time to check current output. ' 'Remaining time: %0.3f' % (test_duration - duration)) if duration >= test_duration: current_pct = inverter.get_power_norm(inv=inv, das=das)*100 ts.log_error('EUT current is %0.3f%%' % current_pct) if current_pct < 95: ts.log_error('EUT did not reach at least 95% of Irated at the end of the dwell time.') raise script.ScriptFail() break time.sleep(1/data_update_rate) # todo: improve the loop timing if posttest_delay > 0: ts.log('Waiting for post-test delay of %d seconds' % posttest_delay) ts.sleep(posttest_delay) result = script.RESULT_PASS