Section 6 Program Code Issues
Control Module Types
3BSE042835-600
91
Control Module Types
Code Sorting and Algebraic Loops
The code block sorting is a powerful tool that can be used to minimize delay
between input and output signals. This is achieved by dividing the code into
different code blocks in Control Builder. Code blocks can be used when information
is transmitted between objects in both directions using a structured data type. By
splitting the code into two or more code blocks it is possible to both send and
receive information within the same scan.
However, the situation is different when it comes to connections for example
reading and writing to single parameters. The basic principle is that an application
programmer should be allowed to write any IN parameter and read any OUT
parameter of a module without causing loops. This is achieved by writing to all
OUT parameters in a specific code block. This code block shall not contain anything
else but the writing to the OUT parameters. Local copies of the OUT parameters are
used in the other code blocks. These variables shall have the attribute nosort to avoid
loops. In order to secure that the output parameters are updated correctly, each of
these internal variables must be assigned in one code block only. If an output
parameter is dependant on calculations in more than one code block, there need to
be one internal variable with the intermediate result per code block.
For the parameter
InteractionPar
, the attribute “Nosort”
is used under some
circumstances to prevent code loops. The code shall be written in such a way that no
component of
InteractionPar
is marked as "written".
A problem occurs when
InteractionPar
is passed into an internal Function Block as
an
IN_OUT
parameter. In this case, all components of
InteractionPar
shall have the
attribute "Nosort". This works fine in all cases except, when the order of assignment
of the components of
InteractionPar
is crucial. There is only one known case when
this order is crucial and that is when an "Apply" component is set. In this case, all
other components must be set before "Apply" is set.
Code tab names in control modules that begin with
Start_
are sorted separately and
execute once before all other code in all other control modules in the application
after warm or cold start. The “Start_” feature can be used when a different code
sorting order is desired during initialization.
Содержание AC 800M
Страница 1: ...Power and productivity for a better worldTM AC 800M Library Object Style Guide System Version 6 0...
Страница 2: ......
Страница 3: ...AC 800M Library Object Style Guide System Version 6 0...
Страница 12: ...Related Documentation About This User Manual 12 3BSE042835 600...
Страница 18: ...Naming Convention Section 1 Libraries 18 3BSE042835 600...
Страница 108: ...SIL Mark Restrictions Section 6 Program Code Issues 108 3BSE042835 600...
Страница 116: ...Standard Library Parameters Appendix A Names and Abbreviations 116 3BSE042835 600...
Страница 119: ......