FB_EnergyMeasurement

FB_EnergyMeasurement 1:

Implements the measurement of a power measurement terminal over time. This allows the machine's energy consumption to be analyzed.

Internal functions:

Syntax:

FUNCTION_BLOCK FB_EnergyMeasurement EXTENDS FB_BaseMd

FB_EnergyMeasurement 2: Properties

Name

Type

Access

Initial value

Description

Name

STRING

Get, Set

<SourceName>

Specifies the name of the class instance.

FB_EnergyMeasurement

Custom

I_EnergyCalcQuery

Get

-

Energy meter reading since the last execution of the reset option.

MaxMemory

LREAL

Get, Set

0.05 [MB]

Storage limitation for the hourly stored energy meter reading.

PerDay

I_EnergyCalcQuery

Get

-

Energy meter reading of the day

PerHour

I_EnergyCalcQuery

Get

-

Energy meter reading of the hour

PerPart

I_EnergyCalcQuery

Get

-

Energy meter reading per part

SavingInterval

LREAL

Get, Set

120.0 [s]

Interval for saving the energy meter readings in a machine data file.

 

FB_BaseMd

MachineData

I_MdBaseContainer

Get

-

Interface for machine data handling.

FB_Base

BaseState

E_BaseState

Get

eNotHandled

Initialization state of the class instance.

Error

BOOL

Get

FALSE

Class is in an error state.

ResultMessage

I_AppMessage

Get

-

Access to the class-internal EventLogger.

[PROTECTED] _Name

STRING

Get

<SourceName>

.Name without leading 'fb'.

FB_EnergyMeasurement 3: Methods

Name

Description

Reset()

Resets the error state of the class.

FB_EnergyMeasurement

AddInput(iNew)

Adds an I/O element with energy measurement values.

Input(x)

Returns an interface to the xth I/O element of the energy measurement.

NewPart(bCLK)

Logs a new part to evaluate the energy per part.

Producing(bIsProducing)

Indicates that production is active.

FB_BaseMd

[PROTECTED] AddMdComp()

Adds a component of type I_MdComponent to the machine data container.

FB_Base

SetHMI(ipBase)

General assignment method for an FB_BaseHmi extending class.

Notice This method always fails in the FB_Base implementation. Overwriting is therefore absolutely necessary.

[PROTECTED] _QueryNamespace()

Extracts the first part of the instance path as an object namespace.

[PROTECTED] _QueryObjectName()

Extracts the last part of the instance path as the object name.

FB_EnergyMeasurement 4:

Exceptions avoidance

The list access functions (e.g. Channels(x), Groups(x), etc...) return a pseudo variable if the requested index is invalid. In addition, a message is thrown in the EventLogger.

FB_EnergyMeasurement 5: Cycle methods

Name

Description

Cyclic()

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

FB_EnergyMeasurement 6: Machine data

Component

Description

Index range

Number of instances

FB_MdFileInfo

File information

0x0000 Fxxx

1

FB_EnergyCalc

Counter PerDay, PerHour and Custom

0x0010 9xxx

3

FB_EnergyMeasurement 7: Interfaces

Type

Description

I_Base

Standard interface on FB_Base.

I_EnergyMeasurement

Standard interfaces on FB_EnergyMeasurement

I_OneTaskInterface

Runtime interface for a PLC task

I_BaseMd

Standard interface on FB_BaseMd.

I_BaseEmpty

For extension without standard interface.

I_BaseDev

Covers all methods and properties of the base class.

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)