예제 #1
0
        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.')
예제 #2
0
    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.')

    '''
    plt.plot([0, 1, 2, 3], [2, 3, 2, 1], color='red', label='Voltage')
    plt.show()
    '''

    return script.RESULT_PASS

def run(test_script):
예제 #3
0
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)
예제 #4
0
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
예제 #5
0
            # todo: fix this function for 'watt priority'
            (power_factor_upper, power_factor_lower) = calculate_pf_range(power_factor, power_factor_range)
            ts.log('Target power factor: %.3f. Pass limits for screening: lower = %.3f, upper = %.3f' %
                   (power_factor, power_factor_lower, power_factor_upper))

            for i in xrange(3): # UL 1741 Step 7: Repeat the test 3 times

                ts.log('Running test number %d at power level %0.3f. Setting power factor to unity.' %
                       (i+1, power_level))

                if trigger:
                    trigger.off()

                # UL 1741 Step 5: Set power factor to unity
                # Trigger set immediately before sending the enable command to the DER
                inverter.set_power_factor(inv, power_factor=1.0, enable=1)

                if pretest_delay > 0:
                    ts.log('Waiting for pre-test delay of %d seconds' % pretest_delay)
                    ts.sleep(pretest_delay)

                # Store fixed power factor execution time for determining when time window and timeout period occur
                start_time = time.time()
                elapsed_time = 0

                # UL 1741 Step 6: Start recording the data - should already be running.  Then set PF to value in 1741
                # SA Table
                ts.log('Setting target power factor in the EUT to %0.3f.' % power_factor)
                inverter.set_power_factor(inv, power_factor=power_factor, enable=1, trigger=trigger)

                test_duration = pf_settling_time*2. + verification_delay
예제 #6
0
            raise script.ScriptFail()

        # Find pass/fail bounds
        (power_factor_upper,
         power_factor_lower) = calculate_pf_range(power_factor,
                                                  power_factor_range)
        ts.log(
            'Target power factor: %.3f. Pass limits for screening: lower = %.3f  upper = %.3f'
            % (power_factor, power_factor_lower, power_factor_upper))

        # Sandia Test Protocol Step 4: Issue power factor function
        # (Trigger set immediately before sending the enable command to the DER)
        inverter.set_power_factor(inv,
                                  time_window=time_window,
                                  timeout_period=timeout_period,
                                  ramp_time=ramp_time,
                                  power_factor=power_factor,
                                  enable=1,
                                  trigger=trigger)

        # Start the pv simulator irradiance profile
        pv.profile_start()

        # Store INV3 execution time for determining when time window and timeout period occur
        # Note: this is below the pv.start command to allow the manual operator time to begin he profile.
        start_time = time.time()
        elapsed_time = 0

        # Sandia Test Protocol Step 5: EUT response to command.
        # Sandia Test Protocol Step 6: Verify command was executed. (Conduct test while profile is running.)