FB_MdCollection

FB_MdCollection 1:

The class can store a collection of components of a class type. When attaching the class to FB_BaseRuntime, components of objects implementing the interface I_AttachableMdInterface can be collected and attached to the collection.

FB_MdCollection 2:

Time of filling

If the collection is operated as a participant of the FB_BaseRuntime, this is filled after the ParamInit but before the machine data is loaded. Accordingly, all elements that are attached to the runtime at the time of the successful ParamInit are checked for transfer to the collection.

Syntax:

FUNCTION_BLOCK FB_MdCollection EXTENDS FB_Base

FB_MdCollection 3: Properties

Name

Type

Access

Initial value

Description

Name

STRING

Get, Set

<SourceName>

Specifies the name of the class instance.

FB_MdCollection

MachineData

I_MdBaseContainer

Get

<Local>

Interface to the internal machine data container

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_MdCollection 4: Methods

Name

Description

Reset()

Resets the error state of the class.

FB_MdCollection

AddComponent(iComponent)

Adds a component to the collection:

  • Automatically increments ComponentIndex of the attached components.

Refuses components that do not match the prototype.

[PROTECTED] CheckType(iComponent)

Returns an ID used among the supported types.

SetPrototype(iComponent)

Fixes the type of the component to be collected by the runtime.

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_MdCollection 5: Interfaces

Type

Description

I_Base

Standard interface on FB_Base.

I_MdCollection

Standard interface on FB_MdCollection

I_OneTaskInterface

Runtime interface for a PLC task

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.42

PC or CX (x64, x86)

Tc3_PlasticBaseApplication (>= v3.12.6.0)