Update read/write in Global Variable

Hello,
Could you please tell me if I’m ok. In default template project, we have one MainInstance program 100ms (priority 0) and If we use Global Variable (and not GDS update each 500us), documentation tell :
“If no update task is selected that triggers the update cycle, the GLOBALS task is used (low priority and update rate of 50 ms). You can set one update task each for the groups fieldbusses, the ESM system variables and the system variables of the web server (PLCnext Engineer) HMIs.”
So It means, that main task is update each 100ms and low priority R/W IO Axioline are updated each 50ms, as in my chronogram. Am I Right ?

image.png
It’s not as usal PLC with for each cycle : read Input → execute program → write output. The read and write can have a jitter of +/-50ms in a default configuration. Right ?
Thanks

Hello jlsalvat,
please find answers to your questions below:
A: So It means, that main task is update each 100ms and low priority R/W IO Axioline are updated each 50ms, as in my chronogram. Am I Right ?
Q: Yes, the IO Axioline bus is very fast and runs with e.g. 250us (depends on type and numbers of Axio-Moduls). The AXIO-Process data can be updated in GDS with the fastest cyclic task e.g. AXCF2152 => 1ms, AXCF 3152=> 500us (GDS Global Data Space (plcnext.help)).

A: It’s not as usal PLC with for each cycle : read Input → execute program → write output. The read and write can have a jitter of +/-50ms in a default configuration. Right ?
The read/write access to the Axio bus via the GDS component is executed in the same update time e.g. each 50ms.
The simplest way is to connect the In/Out-Port variable in program-instance to the process data for following scenario:
read Input(at the start of task-cycle) → execute program → write output(at the end of task-cycle).
If neccessary, it is also possible to connect the “Global-Variable” to process data.If the current value must be read/write during the program-execution time. In this case, you need to pay attention to your application architecture e.g. only one program instance should write to the global variable/process data. Please find the additional information under following link: GDS Global Data Space (plcnext.help) .
BR Eduard

Thanks for your response Edouard,
I’m quite confused on the 2 ways using I/O Axioline : GDS (IN OUT) or globals process Item, so I tried to test output with oscilloscope at 5ms with GDS (IN or OUT port) and Globals process ITEM (with FOR once one, using concat function or big counter to spend time once one). I have 2152 + DO16 smart element.
Questions i needed to answer :
1. Are the timing in accessing IO Axioline are different using GDS (use of in and out) or Resource global data (global and external in POU) ? response seems to be not (tests give the same result ).
2. in the middleware Phoeninx contact, the way GDS and ressources globals are update seem differents, I’ve read different rules, what is really done ?
2. If I have 2 tasks, GDS is better if we exchange the same data as explained in https://www.plcnext.help/te/PLCnext_Runtime/GDS_Global_Data_Space.htm . But we could try to use FBD as other we can do in M340 and not having problems of globals.
3. GDS is only needed if we want to play with IOT (mqtt, rest) or use C++ program . So we don’t need in and out GDS technique in a PLC program, Im right ?
Reason I have this questions is : use of GDS and Globals ressource are quite confusing for the beginner and seem not to be very usefull in a classic PLC way.
Before begining the test :
1/ Resource-global variables : I need to update data on Axioline with a cyclic 5ms task (otherwise the result is bad, caused by 50ms default global task, output give 0 or 24V and no pulse) I tried with a counter and a toggle on out port.
User: "image.png"Result of the test : T1 is my 5ms task, this task is once a long task (3ms and a toggle) and once a short (only the toggle of OUT). So I suppose globals read/write axioline are done in the begining of the user task (not at the end) or with a task R/W IO globals with the highest priority → so independant of the time passed in user task (lower priority).
If I use GDS and not globals I cannot see the difference.
image.png
Can you explain, I’m curious what is realy done in the ACF component with GDS and Global Ressources ? I change a lot of things and there were no difference on oscilloscope using GDS or Ressource globals.

I’ve read on https://github.com/PLCnext/BusConductor
Changing the local I/O update rate
By default, I/O data is exchanged with local I/O modules every 500 µs. This can be changed, if required, using either PLCnext Engineer or (for applications that do not use PLCnext Engineer) by editing configuration files directly on the PLC:
Using PLCnext Engineer
· In PLCnext Engineer, double-click on the local I/O bus controller (e.g. “Axioline F”) in the Project pane, click on the Settings tab, and select the “Trigger task” menu item.
· Select a cyclic task from the drop-down list. Data will be exchanged with local I/O modules every time this task is executed.
· If no cyclic task is selected, the I/O update rate is calculated by the PLCnext Runtime.
· If no cyclic tasks are defined on any ESM, I/O data is exchanged with local I/O modules every 500 µs.

I’ve read on https://www.plcnext.help/te/PLCnext_Runtime/GDS_Global_Data_Space.htm
Resource-global variables as input:
When creating your application, remember that there is no claim for data consistency when using resource-global variables. According to IEC 61131-3, resource-global variables can be used as an input in all Program Organization Units (POU) of the current resource. Several ESM tasks can access the fieldbus I/O data declared as resource-global variables. The update rate of the resource-global variables always depends on only one task. For the update behavior, an ESM task can be selected. You can make the setting in PLCnext Engineer:
Note : GLOBALS task update behavior
If no update task is selected that triggers the update cycle, the GLOBALS task is used (low priority and update rate of 50 ms). You can set one update task each for the groups fieldbusses, the ESM system variables and the system variables of the web server (PLCnext Engineer) HMIs.
Note: The priorities in the PLCnext firmware are set to update the I/O of the fieldbusses Axioline, PROFINET, INTERBUS, EtherNet/IP™, etc.) with the highest priority. Then, ESM tasks are processed for which a priority has been configured. An exception is the IDLE task; it is processed with the lowest priority.
Up to firmware version 2020.9 : The GLOBALS task is processed in the priority range higher than the IDLE task and lower than the other ESM tasks.
From firmware version 2021.0 LTS : The GLOBALS task is processed in the priority range lower than any other ESM task.
Other firmware tasks (e.g., OPC UA®, web server, communication with PLCnext Engineer) are processed with a priority lower than that of the IDLE task.

Hello jlsalvat,
please find the answers below:
Questions i needed to answer :
1. Are the timing in accessing IO Axioline are different using GDS (use of in and out) or Resource global data (global and external in POU) ? response seems to be not (tests give the same result ).
All data will be procesed in GDS! The difference between the “global data” and “In/Out”-Port variable are:
Port-based communication (seeGDS Global Data Space):
Tasks that receive input data read this data from the GDS via IN ports. Using the ports ensures data consistency and correctly functioning of the inter-task communication relationships at all times.
The IN and OUT ports are coupled via buffer mechanisms and synchronized during execution.
Start of a task cycle (OnTaskExecuting
* ):
* The IN ports are read from the GDS buffers by the program instances to be called in the task.
* End of a task cycle (OnTaskExecuted):
* The OUT ports are written to the GDS buffers by the program instances to be called in the task.
* Resource-global variables as input (seeGDS Global Data Space):
According to IEC 61131-3, resource-global variables can be used as an input in all Program Organization Units (POU) of the current resource. Several ESM tasks can access the fieldbus I/O data declared as resource-global variables. The update rate of the resource-global variables always depends on only one task.
Resource-global variables as output (seeGDS Global Data Space):
Usually, resource-global variables are only used once as an output to avoid unintentional overwriting of values.
Note: If you use resource-global variables several times as an output, the last value overwrites the previous values.
With other words, it should be ensured that the global variable will be set/assigned/initialised in only once program instance in your application (to avoid the programmer-fails in application).
2. in the middleware Phoeninx contact, the way GDS and ressources globals are update seem differents, I’ve read different rules, what is really done ?
The process data and all variable-types (system, local, global, input/output ports, etc.) are handeled in the GDS. Of course the data processing is diffrent and depends on variable type see detailed documentation with examples in aticle GDS Global Data Space .
* 3. If I have 2 tasks, GDS is better if we exchange the same data as explained in https://www.plcnext.help/te/PLCnext_Runtime/GDS_Global_Data_Space.htm . But we could try to use FBD as other we can do in M340 and not having problems of globals.
You can implement your application in IEC61131 or/and in MatLab Simulink or/and in High languages. For data exchange between diffrent IDE’s/Datatypes the In/-Outport-Variables must be used. This is the importand feature to be able to exchange the data between compatible datatypes (defined in diffrent IDE’s).
* I also would like to recommend to use the In/Out-Port-Variables for connection/data exchange with I/O data. It is very comfortable function. By default the I/O update rate will be calculated by the PLCnext Runtime.
* The 4-fold Buffer ensures the data consistency during the application execution.
* 4. GDS is only needed if we want to play with IOT (mqtt, rest) or use C++ program . So we don’t need in and out GDS technique in a PLC program, Im right ?
No, the GDS is needed for all-datapoints (see Point 1)!

If you need help regarding your Application/Measurement, please contact the PhoenixContact Support department in your country and describe/discuss your Test Scenario and Results with my collegues.
BR Eduard

Thanks Eduard