Table of Contents

LightBase

Namespace
ZEquipment

This function block is an abstract implementation for Light and LightUM objects and can therefore not be instantiated directly.

This function block is used to control simple signaling lights on a typical automation system. It utilizes a PulsedOutput that makes all these different signaling sequences possible and a DigitalOutput which is then connected to an actually hardware-output via a fieldbus.

One has to use the Enable method to set a specific light pattern defined in LightCharacteristic or simply switch the light on or off

  • fixed: A steady light (on or off)
  • flashing: A rhythmic light in which the total duration of the light in each period is clearly shorter than the total duration of the darkness and in which the flashes of light are all of equal duration.
  • occulting: A rhythmic light in which the duration of light in each period is longer than the total duration of darkness. In other words, it is the opposite to a flashing light.
  • isophase: is a light which has dark and light periods of equal length. Typically 1Hz
  • group: Sequences of flashes get interrupted by a duration (pausetime) where the state of the light is either off or on defined by (pausetimeState).
FUNCTION_BLOCK ABSTRACT LightBase

Constructor

FB_init

This method is executed during initialization phase of the Light object and sets the starting characteristic to LightCharacteristic.FixedOff

METHOD FB_init (
 bInitRetains : BOOL,
 bInCopyCode : BOOL) : BOOL

Inputs

bInitRetains BOOL

bInCopyCode BOOL

Returns

BOOL

Properties

Characteristic

This property returns the current active light characteristic, which is set when calling Enable. This property returns LightCharacteristic.Custom whenever manual calls to the following methods, are performed to manipulate the active lighting pattern.

PROPERTY Characteristic : LightCharacteristic

Property Value

LightCharacteristic

Delay

Controls the start delay of the customizable signal pattern, which is the duration that is waited for before the digital output ist set to NOT PauseState. For details about the pattern, see PulsedOutput.

PROPERTY Delay : LREAL

Property Value

LREAL

Duration

Controls the duration (in s) of the customizable signal pattern, which is the duration that the digital output is switched on for, before entering its pause phase (or disabled phase if group count > 0).

For details about the pattern, see PulsedOutput.

PROPERTY Duration : LREAL

Property Value

LREAL

Enabled

This property returns the current state of the light. The implementation inside light respects the logic configuration.

  • Setting the property to TRUE internally calls Enable(LightCharacteristic.FixedOn),
  • Setting the property to FALSE internally calls Enable(LightCharacteristic.FixedOff)
PROPERTY Enabled : BOOL

Property Value

BOOL

Frequency

Controls the frequency (in Hz) of the customizable signal pattern. Internally, this property is related to Duration with Duration := 0.5/Frequency.

For details about the pattern, see PulsedOutput.

PROPERTY Frequency : LREAL

Property Value

LREAL

GroupCount

Controls the group count of the customizable signal pattern, which is the number of repitions of enabled and disabled phases of the digital output before the pause duration is started.

For details about the pattern, see PulsedOutput.

PROPERTY GroupCount : INT

Property Value

INT

PauseDuration

Controls the pause duration of the customizable signal pattern, which is the duration that is waited for between individual repititions of enabled-disabled phases accordingly to the group count. For GroupCount=0 this property is unused. For details about the pattern, see PulsedOutput.

PROPERTY PauseDuration : LREAL

Property Value

LREAL

PauseState

Controls the pause state of the customizable signal pattern. Note that the actual signal of the pattern is the inverted pause state. For details about the pattern, see PulsedOutput.

PROPERTY PauseState : BOOL

Property Value

BOOL

Simulation

Every light is able to simulate its behaviour. With activated simulation the function block uses internally a different variable to save its state and therefore it is also possible to simulate the behaviour of a light even without any connected hardware. Set this property to TRUE to enable simulation and FALSE to disable simulation

PROPERTY Simulation : BOOL

Property Value

BOOL

Methods

Enable

Enable a specific light blinking mode. Use a specific mode from LightCharacteristic enumeration or use custom combined with the following properties

Note

Note that the latter properties can also be used after calling this method in order to fine tune a preset.

METHOD Enable (
 characteristic : LightCharacteristic)

Inputs

characteristic LightCharacteristic

characteristic of the light, most common is fixedOn or isophase

Invert

This method simply inverts the output of the light according to the Invert methodology. It should not be used while using a defined pattern like isophase or occulting because of unexpected behavior, but can be used while using fixedOn or fixedOff characteristic.

METHOD Invert ()

IsEnabled

Returns the actual state of the light output. If the light is set, it returns TRUE otherwise FALSE. However, the state on the fieldbus may be different, which depends on the current parameterized logic of the DigitalOutput which can be changed with SetLogic

METHOD IsEnabled () : BOOL

Returns

BOOL

Name

This method returns the name that has been set with SetName during initialization phase.

METHOD FINAL Name () : ZCore.ZString

Returns

ZString

Off

This method turns the light off and stops any light blinking mode; Its simply the same action as calling Enable(ZEquipment.LightCharacteristic.FixedOff);

METHOD Off ()

On

This method turns the light on without any blinking mode; Its simply the same action as calling Enable(ZEquipment.LightCharacteristic.FixedOn);

METHOD On ()

SetLogger

Setting a Logger with this method enables the logging functionality of lights.

Note

To change the logging behaviour it is sometimes useful to inject a LoggerNameDecorator here. For more information on that pattern read the following documentation (TODO: documentation of the decorator Pattern)

Leaving this Light instance without logger will not create any log entry

METHOD SetLogger (
 logger : ZCore.ILogger)

Inputs

logger ILogger

SetLogic

The actual logic of a light output can be changed in initialization phase or anywhere, at any time in the application. Depending on the logic, the internally instantiated DigitalOutput has a different behaviour while returning the actual state For more information on that, please refer to the SetLogic docs at DigitalOutput.

METHOD SetLogic (
 logic : DigitalLogic)

Inputs

logic DigitalLogic

logic of the output, available types normal and inverted

SetName

Usually logging should not be used for lights because some of them are switched very often which leads to a high logging load. However, to differantiate between all those lights (e.g. in a IO-Bridge) they should be initialized with a name. Initialization can be done with instantiation or later by calling this SetName method. A name should not be longer than 30 characters and should be used according to the name in an electrical plan of your automation project to have a proper connection for the service personnel.

METHOD SetName (
 name : ZCore.ZString)

Inputs

name ZString

SetSimulation

METHOD SetSimulation (
 on : BOOL)

Inputs

on BOOL