Table of Contents

Generic Consumption Meter

Full Name

Lib.Hvac.v1_0.T41_GenericConsumptionMeter

Description

A counter that allows processing of states for different time intervals. It works with energy; if power processing is required, an integrator functional block must be added in advance – the value at the input must be increasing.

Required Project References

Usage in ST

program test
    var
        gcm: lib.hvac.v1_0.T41_GenericConsumptionMeter;
    end_var

    gcm();
end_program

Description of Inputs and Outputs

Inputs NameData TypeRetainRequired Connection Meaning
use_e_time bool No No Determines whether to use energy time e_time (=true) or local PLC internal time (=false)
e_time td No No Energy time
x real No Yes Counter input of consumed energy/quantity (assumed increasing value protected against overflow)
brst bool No No Resets outputs, if *_init inputs have a value other than -1, they are applied for the respective intervals
bcint bool No No User counter transition signal (outside clock, any period)
tariff int No No Current tariff number - determines which tariff will be incremented
btariff_rst bool No No Resets tariff outputs, if *_init tariff inputs have a value other than -1, they are applied for the respective tariff outputs
shift int No No Current shift number - determines which shift will be incremented
bshift_rst bool No No Resets shift outputs, if *_init shift inputs have a value other than -1, they are applied for the respective shift outputs
cint_init real Yes No Init value for user counter 1
q_init real Yes No Init value for quarter-hour counter 1
hour_init real Yes No Init value for hourly counter 1
day_init real Yes No Init value for daily counter 1
week_init real Yes No Init value for weekly counter 1
month_init real Yes No Init value for monthly counter 1
year_init real Yes No Init value for yearly counter 1
q_last_init real Yes No Init value for last quarter-hour 1
hout_last_init real Yes No Init value for last hour 1
day_last_init real Yes No Init value for last day 1
week_last_init real Yes No Init value for last week 1
month_last_initreal Yes No Init value for last month 1
year_last_init real Yes No Init value for last year 1
tariff1_init real Yes No Init value for 1st tariff 2
tariff2_init real Yes No Init value for 2nd tariff 2
tariff3_init real Yes No Init value for 3rd tariff 2
tariff4_init real Yes No Init value for 4th tariff 2
tariff5_init real Yes No Init value for 5th tariff 2
tariff6_init real Yes No Init value for 6th tariff 2
tariff7_init real Yes No Init value for 7th tariff 2
shift1_init real Yes No Init value for 1st shift 3
shift2_init real Yes No Init value for 2nd shift 3
shift3_init real Yes No Init value for 3rd shift 3
shift4_init real Yes No Init value for 4th shift 3

1 To apply the values of *_init, their value must be different from -1 and a rising edge must occur on the rst input

2 To apply the values of *_init, their value must be different from -1 and a rising edge must occur on the btariff_rst input

3 To apply the values of *_init, their value must be different from -1 and a rising edge must occur on the bshift_rst input

Outputs NameData Type Meaning
cint real Current value of the user counter (flip controlled by rising edge on bcint input)
cint_last real Last value of the user counter
q real Current quarter-hour value
q_est real Estimate for the quarter-hour value based on current trend
q_last real Last (previous to current) quarter-hour value
q_hour_max real Maximum quarter-hour value within the current hour
q_hour_max_stamp dt Time of maximum quarter-hour value within the current hour
q_day_max real Maximum quarter-hour value within the current day
q_day_max_stamp dt Time of maximum quarter-hour value within the current day
q_month_max real Maximum quarter-hour value within the current month
q_month_max_stamp dt Time of maximum quarter-hour value within the current month
hour real Value of the counter within the current hour
hour_est real Estimate for the hourly counter value based on current trend
hour_last real Last (previous to current) hourly counter value
hour_day_max real Maximum hourly counter value within the current day
hour_day_max_stamp dt Time of maximum hourly counter value within the current day
day real Value of the counter within the current day
day_last real Last (previous to current) counter value within the current day
day_month_max real Maximum hourly counter value within the current month
day_month_max_stampdt Time of maximum hourly counter value within the current day
week real Value of the counter within the current week
week_last real Last (previous to current) counter value within the current week
month real Value of the counter within the current month
month_last real Last (previous to current) counter value within the current month
year real Value of the counter within the current year
year_last real Last (previous to current) counter value within the current year
tariff1 real Counter value for 1st tariff
tariff2 real Counter value for 2nd tariff
tariff3 real Counter value for 3rd tariff
tariff4 real Counter value for 4th tariff
tariff5 real Counter value for 5th tariff
tariff6 real Counter value for 6th tariff
tariff7 real Counter value for 7th tariff
shift1 real Counter value for 1st shift
shift2 real Counter value for 2nd shift
shift3 real Counter value for 3rd shift
shift4 real Counter value for 4th shift
b_q bool End signal for the current quarter-hour 1
bhour bool End signal for the current hour 1
bday bool End signal for the current day 1
bweek bool End signal for the current week 1
bmonth bool End signal for the current month 1
byear bool End signal for the current year 1

1 Signaling is performed by a transition from false to true, lasting for 5 seconds, and then returning to false

Detailed Function Description

Uses local PLC time or own time (typically transformation of the start of the energy day). Supports tariffs, shifts, and user interval. Interval end signaling. The input value must be increasing and protected against overflow. Does not work with transformations.