FB_HVACPowerMeasurementKL3403

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
STRUCT
diIL1, diIL2, diIL3 : DINT; A Ieff Auflösung: 0,1 A
diUL1, diUL2, diUL3 : DINT; V Ueff Auflösung: 0,1 V
diPL1, diPL2, diPL3 : DINT; kW Pw pro Phase Auflösung: 0,1 kW
diPg : DINT; kW Pges Auflösung: 0,1 kW
diCosPhiL1, diCosPhiL2, diCosPhiL3 : DINT; cosPhi pro Phase Auflösung: 0,01
diCosPhi : DINT; cosPhiges 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 Auflösung: 0,1 A
diUmaxL1, diUmaxL2, diUmaxL3 : DINT; V Umax Auflösung: 0,1 V
diPmaxL1, diPmaxL2, diPmaxL3 : DINT; kW Pmax Auflösung: 0,1 kW
diSg : DINT; kVA Sges Auflösung: 0,1 kVA
diQg : DINT; kvar Qges Auflösung: 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 final measured value is always dec. 1000 (100.0%) irrespective of the terminal type, the primary end value of the transformer must be specified for the factor.
Example with KL3403-0000: A 400/1A transformer produces 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 = 400A.
Example with KL3403-0010: A 400/5A transformer produces 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 = 400A.
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 (see E_HVACPowerMeasurementMode).
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 have to be deleted from the internal EEPROM, no value is refreshed during this time and the variable bDelEnergyMeasuredValuesBusy indicates TRUE.
bError: If TRUE, an error has occurred in the register communication.
iErrID: Error ID in the register communication
0x100 Timeout error. The time permitted for execution has been exceeded.
0x200 Parameter error (e.g. an invalid register number).
0x300 The read value differs from the written value (write access to this register may not be enabled or have 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 (see ST_HVACPowerMeasurement).
Requirements
Development environment | required library | required function |
---|---|---|
TwinCAT 3.1 build 4022.16 or higher | Tc2_HVAC V3.3.1.0 | TF8000 | TC3 HVAC V1.0.0.0 |