What is a retain variable?
A retain variable is a PLC"Programmable Logic Controller" A Programmable Logic Controller, PLC, or Programmable Controller is a digital computer used for automation of industrial processes, such as control of machinery on factory assembly lines. Used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events variable which:
Such a variable is used to store application specific data, like for instance to count a cutting-edge cycle in order to stop for its blade replacement after a specific number of iterations.
Two parameters are checked to identify if the declaration changed:
The non-volatile memory size is hardware dependent. If the size of the retained variables is larger than the non-volatile storage space, an error will be logged and the data will not be stored in non-volatile memory. See NVRAM for more information.
For the KAS RuntimeIn computer science, runtime (or run-time) describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). Within KAS, runtime also refers to the virtual machine that manage the program written in a computer language while it is running Simulator, the retained variables are saved in a file in your project repository.
The following actions will reset retained value(s) to their Init value(s):
Retained variables should not be used as the output of FunctionA function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. Blocks. Doing so may cause problems with retaining the value if the FB is executed with the EnableEnable signal for the drive, Hardware-Enable with 24V signal to X8, Software-Enable command by setup Software, fieldbus or permanently set. Both are required for enabling the drive. input off. The output structure can cause it to be conditionally updated to zero or the old value.
A work-around solution is to use a copy (1 gain) function to selectively enable updating the retain variable from an intermediate variable, which is the output of a function block.
In the following image ReadActualPositionX is continually reading position feedback from an axis, and the copy block is saving a specific value to a retain variable. is the intermediate variable and ActualPositionXSavedPositionX is the retain variable.
|
Copyright © 2015 Kollmorgen™ |
|