FB_EnergyCalc

FB_EnergyCalc 1:

Contains the energy meter data for a defined period. The current and previous time periods are always saved.

Syntax:

FUNCTION_BLOCK FB_EnergyCalc EXTENDS FB_MdBaseComponent

FB_EnergyCalc 2: Machine data

Index (Identifier)

Parameter

PLC storage location

0x0010 9010

StartTime

<Local>

0x0010 9011

EnergyIdle

0x0010 9012

EnergyProduction

0x0010 9020

LastStartTime

0x0010 9021

LastEnergyIdle

0x0010 9022

LastEnergyProduction

FB_EnergyCalc 3: Properties

Name

Type

Access

Initial value

Description

Connected

BOOL

Get

FALSE

Component is connected to its dependencies (except for the MD container).

FB_EnergyCalc

ActivePower

LREAL

Get, Set

0.0

Currently active power consumption.

EnergyIdle

LREAL

Get

0.0

Energy outside of production.

EnergProduction

LREAL

Get

0.0

Energy during production.

LastEnergyIdle

LREAL

Get

0.0

Last energy outside of production.

LastEnergProduction

LREAL

Get

0.0

Last energy during production.

LastStartTime

I_Time

Get

-

Last start time.

NextDay

BOOL

Get

FALSE

A new day has begun since the current start time.

NextHour

BOOL

Get

FALSE

A new hour has begun since the current start time.

ProductionActive

BOOL

Get, Set

FALSE

Production is currently active.

StartTime

I_Time

Get

-

Start time (point)

ComponentType

USINT

Get

0

Type of component as identifier.

Connected

BOOL

Get

FALSE

Component is connected with its access dependencies.

FB_MdBaseComponent

LinkedContainer

I_MdBaseContainer

Get

NULL

Points to the container to which the component was appended.

Tc3_PlasticFunctions.FB_MdComponent

Further characteristics

<>

<>

<>

Implemented by FB_MdComponent

FB_EnergyCalc 4: Methods

Name

Description

AddNextComponent()

Adds the subsequent component to the component (list).

FB_EnergyCalc

Enable(bExecute)

Switches the recording on.

Init(iTimeRef)

Initializes the class with the reference to a system time.

Latch(bCmd)

Starts a new measurement start time.

FB_MdBaseComponent

[PROTECTED] ConfigCompType(eCompType)

Used with inheriting classes to initialize the encoding offset after E_StandardCompType.

[PROTECTED] ConfigCompTypeEx()

Used with the inheriting class to initialize the encoding offset.

[PROTECTED] NextString(…)

Simplified method for reading a text-based machine data parameter. This method is used within the MdNextParameter(...) Callback method.

[PROTECTED] SetString(…)

Simplified method for writing a text-based machine data parameter. This method is used within the MdSetParameter(...) Callback method.

Tc3_PlasticFunctions.FB_MdComponent

Other methods

Implemented by FB_MdComponent.

FB_EnergyCalc 5: Cycle methods

Name

Description

Cyclic()

Cycle method - Call once per PLC cycle (default 10 ms)

FB_EnergyCalc 6: Event-driven methods (callback methods)

Name

Description

MdNextParameter(…)

Container call for saving the parameters in a file, implemented by FB_MdComponent.

MdSetParameter(…)

Container call for loading the parameters into the runtime, implemented by FB_MdComponent.

FB_EnergyCalc 7: Interfaces

Type

Description

I_MdComponent

Standard interface on FB_MdComponent

I_EnergyCalc

Standard interface on FB_EnergyCalc.

I_EnergyCalcQuery

Reduced query interface to FB_EnergyCalc.

I_MdBaseComponent

Standard interface on FB_MdBaseComponent

Further interfaces

Implemented by FB_MdComponent

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT >= v3.1.4024.54 (recommended)
TwinCAT >= v3.1.4024.42 (required)

PC or CX (x64, x86)

Tc3_PlasticBaseApplication (>= v3.12.7.0)