By default, the IEC program of the visualization (Visu_Prg
) runs in its own task (VISU_TASK
). The visualization generally displays data from the main application. The data from the main application is processed in another task. For this reason, data consistency is an important topic when the application is run on a multicore controller.
It is important to know that there is no atomic (time indivisible) assignment for the STRING
and WSTRING
data types as well as for structured data. The date must not be changed when a date of these types is passed. However, if the date is changed by a task other than VISU_TASK
, then it might be displayed incorrectly for a short time.
Below you can see where you should maintain data consistency explicitly when creating a CODESYS visualization for use on a multicore system.
Always see the general information regarding multicore operation in the CODESYS help.
If the display of a visualization element depends on multiple variables, then the assignment of these variables is not cycle-consistent. For example, if an element is moved in the x and y- direction by means of two IEC variables, then this can have the effect that the visualization element moves only in the x-direction in one cycle and then the moves in the y-direction in the next cycle.
The same applies to data that is used by multiple visualization elements.
Example: Element 1 reads the state variable invisible
and updates its state. Another task than VISU_TASK
modifies the respective IEC variable. Element 2 reads the state variable invisible
and updates its state. Result: The elements have a different state for a short time. This behavior can occur for all animation variables.
Visualization change |
Note the problems described above when using string data types. |
Execute Command |
Note the problems described above when using string data types. |
Toggle frame visualization |
Note the problems described above when using string data types. |
Write Variable |
Like reading, no atomic assignments are possible for writing to |
Execute ST Code |
When creating the ST code, make sure that data consistency is not at risk. |
If a structure is transferred via VAR_INPUT
, then data consistency is not guaranteed. Use structured data via VAR_IN_OUT
, or use an interface via VAR_INPUT
.
If the user management is called via the public interfaces (VisuUserMgmt.library
), then this must always originate from the VISU_TASK
.
The Polygon visualization element has the Dynamic points property. Here you can configure an array of points. Note that the reading of the entire array is not atomic.
There is no atomic assignment for all properties configured with variables of the data type STRING
. Example: The control variable for the URL for the Web Browser visualization element.
|
|
|
Do not use the function block |
|
Caution: Structure access occurs when using |
|
Caution: String access occurs when using |
Passing parameters for dialogs should be considered in the same way as for complex data types. When a dialog is opened, a copy of all passed parameters is created.
Exception: VAR_IN_OUT
parameters that have {attribute 'VAR_IN_OUT_AS_POINTER'}
. If this attribute is assigned, then no copy is created and the dialog works on the original object.
See also