Exemplo n.º 1
0
    def connect(self, params=None):
        """ Get/set connect/disconnect function settings.

        Params:
            Conn - Connected (True/False)
            WinTms - Randomized start time delay in seconds
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for connect.
        """

        if self.inv is None:
            raise der.DERError('DER not initialized')

        try:
            if params is not None:
                conn = params.get('Conn')
                if conn is not None:
                    if conn is True:
                        reg = 1467  # start
                    else:
                        reg = 1749  # Full stop (AC and DC side)
                        # reg = 381  # Stop (AC side)
                    self.inv.write(40018, util.u32_to_data(int(reg)))
            else:
                params = {}
                reg = self.inv.read(40018, 2)
                if util.data_to_u32(reg) == 1467:
                    params['Conn'] = True
                else:
                    params['Conn'] = False
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 2
0
    def fixed_pf(self, params=None):
        """ Get/set fixed power factor control settings.

        Params:
            Ena - Enabled (True/False)
            PF - Power Factor set point
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for fixed factor.
        """
        if self.inv is None:
            der.DERError('DER not initialized')

        try:
            if params is not None:
                pf = params.get('PF')

                # Configuring Grid Management Services Control with Sunny Explorer
                # Cos phi (if supported by the device): Read Modbus register 30825. If the value 1075 can be read
                # from this register, the power factor is specified via system control.

                if pf is not None:
                    if pf > 0:
                        reg = 1042  # leading
                    else:
                        reg = 1041  # lagging
                    self.inv.write(40025, util.u32_to_data(int(reg)))

                    reg = int(abs(round(pf, 4) * 10000))
                    self.inv.write(40024, util.u16_to_data(int(reg)))

                ena = params.get('Ena')
                if ena is not None:
                    if ena is True:
                        reg = 1075  # 1075 = cos phi, specified by PV system control
                        # reg = 1074  # 1075 = cos phi, direct specific.
                    else:
                        reg = 303
                    if reg != util.data_to_u32(self.inv.read(40200, 2)):
                        self.inv.write(40200, util.u32_to_data(int(reg)))

            else:
                params = {}
                reg = self.inv.read(40200, 2)
                if util.data_to_u32(reg) == 1075:
                    params['Ena'] = True
                else:
                    params['Ena'] = False
                pf = None
                params['PF'] = pf
        except Exception, e:
            der.DERError(str(e))
Exemplo n.º 3
0
    def limit_max_power(self, params=None):
        """ Get/set max active power control settings.

        Params:
            Ena - Enabled (True/False)
            WMaxPct - Active power maximum as percentage of WMax
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for limit max power.
        """
        if self.inv is None:
            raise der.DERError('DER not initialized')

        #####  UNTESTED ####

        try:
            if params is not None:
                ena = params.get('Ena')
                if ena is not None:
                    if ena is True:
                        self.inv.write(40151, util.u32_to_data(802))
                    else:
                        self.inv.write(40151, util.u32_to_data(803))

                power = int(params.get('WMaxPct'))
                self.inv.write(
                    40016, util.s16_to_data(int(power))
                )  # Active power setpoint P, in % of the maximum active power (PMAX) of the inverter
                # self.inv.write(40023, util.s16_to_data(int(power)))  # Normalized active power limitation by PV system ctrl, in %
                # self.inv.write(40143, util.s32_to_data(int(power)))  # Active power setpoint for the operating mode "Active power limitation P via PV system control" (A)
                # self.inv.write(40147, util.u32_to_data(int(power)))  # Generator active power limitation for the operating mode "Active power limitation P via system control" (A)
                # self.inv.write(40149, util.s32_to_data(int(power)))  # Active power setpoint for the operating mode "Active power limitation P via system control" (W)

            else:
                params = {}
                if util.data_to_u32(self.inv.read(40151, 2)) == 803:
                    params['Ena'] = False
                else:
                    params['Ena'] = True
                params['WMaxPct'] = util.data_to_s16(self.inv.read(40016, 1))
                # params['WMaxPct'] = util.data_to_s16(self.inv.read(40023, 1))
                # params['WMaxPct'] = util.data_to_s32(self.inv.read(40143, 2))
                # params['WMaxPct'] = util.data_to_u32(self.inv.read(40147, 2))
                # params['WMaxPct'] = util.data_to_s32(self.inv.read(40149, 2))

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 4
0
    def storage(self, params=None):
        """ Get/set storage parameters

        Params:
            WChaMax - Setpoint for maximum charge.
            WChaGra - Setpoint for maximum charging rate. Default is MaxChaRte.
            WDisChaGra - Setpoint for maximum discharge rate. Default is MaxDisChaRte.
            StorCtl_Mod - Activate hold/discharge/charge storage control mode. Bitfield value.
            VAChaMax - Setpoint for maximum charging VA.
            MinRsvPct - Setpoint for minimum reserve for storage as a percentage of the nominal maximum storage.
            ChaState (R) - Currently available energy as a percent of the capacity rating.
            StorAval (R) - State of charge (ChaState) minus storage reserve (MinRsvPct) times capacity rating (AhrRtg).
            InBatV (R) - Internal battery voltage.
            ChaSt (R) - Charge status of storage device. Enumerated value.
            OutWRte - Percent of max discharge rate.
            InWRte - Percent of max charging rate.
            InOutWRte_WinTms - Time window for charge/discharge rate change.
            InOutWRte_RvrtTms - Timeout period for charge/discharge rate.
            InOutWRte_RmpTms - Ramp time for moving from current setpoint to new setpoint.

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for HFRT control.
        """

        der.DERError('Unimplemented function: storage')
Exemplo n.º 5
0
    def limit_max_power(self, params=None):
        """ Get/set max active power control settings.

        Params:
            Ena - Enabled (True/False)
            WMaxPct - Active power maximum as percentage of WMax
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for limit max power.
        """
        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)
            else:
                params = {}
                self.inv.controls.read()
                if self.inv.controls.WMaxLim_Ena == 0:
                    params['Ena'] = False
                else:
                    params['Ena'] = True
                params['WMaxPct'] = self.inv.controls.WMaxLimPct
                params['WinTms'] = self.inv.controls.WMaxLimPct_WinTms
                params['RmpTms'] = self.inv.controls.WMaxLimPct_RmpTms
                params['RvrtTms'] = self.inv.controls.WMaxLimPct_RvrtTms
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 6
0
    def freq_watt_curve(self, id, params=None):
        """ Get/set volt/var curve
            hz [] - List of frequency curve points
            w [] - List of power curve points
            CrvNam - Optional description for curve. (Max 16 chars)
            RmpPT1Tms - The time of the PT1 in seconds (time to accomplish a change of 95%).
            RmpDecTmm - Ramp decrement timer
            RmpIncTmm - Ramp increment timer
            RmpRsUp - The maximum rate at which the power may be increased after releasing the frozen value of
                      snap shot function.
            SnptW - 1=enable snapshot/capture mode
            WRef - Reference active power (default = WMax).
            WRefStrHz - Frequency deviation from nominal frequency at the time of the snapshot to start constraining
                        power output.
            WRefStopHz - Frequency deviation from nominal frequency at which to release the power output.
            ReadOnly - 0 = READWRITE, 1 = READONLY

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for freq/watt curve.
        """

        try:
            if params is not None:
                pass
            else:
                params = {}

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 7
0
    def fixed_pf(self, params=None):
        """ Get/set fixed power factor control settings.

        Params:
            Ena - Enabled (True/False)
            PF - Power Factor set point
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for fixed factor.
        """
        try:
            if params is not None:
                cmd = 'Unknown request'
                enable = params.get('Ena')
                pf = params.get('PF')
                if pf is not None:
                    cmd = 'Setting DER power factor to %s' % (str(pf))
                    if enable is not None and enable is True:
                        cmd += ' and enabling fixed power factor mode'
                elif enable is not None:
                    if enable is True:
                        cmd = 'Enabling DER fixed power factor mode'
                    else:
                        cmd = 'Disabling DER fixed power factor mode'
                self.ts.log(cmd)
            else:
                params = {}

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 8
0
    def info(self):  #wanbin
        self.ts.log("info")
        try:
            params = {}

            params['Manufacturer'] = 'SMA'
            '''
            params['Model']=util.data_to_s32(self.inv.read(40631, 2))
            params['Version']=util.data_to_u32(self.inv.read(40789, 2))
            params['Options']=''
            params['SerialNumber']=util.data_to_u32(self.inv.read(30057, 2))
            '''
            """ Get DER device information.

            Params:
                Manufacturer
                Model
                Version
                Options
                SerialNumber

            :return: Dictionary of information elements.
            """
        except Exception, e:
            raise der.DERError('Unimplemented function: info')
Exemplo n.º 9
0
    def reactive_power(self, params=None):
        """ Set the reactive power

        Params:
            Ena - Enabled (True/False)
            Q - Reactive power as %Qmax (positive is overexcited, negative is underexcited)
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for Q control.
        """
        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)
            else:
                params = {}
                params['Q'] = 200
                '''
                params['Ena'] = self.ts.prompt('Reactive power is enabled (True/False)? ')
                params['Q'] = self.ts.prompt('Reactive power is: ')
                params['WinTms'] = self.ts.prompt('Time Window is: ')
                params['RmpTms'] = self.ts.prompt('Ramp Time is: ')
                params['RvrtTms'] = self.ts.prompt('Revert Time is: ')
                params['curve'] = self.ts.prompt('Curve parameters are: ')
                '''

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 10
0
    def freq_watt_param(self, params=None):
        """ Get/set frequency-watt with parameters

        Params:
            Ena - Enabled (True/False)
            HysEna - Enable hysterisis (True/False)
            WGra - The slope of the reduction in the maximum allowed watts output as a function of frequency.
            HzStr - The frequency deviation from nominal frequency (ECPNomHz) at which a snapshot of the instantaneous
                    power output is taken to act as the CAPPED power level (PM) and above which reduction in power
                    output occurs.
            HzStop - The frequency deviation from nominal frequency (ECPNomHz) at which curtailed power output may
                    return to normal and the cap on the power level value is removed.
            HzStopWGra - The maximum time-based rate of change at which power output returns to normal after having
                         been capped by an over frequency event.

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for frequency-watt with parameters control.
        """

        try:
            if params is not None:
                pass
            else:
                params = {}

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 11
0
    def active_power(self, params=None):
        """ Get/set active power of EUT

        Params:
            Ena - Enabled (True/False)
            P - Active power in %Wmax (positive is exporting (discharging), negative is importing (charging) power)
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for HFRT control.
        """
        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)
            else:
                params = {}
                params['P'] = 2000
                '''
                params['Ena'] = self.ts.prompt('Active power is enabled (True/False)? ')
                params['P'] = self.ts.prompt('Active power is: ')
                params['WinTms'] = self.ts.prompt('Time Window is: ')
                params['RmpTms'] = self.ts.prompt('Ramp Time is: ')
                params['RvrtTms'] = self.ts.prompt('Revert Time is: ')
                params['curve'] = self.ts.prompt('Curve parameters are: ')
                '''

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 12
0
    def controls_status(self, params=None):
        """ Get status of controls (binary True if active).
        :return: Dictionary of active controls.
        """
        if self.inv is None:
            raise der.DERError('DER not initialized')

        try:
            self.inv.status.read()
            status_bitfield = self.inv.status.StActCtl
            params = {}
            if status_bitfield is not None:
                params['Fixed_W'] = (status_bitfield
                                     & STACTCTL_FIXED_W) == STACTCTL_FIXED_W
                params['Fixed_Var'] = (
                    status_bitfield & STACTCTL_FIXED_VAR) == STACTCTL_FIXED_VAR
                params['Fixed_PF'] = (status_bitfield
                                      & STACTCTL_FIXED_PF) == STACTCTL_FIXED_PF
                params['Volt_Var'] = (status_bitfield
                                      & STACTCTL_VOLT_VAR) == STACTCTL_VOLT_VAR
                params['Freq_Watt_Param'] = (
                    status_bitfield
                    & STACTCTL_FREQ_WATT_PARAM) == STACTCTL_FREQ_WATT_PARAM
                params['Freq_Watt_Curve'] = (
                    status_bitfield
                    & STACTCTL_FREQ_WATT_CURVE) == STACTCTL_FREQ_WATT_CURVE
                params['Dyn_Reactive_Power'] = (
                    status_bitfield &
                    STACTCTL_DYN_REACTIVE_POWER) == STACTCTL_DYN_REACTIVE_POWER
                params['LVRT'] = (status_bitfield
                                  & STACTCTL_LVRT) == STACTCTL_LVRT
                params['HVRT'] = (status_bitfield
                                  & STACTCTL_HVRT) == STACTCTL_HVRT
                params['Watt_PF'] = (status_bitfield
                                     & STACTCTL_WATT_PF) == STACTCTL_WATT_PF
                params['Volt_Watt'] = (
                    status_bitfield & STACTCTL_VOLT_WATT) == STACTCTL_VOLT_WATT
                params['Scheduled'] = (
                    status_bitfield & STACTCTL_SCHEDULED) == STACTCTL_SCHEDULED
                params['LFRT'] = (status_bitfield
                                  & STACTCTL_LFRT) == STACTCTL_LFRT
                params['HFRT'] = (status_bitfield
                                  & STACTCTL_HFRT) == STACTCTL_HFRT
            else:
                params = {}
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 13
0
    def measurements(self):
        """ Get measurement data.

        Params:

        :return: Dictionary of measurement data.
        """

        der.DERError('Unimplemented function: measurements')
Exemplo n.º 14
0
    def conn_status(self, params=None):
        """ Get status of controls (binary True if active).
        :return: Dictionary of active controls.
        """
        if self.inv is None:
            raise der.DERError('DER not initialized')

        try:
            self.inv.status.read()
            pv_conn_bitfield = self.inv.status.PVConn
            stor_conn_bitfield = self.inv.status.StorConn
            ecp_conn_bitfield = self.inv.status.ECPConn

            params = {}
            if pv_conn_bitfield is not None:
                params['PV_Connected'] = (
                    pv_conn_bitfield & PVCONN_CONNECTED) == PVCONN_CONNECTED
                params['PV_Available'] = (
                    pv_conn_bitfield & PVCONN_AVAILABLE) == PVCONN_AVAILABLE
                params['PV_Operating'] = (
                    pv_conn_bitfield & PVCONN_OPERATING) == PVCONN_OPERATING
                params['PV_Test'] = (pv_conn_bitfield
                                     & PVCONN_TEST) == PVCONN_TEST
            elif stor_conn_bitfield is not None:
                params['Storage_Connected'] = (
                    stor_conn_bitfield
                    & STORCONN_CONNECTED) == STORCONN_CONNECTED
                params['Storage_Available'] = (
                    stor_conn_bitfield
                    & STORCONN_AVAILABLE) == STORCONN_AVAILABLE
                params['Storage_Operating'] = (
                    stor_conn_bitfield
                    & STORCONN_OPERATING) == STORCONN_OPERATING
                params['Storage_Test'] = (stor_conn_bitfield
                                          & STORCONN_TEST) == STORCONN_TEST
            elif ecp_conn_bitfield is not None:
                params['EPC_Connected'] = (
                    ecp_conn_bitfield & ECPCONN_CONNECTED) == ECPCONN_CONNECTED
            else:
                params = {}
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 15
0
    def volt_var_curve(self, id, params=None):
        """ Get/set volt/var curve
            v [] - List of voltage curve points
            var [] - List of var curve points based on DeptRef
            DeptRef - Dependent reference type: 'VAR_MAX_PCT', 'VAR_AVAL_PCT', 'VA_MAX_PCT', 'W_MAX_PCT'
            RmpTms - Ramp timer
            RmpDecTmm - Ramp decrement timer
            RmpIncTmm - Ramp increment timer

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for volt/var control.
        """
        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)
            else:
                params = {}
                act_pt = curve.ActPt
                dept_ref = volt_var_dept_ref.get(curve.DeptRef)
                if dept_ref is None:
                    raise der.DERError('DeptRef out of range: %s' % (dept_ref))
                params['DeptRef'] = dept_ref
                params['RmpTms'] = curve.RmpTms
                params['RmpDecTmm'] = curve.RmpDecTmm
                params['RmpIncTmm'] = curve.RmpIncTmm
                params['id'] = id  #also store the curve number

                v = []
                var = []
                for i in xrange(1,
                                act_pt + 1):  # SunSpec point index starts at 1
                    v_point = 'V%d' % i
                    var_point = 'VAr%d' % i
                    v.append(getattr(curve, v_point))
                    var.append(getattr(curve, var_point))
                params['v'] = v
                params['var'] = var

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 16
0
    def connect(self, params=None):
        """ Get/set connect/disconnect function settings.

        Params:
            Conn - Connected (True/False)
            WinTms - Randomized start time delay in seconds
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for connect.
        """

        der.DERError('Unimplemented function: connect')
Exemplo n.º 17
0
    def freq_watt_curve(self, id, params=None):
        """ Get/set volt/var curve
            hz [] - List of frequency curve points
            w [] - List of power curve points
            CrvNam - Optional description for curve. (Max 16 chars)
            RmpPT1Tms - The time of the PT1 in seconds (time to accomplish a change of 95%).
            RmpDecTmm - Ramp decrement timer
            RmpIncTmm - Ramp increment timer
            RmpRsUp - The maximum rate at which the power may be increased after releasing the frozen value of
                      snap shot function.
            SnptW - 1=enable snapshot/capture mode
            WRef - Reference active power (default = WMax).
            WRefStrHz - Frequency deviation from nominal frequency at the time of the snapshot to start constraining
                        power output.
            WRefStopHz - Frequency deviation from nominal frequency at which to release the power output.
            ReadOnly - 0 = READWRITE, 1 = READONLY

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for freq/watt curve.
        """

        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)
            else:
                params = {}
                act_pt = curve.ActPt
                params['CrvNam'] = curve.CrvNam
                params['RmpPT1Tms'] = curve.RmpPT1Tms
                params['RmpDecTmm'] = curve.RmpDecTmm
                params['RmpIncTmm'] = curve.RmpIncTmm
                params['RmpRsUp'] = curve.RmpRsUp
                params['SnptW'] = curve.SnptW
                params['WRef'] = curve.WRef
                params['WRefStrHz'] = curve.WRefStrHz
                params['WRefStopHz'] = curve.WRefStopHz
                params['ReadOnly'] = curve.ReadOnly
                params['id'] = id  #also store the curve number
                hz = []
                w = []
                for i in xrange(1,
                                act_pt + 1):  # SunSpec point index starts at 1
                    hz_point = 'Hz%d' % i
                    w_point = 'VAr%d' % i
                    hz.append(getattr(curve, hz_point))
                    w.append(getattr(curve, w_point))
                params['hz'] = hz
                params['w'] = w

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 18
0
    def info(self):
        """ Get DER device information.

        Params:
            Manufacturer
            Model
            Version
            Options
            SerialNumber

        :return: Dictionary of information elements.
        """

        der.DERError('Unimplemented function: info')
Exemplo n.º 19
0
    def volt_var_curve(self, id, params=None):
        """ Get/set volt/var curve
            v [] - List of voltage curve points
            var [] - List of var curve points based on DeptRef
            DeptRef - Dependent reference type: 'VAR_MAX_PCT', 'VAR_AVAL_PCT', 'VA_MAX_PCT', 'W_MAX_PCT'
            RmpTms - Ramp timer
            RmpDecTmm - Ramp decrement timer
            RmpIncTmm - Ramp increment timer

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for volt/var curve control.
        """

        der.DERError('Unimplemented function: volt_var_curve')
Exemplo n.º 20
0
    def storage(self, params=None):
        """ Get/set storage parameters

        Params:
            WChaMax - Setpoint for maximum charge.
            WChaGra - Setpoint for maximum charging rate. Default is MaxChaRte.
            WDisChaGra - Setpoint for maximum discharge rate. Default is MaxDisChaRte.
            StorCtl_Mod - Activate hold/discharge/charge storage control mode. Bitfield value.
            VAChaMax - Setpoint for maximum charging VA.
            MinRsvPct - Setpoint for minimum reserve for storage as a percentage of the nominal maximum storage.
            ChaState (R) - Currently available energy as a percent of the capacity rating.
            StorAval (R) - State of charge (ChaState) minus storage reserve (MinRsvPct) times capacity rating (AhrRtg).
            InBatV (R) - Internal battery voltage.
            ChaSt (R) - Charge status of storage device. Enumerated value.
            OutWRte - Percent of max discharge rate.
            InWRte - Percent of max charging rate.
            InOutWRte_WinTms - Time window for charge/discharge rate change.
            InOutWRte_RvrtTms - Timeout period for charge/discharge rate.
            InOutWRte_RmpTms - Ramp time for moving from current setpoint to new setpoint.

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for HFRT control.
        """
        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)

            else:
                params = {}
                params['ChaState'] = 50
                '''
                params['WChaMax'] = self.ts.prompt('WChaMax? ')
                params['WChaGra'] = self.ts.prompt('WChaGra? ')
                params['WDisChaGra'] = self.ts.prompt('WDisChaGra? ')
                params['StorCtl_Mod'] = self.ts.prompt('StorCtl_Mod? ')
                params['VAChaMax'] = self.ts.prompt('VAChaMax? ')
                params['MinRsvPct'] = self.ts.prompt('MinRsvPct? ')
                params['ChaState'] = self.ts.prompt('ChaState? ')
                params['StorAval'] = self.ts.prompt('StorAval? ')
                params['InBatV'] = self.ts.prompt('InBatV? ')
                params['ChaSt'] = self.ts.prompt('ChaSt? ')
                params['OutWRte'] = self.ts.prompt('OutWRte? ')
                params['InWRte'] = self.ts.prompt('InWRte? ')
                params['InOutWRte_WinTms'] = sself.ts.prompt('InOutWRte_WinTms? ')
                params['InOutWRte_RvrtTms'] = self.ts.prompt('InOutWRte_RvrtTms? ')
                params['InOutWRte_RmpTms'] = self.ts.prompt('InOutWRte_RmpTms? ')
                '''
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 21
0
    def reactive_power(self, params=None):
        """ Set the reactive power

        Params:
            Ena - Enabled (True/False)
            Q - Reactive power as %Qmax (positive is overexcited, negative is underexcited)
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for Q control.
        """

        der.DERError('Unimplemented function: reactive_power')
Exemplo n.º 22
0
    def limit_max_power(self, params=None):
        """ Get/set max active power control settings.

        Params:
            Ena - Enabled (True/False)
            WMaxPct - Active power maximum as percentage of WMax
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for limit max power.
        """

        der.DERError('Unimplemented function: limit_max_power')
Exemplo n.º 23
0
    def active_power(self, params=None):
        """ Get/set active power of EUT

        Params:
            Ena - Enabled (True/False)
            P - Active power in %Wmax (positive is exporting (discharging), negative is importing (charging) power)
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for HFRT control.
        """

        der.DERError('Unimplemented function: active_power')
Exemplo n.º 24
0
    def measurements(self):
        """ Get measurement data.

        Params:

        :return: Dictionary of measurement data.
        """
        try:
            params = {}
            params['A'] = util.data_to_u32(self.inv.read(30795, 2)) / 1000.
            params['AphA'] = None
            params['AphB'] = None
            params['AphC'] = None
            params['PPVphAB'] = None
            params['PPVphBC'] = None
            params['PPVphCA'] = None
            params['PhVphA'] = None
            params['PhVphB'] = None
            params['PhVphC'] = None
            params['W'] = util.data_to_s32(self.inv.read(30775, 2))
            params['Hz'] = util.data_to_u32(self.inv.read(30803, 2)) / 100.
            params['VA'] = util.data_to_s32(self.inv.read(30813, 2))
            params['VAr'] = util.data_to_s32(self.inv.read(30805, 2))
            pf = util.data_to_u32(self.inv.read(30821, 2))
            if util.data_to_u32(self.inv.read(30823, 2)) == 1041:
                params['PF'] = -pf  # 1041 = Leading
            else:
                params['PF'] = pf
            params['WH'] = None
            params['DCA'] = None
            params['DCV'] = None
            params['DCW'] = None
            params['TmpCab'] = None
            params['TmpSnk'] = None
            params['TmpTrns'] = None
            params['TmpOt'] = None
            params['St'] = None
            params['StVnd'] = None
            params['Evt1'] = None
            params['Evt2'] = None
            params['EvtVnd1'] = None
            params['EvtVnd2'] = None
            params['EvtVnd3'] = None
            params['EvtVnd4'] = None
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 25
0
    def freq_watt(self, params=None):
        """ Get/set freq/watt control

        Params:
            Ena - Enabled (True/False)
            ActCrv - Active curve number (0 - no active curve)
            NCrv - Number of curves supported
            NPt - Number of points supported per curve
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for freq/watt control.
        """

        der.DERError('Unimplemented function: freq_watt')
Exemplo n.º 26
0
    def nameplate(self):
        """ Get nameplate ratings.

        Params:
            WRtg - Active power maximum rating
            VARtg - Apparent power maximum rating
            VArRtgQ1, VArRtgQ2, VArRtgQ3, VArRtgQ4 - VAr maximum rating for each quadrant
            ARtg - Current maximum rating
            PFRtgQ1, PFRtgQ2, PFRtgQ3, PFRtgQ4 - Power factor rating for each quadrant
            WHRtg - Energy maximum rating
            AhrRtg - Amp-hour maximum rating
            MaxChaRte - Charge rate maximum rating
            MaxDisChaRte - Discharge rate maximum rating

        :return: Dictionary of nameplate ratings.
        """

        der.DERError('Unimplemented function: nameplate')
Exemplo n.º 27
0
    def frt_stay_connected_low(self, params=None):
        """ Get/set high frequency ride through (must stay connected curve)

        Params:
            Ena - Enabled (True/False)
            ActCrv - Active curve number (0 - no active curve)
            NCrv - Number of curves supported
            NPt - Number of points supported per curve
            WinTms - Randomized start time delay in seconds
            RmpTms - Ramp time in seconds to updated output level
            RvrtTms - Reversion time in seconds
            Tms# - Time point in the curve
            Hz# - Frequency point in the curve

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for HFRT control.
        """

        der.DERError('Unimplemented function: frt_stay_connected_low')
Exemplo n.º 28
0
    def measurements(self):
        """ Get measurement data.

        Params:

        :return: Dictionary of measurement data.
        """

        try:
            params['A'] = self.ts.prompt('Enter A: ')
            params['AphA'] = self.ts.prompt('Enter AphA: ')
            params['AphB'] = self.ts.prompt('Enter AphB: ')
            params['AphC'] = self.ts.prompt('Enter AphC: ')
            params['PPVphAB'] = self.ts.prompt('Enter PPVphAB: ')
            params['PPVphBC'] = self.ts.prompt('Enter PPVphBC: ')
            params['PPVphCA'] = self.ts.prompt('Enter PPVphCA: ')
            params['PhVphA'] = self.ts.prompt('Enter PhVphA: ')
            params['PhVphB'] = self.ts.prompt('Enter PhVphB: ')
            params['PhVphC'] = self.ts.prompt('Enter PhVphC: ')
            params['W'] = self.ts.prompt('Enter W: ')
            params['Hz'] = self.ts.prompt('Enter Hz: ')
            params['VA'] = self.ts.prompt('Enter VA: ')
            params['VAr'] = self.ts.prompt('Enter VAr: ')
            params['PF'] = self.ts.prompt('Enter PF: ')
            params['WH'] = self.ts.prompt('Enter WH: ')
            params['DCA'] = self.ts.prompt('Enter DCA: ')
            params['DCV'] = self.ts.prompt('Enter DCV: ')
            params['DCW'] = self.ts.prompt('Enter DCW: ')
            params['TmpCab'] = self.ts.prompt('Enter TmpCab: ')
            params['TmpSnk'] = self.ts.prompt('Enter TmpSnk: ')
            params['TmpTrns'] = self.ts.prompt('Enter TmpTrns: ')
            params['TmpOt'] = self.ts.prompt('Enter TmpOt: ')
            params['St'] = self.ts.prompt('Enter St: ')
            params['StVnd'] = self.ts.prompt('Enter StVnd: ')
            params['Evt1'] = self.ts.prompt('Enter Evt1: ')
            params['Evt2'] = self.ts.prompt('Enter Evt2: ')
            params['EvtVnd1'] = self.ts.prompt('Enter EvtVnd1: ')
            params['EvtVnd2'] = self.ts.prompt('Enter EvtVnd2: ')
            params['EvtVnd3'] = self.ts.prompt('Enter EvtVnd3: ')
            params['EvtVnd4'] = self.ts.prompt('Enter EvtVnd4: ')
        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 29
0
    def volt_var_curve(self, id, params=None):
        """ Get/set volt/var curve
            v [] - List of voltage curve points
            var [] - List of var curve points based on DeptRef
            DeptRef - Dependent reference type: 'VAR_MAX_PCT', 'VAR_AVAL_PCT', 'VA_MAX_PCT', 'W_MAX_PCT'
            RmpTms - Ramp timer
            RmpDecTmm - Ramp decrement timer
            RmpIncTmm - Ramp increment timer

        :param params: Dictionary of parameters to be updated.
        :return: Dictionary of active settings for volt/var control.
        """
        try:
            if params is not None:
                self.ts.confirm('Set the following parameters %s' % params)
            else:
                params = None

        except Exception, e:
            raise der.DERError(str(e))
Exemplo n.º 30
0
    def info(self):
        """ Get DER device information.

        Params:
            Manufacturer
            Model
            Version
            Options
            SerialNumber

        :return: Dictionary of information elements.
        """
        try:
            params = {}
            params['Manufacturer'] = self.ts.prompt('Enter Manufacturer: ')
            params['Model'] = self.ts.prompt('Enter Model: ')
            params['Options'] = self.ts.prompt('Enter Options: ')
            params['Version'] = self.ts.prompt('Enter Version: ')
            params['SerialNumber'] = self.ts.prompt('Enter Serial Number: ')
        except Exception, e:
            raise der.DERError(str(e))