FB_HVACPowerMeasurementKL3403
Application
This function block serves to control a 3-phase power measurement terminal (KL/KS3403). The terminal data is read out and all variables that depend on it are derived. The Bus Terminal KL3403 enables the measurement of all relevant electrical data of the supply network. The voltage is measured via the direct connection of L1, L2, L3 and N. The current of the three phases L1, L2 and L3 is fed via simple current transformers. All measured currents and voltages are available as RMS values. In the KL3403 version, the active power and the energy consumption for each phase are calculated. Through the relationship of the RMS values of voltage U * current I and the active power P, all other information such as apparent power or phase shift angle cos φ can be derived. For each fieldbus, KL3403 provides a comprehensive network analysis and an energy management option. The data is read out in 8 groups one after the other. Dependent values are calculated cyclically. The energy measurement is read out from the terminal as a 32-bit value with the overflow from register 1. The input bDelEnergyConsumption can be used to delete this value.
The results of the power measurement are available in the output structure ST_HVACPowerMeasurement. The structure is 120 bytes long.
The input and output variables wDataL1, wDataL2, wDataL3, bySBL1, bySBL2, bySBL3, byCBL1, byCBL2, byCBL3, iDataOutL1, iDataOutL2 and iDataOutL3 must be linked with the KL3403 Bus Terminal. They are needed in order to obtain all the data from the terminal. |
TYPE ST_HVACPowerMeasurement
Name : Type Unit Description
STRUCT
diIL1, diIL2, diIL3 : DINT; A Ieff Strom (Effektivwert) Auflösung: 0,1 A
diUL1, diUL2, diUL3 : DINT; V Ueff Spannung (Effektivwert) Auflösung: 0,1 V
diPL1, diPL2, diPL3 : DINT; kW P Wirkleistung pro Phase Auflösung: 0,1 kW
diPg : DINT; kW Pges Wirkleistung Auflösung: 0,1 kW
diCosPhiL1, diCosPhiL2, diCosPhiL3 : DINT; cosPhi Leistungsfaktor pro Phase Auflösung: 0,01
diCosPhi : DINT; cosPhiges Leistungsfaktor Auflösung: 0,01
diWL1, diWL2, diWL3 : DINT; kWh Energieverbrauch Auflösung: 1 kWh
diWg : DINT; kWh Energieverbrauch Auflösung: 1 kWh
diImaxL1, diImaxL2, diImaxL3 : DINT; A Imax Spitzenwert des Stroms Auflösung: 0,1 A
diUmaxL1, diUmaxL2, diUmaxL3 : DINT; V Umax Spitzenwert der Spannung Resolution: 0,1 V
diPmaxL1, diPmaxL2, diPmaxL3 : DINT; kW Pmax Spitzenwert der Wirkleistung Resolution: 0,1 kW
diSg : DINT; kVA Sges Scheinleistung Resolution: 0,1 kVA
diQg : DINT; kvar Qges Blindleistung Resolution: 0,1 kvar
dummy : DINT; Reserve, füllt die Struktur auf 120Bytes auf
END_STRUCT
VAR_INPUT
wDataL1, wDataL2, wDataL3 : WORD;
bySBL1, bySBL2, bySBL3 : BYTE;
diCurrTransFactor : DINT;
eModePowerMeasurement : E_HVACPowerMeasurementMode;
bDelEnergyConsumption : BOOL;
wDataLx: input data from the three channels of the KL3403.
bySBLx: status byte of the three channels of the KL3403. Reports which value can be read via the input (wDataLx).
diCurrTransFactor: transformation factor of the current transformer, used for conversion to the actual string current and the associated values.
Since the measured end value always results in dec. 1000 (100.0%) regardless of the terminal type, the primary end value of the transformer must be specified for the factor.
Example KL3403-0000: a 400/1A transformer results in a diCurrTransFactor of 400 With an internal resolution of 0.001 A, a measured value of max. 1 A results in an end value of dec. 1000 (100.0%) * diCurrTransFactor = 400 A.
Example KL3403-0010: a 400/5A transformer results in a diCurrTransFactor of 400. With an internal resolution of 0.005 A, a measured value of max. 5 A results in an end value of dec. 1000 (100.0%) * diCurrTransFactor = 400 A.
eModePowerMeasurement: if the value of this parameter lies between 1 and 8, the automatic read-out of all data is interrupted. Only the corresponding selected measured variable is read per cycle.
TYPE E_HVACPowerMeasurementMode:
(
eHVACPowerMeasurementMode_AutoAllValues := 0,
eHVACPowerMeasurementMode_Current := 1,
eHVACPowerMeasurementMode_Voltage := 2,
eHVACPowerMeasurementMode_EffectivePower := 3,
eHVACPowerMeasurementMode_PowerFactor := 4,
eHVACPowerMeasurementMode_EnergyConsumption := 5,
eHVACPowerMeasurementMode_PeakCurrentValu := 6, 1)
eHVACPowerMeasurementMode_PeakVoltageValue := 7, 1)
eHVACPowerMeasurementMode_PeakPowerValue := 81)
);
END_TYPE
bDelEnergyConsumption : a positive edge at this input deletes the energy consumption in the EEPROM. The energy consumption is counted in RAM and saved every 15 minutes in the EEPROM. It is retained there even if the KL3403 is switched off.
1) The minimum and peak values are deleted when the KL3403 is switched off.
VAR_OUTPUT
BDelEnergyMeasuredValuesBusy : BOOL;
bError : BOOL;
iErrID : UDINT;
byCBL1, byCBL2, byCBL3 : BYTE;
iDataOutL1, iDataOutL2, iDataOutL3: INT;
stQ_PowerMeasurement : ST_HVACPowerMeasurement;
bDelEnergyMeasuredValuesBusy: since the measured energy values are deleted from the internal EEPROM, no value is updated during this time and the flag bDelEnergyMeasuredValuesBusy shows TRUE.
bError: if TRUE, an error has occurred in the register communication.
iErrID: error ID in the register communication
0x100 Timeout error. The permissible execution time has been exceeded.
0x200 Parameter error (e.g. with an invalid register number).
0x300 The read value differs from the written value ( write access to this register possibly not allowed or failed )
byCBLx: this output serves the selection of the desired input value and register communication in order to delete the energy consumption.
iDataOutLx: this output serves the register communication in order to delete the energy consumption.
stQ_PowerMeasurement: the results of the power measurement as an output data structure.
The example shows how a KL3403 terminal must be linked with the input and output variables of the PLC