Class EnergyMeter3Module¶
Defined in File EnergyMeter3Module.hpp
Inheritance Relationships¶
Base Type¶
public Module
(Class Module)
Class Documentation¶
-
class EnergyMeter3Module : public Module¶
This class represents the 3 Phase Energy Meters Module connected via eMOD bus to controller module. This module is a three-phase 4 quadrants energy meter that allows to monitor the electrical parameters of your installation including active energy, reactive energy, voltage, current, power, maximum demand and more.
Class example 1
/* * This example uses a EnergyMeter3Module to configure and display some meters. */ #include "EnergyMeter3Module.hpp" #include "EmodRetMng.hpp" #include "HAL.hpp" int main() { EnergyMeter3Module module; if (module.init() != 0) { printf("Module could not be initialized!\n"); return 1; } // Configures transformers, work mode and metering standard module.configCurrentFullScale(1000, 1000, 1000); HAL::sleepMs(100); module.configVoltageFullScale(230, 230, 230); HAL::sleepMs(100); uint16_t work_mode = 0; module.configWorkMode(work_mode); HAL::sleepMs(100); uint16_t metering_standard = 0; module.configMeteringStandard(metering_standard); HAL::sleepMs(100); // Gets the power and energy measurements of phase 1 PhasePowerParameters power_L1; EnergyParameters energy_L1; while (1) { if(module.getPowerParameters_L1(&power_L1) == EmodRetOk){ printf("Power-Phase-L1 Voltage=%010.3f V Current =%010.3f A Frequency =%010.3f Hz Cosine =%010.3f Angle =%010.3f º\n", power_L1.voltage, power_L1.current, power_L1.frequency, power_L1.cosine, power_L1.angle); printf(" ActivePower=%010.3f kW AparentPower=%010.3f kVA ReactivePower =%010.3f kVAr\n", power_L1.active_power, power_L1.aparent_power, power_L1.reactive_power); printf(" /*EXPORTED*/ ActivePower=%010.3f kW AparentPower=%010.3f kVA InductivePower=%010.3f kVArl CapacitivePower=%010.3f kVArc\n", power_L1.exported_active_power, power_L1.exported_aparent_power, power_L1.exported_inductive_power, power_L1.exported_capacitive_power); printf(" /*IMPORTED*/ ActivePower=%010.3f kW AparentPower=%010.3f kVA InductivePower=%010.3f kVArl CapacitivePower=%010.3f kVArc\n", power_L1.imported_active_power, power_L1.imported_aparent_power, power_L1.imported_inductive_power, power_L1.imported_capacitive_power); printf(" MaximumPower(15')=%010.3f kW CurrentFullScale=%.3f VoltageFullScale=%.1f\n\n", power_L1.maximeter, power_L1.current_full_scale, power_L1.voltage_full_scale); } HAL::sleepMs(100); if(module.getEnergyParameters_L1(&energy_L1) == EmodRetOk){ printf("Energy-Phase-L1 ActiveEnergy=%010.3f kWh AparentEnergy=%010.3f kVAh InductiveEnergy=%010.3f kVArlh CapacitiveEnergy=%010.3f kVArch\n", energy_L1.active_energy, energy_L1.aparent_energy, energy_L1.inductive_energy, energy_L1.capacitive_energy); printf(" /*EXPORTED*/ ActiveEnergy=%010.3f kWh AparentEnergy=%010.3f kVAh InductiveEnergy=%010.3f kVArlh CapacitiveEnergy=%010.3f kVArch\n", energy_L1.exported_active_energy, energy_L1.exported_aparent_energy, energy_L1.exported_inductive_energy, energy_L1.exported_capacitive_energy); printf(" /*IMPORTED*/ ActiveEnergy=%010.3f kWh AparentEnergy=%010.3f kVAh InductiveEnergy=%010.3f kVArlh CapacitiveEnergy=%010.3f kVArch\n\n", energy_L1.imported_active_energy, energy_L1.imported_aparent_energy, energy_L1.imported_inductive_energy, energy_L1.imported_capacitive_energy); } sleepMs(1000); } }
Public Functions
-
EnergyMeter3Module()¶
-
~EnergyMeter3Module()¶
-
EmodRet init(const EnergyMeter3ModuleCallback_Type callback_func = nullptr, void *const callback_context = nullptr, const uint8_t variant = 1)¶
Initialize module. It is important to emphasize that init() method is mandatory to call it and must be called always after instantiating the module. It can be called several times, each of which the module is initialized again.
- Parameters
callback_func(optional) -- [in] function that will be called when a configured event occurs.
callback_context(optional) -- [in] context that will be passed to the callback function.
variant(optional) -- [in] identifies the module in case more than one module of the same type are present.
-
EmodRet init(const uint8_t variant)¶
Initialize module. It is important to emphasize that init() method is mandatory to call it and must be called always after instantiating the module. It can be called several times, each of which the module is initialized again.
- Parameters
variant -- [in] identifies the module in case more than one module of the same type are present.
-
EmodRet configCurrentFullScale(const float full_current_L1, const float full_current_L2, const float full_current_L3)¶
Configs the full scale amperage, 1:N ratio of the current transformer. Secondary full scale is 1 Amper.
- Parameters
full_current_L1 -- [in] full scale or ratio of conversion of the transformer (clamp, tiroidal, ...) at L1.
full_current_L2 -- [in] full scale or ratio of conversion of the transformer (clamp, tiroidal, ...) at L2.
full_current_L3 -- [in] full scale or ratio of conversion of the transformer (clamp, tiroidal, ...) at L3.
-
EmodRet configVoltageFullScale(const float full_voltage_L1, const float full_voltage_L2, const float full_voltage_L3)¶
Configs the full scale of the primary voltage of the transformer. If no transformer is present, this value should be the means voltage, ex. 230V
- Parameters
full_voltage_L1 -- [in] full scale of the transformer's primary at L1.
full_voltage_L2 -- [in] full scale of the transformer's primary at L2.
full_voltage_L3 -- [in] full scale of the transformer's primary at L3.
-
EmodRet configWorkMode(const uint16_t mode)¶
Configs the work mode as explained in SEM Three manual
- Parameters
mode -- [in] Mode 0 (All L1, L2 & L3 are single phased), Mode 1 (L2 & L3 are single phased, L1 isequilibrated three phased), Mode 2 (L3 is single phased, L1 & L2 are equilibrated three phased), Mode 3 (All L1, L2 & L3 are equilibrated three phased).
-
EmodRet configMeteringStandard(const uint16_t standard)¶
Configs the metering standard
- Parameters
standard -- [in] 0 (Circutor), 1 (IEC62053-23), 2 (IEEE 1459-2000)
-
EmodRet getCurrentFullScale(float *full_current_L1, float *full_current_L2, float *full_current_L3)¶
Gets the full scale amperage, 1:N ratio of the current transformer.
- Parameters
full_current_L1 -- [in] full scale or ratio of conversion of the transformer (clamp, tiroidal, ...) at L1.
full_current_L2 -- [in] full scale or ratio of conversion of the transformer (clamp, tiroidal, ...) at L2.
full_current_L3 -- [in] full scale or ratio of conversion of the transformer (clamp, tiroidal, ...) at L3.
-
EmodRet getVoltageFullScale(float *full_voltage_L1, float *full_voltage_L2, float *full_voltage_L3)¶
Gets the full scale of the primary voltage of the transformer.
- Parameters
full_voltage_L1 -- [in] full scale of the transformer's primary at L1.
full_voltage_L2 -- [in] full scale of the transformer's primary at L2.
full_voltage_L3 -- [in] full scale of the transformer's primary at L3.
-
EmodRet getWorkMode(uint16_t *mode)¶
Gets the work mode as explained in SEM Three manual
- Parameters
mode -- [out] Mode 0 (All L1, L2 & L3 are single phased), Mode 1 (L2 & L3 are single phased, L1 isequilibrated three phased), Mode 2 (L3 is single phased, L1 & L2 are equilibrated three phased), Mode 3 (All L1, L2 & L3 are equilibrated three phased).
-
EmodRet getMeteringStandard(uint16_t *standard)¶
Gets the metering standard
- Parameters
standard -- [out] 0 (Circutor), 1 (IEC62053-23), 2 (IEEE 1459-2000)
-
EmodRet getPowerParameters_L1(PhasePowerParameters *parameters)¶
Gets all the power parameters for phase L1
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getPowerParameters_L2(PhasePowerParameters *parameters)¶
Gets all the power parameters for phase L2
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getPowerParameters_L3(PhasePowerParameters *parameters)¶
Gets all the power parameters for phase L3
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getPowerParameters_L123Combined(CombinedPowerParameters *parameters)¶
Gets all the power parameters for the combination of the three phases
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getEnergyParameters_L1(EnergyParameters *parameters)¶
Gets all the energy parameters for phase L1
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getEnergyParameters_L2(EnergyParameters *parameters)¶
Gets all the energy parameters for phase L2
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getEnergyParameters_L3(EnergyParameters *parameters)¶
Gets all the energy parameters for phase L3
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
-
EmodRet getEnergyParameters_L123Combined(EnergyParameters *parameters)¶
Gets all the energy parameters for the combination of the three phases
- Parameters
parameters -- [out] Structured list of parameters as seen in EnergyMeterParameters.hpp
Protected Functions
-
EmodRet getPowerParameters(const int32_t phase, PhasePowerParameters *parameters)¶
-
EmodRet getEnergyParameters(const int32_t phase, EnergyParameters *parameters)¶
Protected Attributes
-
EnergyMeterFunctions *energy_meter¶
-
EnergyMeter3Module()¶