ImpulseOutput
- Namespace
- ZEquipment
- Implements
Stripped down version of PulsedOutput, by removing all additional properties besides the ones that are required to set up an impulse. The essential properties of this object are related to the properites of PulsedOutput as follows.
PulsedOutput.Delay := Delay;
PulsedOutput.Duration := Duration;
PulsedOutput.PauseDuration := PauseDuration;
PulsedOutput.GroupCount := 1;
PulsedOutput.PauseState := FALSE;
FUNCTION_BLOCK ImpulseOutput IMPLEMENTS ZCore.IObject, ZEquipment.IDigital, ZCore.IError, ZCore.ITrigger
Constructor
FB_init
METHOD FB_init (
bInitRetains : BOOL,
bInCopyCode : BOOL,
parent : ZCore.IManagedObject) : BOOL
Inputs
bInitRetains
BOOLif TRUE, the retain variables are initialized (warm start / cold start)
bInCopyCode
BOOLif TRUE, the instance afterwards gets moved into the copy code (online change)
parent
IManagedObjectInterface to the ManagedObject that is the parent of this object
Returns
- BOOL
Properties
Busy
This property returns TRUE
if the object is Busy executing a sequence or still in its
initialization phase (if applicable). It returns FALSE
if the object is Idle or in an
Error state.
Use State
to find out if the object is busy executing its initialization phase,
or it is busy performing an actual sequence.
PROPERTY Busy : BOOL
Property Value
- BOOL
Delay
Delay before the digital output is enabled
PROPERTY Delay : LREAL
Property Value
- LREAL
Done
If the object is in idle state (often mentioned as "the object is not busy and not on error"),
this is indicated by this property returning TRUE
.
PROPERTY Done : BOOL
Property Value
- BOOL
Duration
Duration the digital output should be switched on
PROPERTY Duration : LREAL
Property Value
- LREAL
Enabled
Returns TRUE
if the actual output is currently set to TRUE
because of an ongoing impulse or the isophase TRUE cycle.
This property can be used to run things only in phases where the output of this function block is in TRUE state
PROPERTY Enabled : BOOL
Property Value
- BOOL
Error
If the object aborts its execution with an error, this is indicated by this property returning TRUE
.
Information about the error may be retrieved by utilizing the methods that are implemented from the
IError.
Returns TRUE
if a fault occured within a sequence or the initialization phase
of an object, respectively. If this property returns TRUE
, use
to get insights about the origin of the fault.
PROPERTY Error : BOOL
Property Value
- BOOL
PauseDuration
Duration, which should be waited after the impulse before the object is transitioning from Busy to Idle
PROPERTY PauseDuration : LREAL
Property Value
- LREAL
Simulation
Enables or disables the simulation of the internally instantiated DigitalOutput so it can be used without hardware. If it is set to TRUE the simulation is enabled for this PulsedOutput otherwise it will write its value to the actual link on the fieldbus.
PROPERTY Simulation : BOOL
Property Value
- BOOL
Methods
Enable
This method enables the PulsedOutput statically to the given value.
The actual state that is set on the fieldbus depends on the parametrized logic of the digital output.
METHOD Enable (
on : BOOL)
Inputs
ErrorId
Returns the error code of the first error source for this object. The method recursively goes down the error stack until the initial source of error of this object can be found. For performance reasons, the error stack is not cleared when the error state is reset. So this method should always used in conjunction with Error.
METHOD ErrorId () : UDINT
Returns
- UDINT
ErrorMessage
Returns the error description of the first error source for this object. The method recursively goes down the error stack until the initial source of error of this object can be found. For performance reasons, the error stack is not cleared when the error state is reset. So this method should always used in conjunction with Error.
METHOD ErrorMessage () : ZCore.ZString
Returns
ErrorSource
This method returns the direct error source of this object. This method can then be used to retrieve the actual error source by using the method of the returned IError.
METHOD ErrorSource () : ZCore.IError
Returns
FallingTrigger
Often it is necessary to start an action on a falling or rising edge of an output. This method is especially created for this purpose. It Returns TRUE once, if the PulsedOutput has a falling edge on its output
METHOD FallingTrigger () : BOOL
Returns
- BOOL
HasTriggered
Depending on the logic set with SetTriggerLogic this method internally calls RisingTrigger or FallingTrigger.
METHOD HasTriggered () : BOOL
Returns
- BOOL
Invert
Because this function block is just an extension of a DigitalOutput, it can also be used as a simple output
This method toggles the output from false
to true
and vice-versa.
The actual state that is set on the fieldbus depends on the parameterized logic of the digital output.
METHOD Invert ()
Name
This method returns the name that has been set with SetName
METHOD FINAL Name () : ZCore.ZString
Returns
RisingTrigger
Returns TRUE
for on call, if the output switched from TRUE
to FALSE
. This method
respects the logic that the digital output is parametrized with.
METHOD RisingTrigger () : BOOL
Returns
- BOOL
RunAsync
Runs the pattern that is configured the input variables of this function block. It is possible to call this method while the object is already busy (e.g. RunAsync was called before). Doing so resets the pattern to its initial phase and resets the iterator of already performed cycles to 0;
METHOD RunAsync (
startToken : ZCore.IStartToken)
Inputs
startToken
IStartToken
SetLogger
Setting a Logger with this method enables the logging functionality of the PulsedOutput function block.
Setting logger=0
deactivates logging, which might be useful for PulsedOutput, because these
function blocks can easily spam the logger with (unimportant) messages.
Note
To change the logging behaviour it is sometimes useful to inject a LoggerNameDecorator here.
METHOD SetLogger (
logger : ZCore.ILogger)
Inputs
logger
ILoggerinterface of a logger instance or a logger decorator instance
SetLogic
According to the process or the used hardware some inputs are high-
or low active
.
To standardize this, all digital in- and outputs have the functionality to abstract this behaviour.
METHOD SetLogic (
logic : DigitalLogic)
Inputs
logic
DigitalLogiclogic of the input, available types normal and inverted
SetName
Usually logging should not be used for outputs, because some of them are switched very often which leads to a high logging load. To differentiate between all those outputs they have to be initialized with a name. A name should not be longer than about 30 characters and should be used according to the name in an electrical plan of your automation project to be able to identify the corresponding input properly.
METHOD SetName (
name : ZCore.ZString)
Inputs
name
ZStringname of the Pulsed output as STRING, should not be longer than 30 characters
SetSimulation
Enables or disables the simulation of the internally instantiated DigitalOutput so it can be used without hardware. If it is set to TRUE the simulation is enabled for this PulsedOutput otherwise it will write its value to the actual link on the fieldbus.
METHOD SetSimulation (
on : BOOL)
Inputs
SetTriggerLogic
This method controls the logic of the HasTriggered method
METHOD SetTriggerLogic (
logic : DigitalLogic)
Inputs
logic
DigitalLogiclogic of the digital output, available types normal and inverted
Stop
Signal patterns that may have been started previously are interrupted immediately.
The state of the digital output is not changed by calling this method. It remains in the state it was previously.
METHOD Stop ()
TraceErrorStack
This method is used internally when recording an error trace.
METHOD TraceErrorStack (
trace : ZCore.IErrorTrace)
Inputs
trace
IErrorTrace