Skip to main content

AbstractSafetyReleaseDistributor

Short Summary

The AbstractSafetyReleaseDistributor is a base class designed to distribute changes of a safety release state. It defines two final methods: subscribe() – Registers a subscriber that implements the ISafetySwitch interface. run() – Called cyclically to monitor the safety state. When the SafetyIsOk property changes (rising or falling edge), all registered subscribers are notified:

On true → switchOn() is called on each subscriber. On false → switchOff() is called on each subscriber.

The class declares one abstract property: SafetyIsOk : BOOL – Must be implemented by the user to provide the actual current safety status (e.g., coming from hardware inputs or system logic).

Examples

FUNCTION_BLOCK MySafetyDistributor EXTENDS AbstractSafetyReleaseDistributor
VAR
SafetyInput AT %I* : BOOL; // physical input channel
END_VAR

PROPERTY GET SafetyIsOk : BOOL
VAR
END_VAR
SafetyIsOk := SafetyInput;
END_PROPERTY

//in the Main:

VAR
mySafety :MySafetyDistributor;
myHandler :OpModeHandler(rootNode := ... , safety := mySafety);
END_VAR
AccessAbstractFinalExtendsImplements
YesNoCNM_AbstractObject.ObjectCNM_OpModeHandlingInterfaces.ISafetyReleaseDistributor

UML Diagram

Parameters

none

Properties

SafetyIsOk

Type: BOOL

This poperty indicates that all safety conditions to run th system are met.

Methods

run

  • Return type: VOID

A method that should be called cyclically to update and execute a class instance.

subscribe

  • Parameters:
    • subscriber (CNM_OpModeHandlingInterfaces.ISafetySwitch): class with the Interface ISafetySwitch, that can be switched on/off
  • Return type: VOID

This method adds the subscriber to a subscribption list. All subscribers are going to be notified, if the safety release changes.

Code

Declaration

FUNCTION_BLOCK ABSTRACT AbstractSafetyReleaseDistributor EXTENDS CNM_AbstractObject.Object IMPLEMENTS CNM_OpModeHandlingInterfaces.ISafetyReleaseDistributor
VAR
subscriberList :CNM_Collections.LinkedList;
iterator :SafetySwitchIterator(subscriberList);
lastSafetyState :BOOL := FALSE;
END_VAR