CODESYS 3.5 - PLC Programming With Structures - Lesson 10 - Visualisations & Structures

Опубликовано: 01 Апрель 2026
на канале: Liam Bee
133
0

🔹This course is from 2023 and is now free. You can still access it ad free at https://liambee.me
if you become a member or purchase the course.

🔹Downloadable content for this course is available here for free:
https://liambee.me/codesys-structured...

In this lesson we look at how to use structured data inside HMIs, SCADA systems and visualization environments, and how to build visual elements that accept structures directly. Although this example uses Codesys, the concepts apply across many platforms. WinCC, for example, now supports passing structures into faceplates, and the principles work in a very similar way.

We start by examining the custom Analog Gauge visualization. This gauge is not the default Codesys gauge but a user made visualization built to accept a DUT_Analog structure. When you drop it onto a visualization page, Codesys prompts you to assign a structure. It will only allow compatible structures, which ensures that the object always receives the correct type of data.

Inside the visualization we open the declaration area and define an INOUT parameter called analog_data, typed as DUT_Analog. Because visualizations in Codesys use references internally, only a pointer is passed to the structure, keeping things efficient. From there we configure the gauge by mapping its properties to elements inside the structure. The value is mapped to analog_data.scaled, and the scale limits are mapped to analog_data.scaling_data.raw_min, raw_max, scale_min and scale_max. The visualization then performs small calculations for the scale divisions.

The important point is that all the gauge needs is the structure. It does not need individual tags for raw value, max value, status and so on. As long as the structure contains those fields, the gauge can extract and use them. If the structure grows in the future, the visualization automatically gains access to those new elements without any interface changes.

We then test this with two different pressure instruments. Each pressure transmitter has its own global variable list containing its own typed and bespoke structures. Because each pressure instrument contains an Analog structure inside its DUT_Pressure, both are compatible with the gauge. Updating the scaling data in pressure2 immediately updates its visualization without affecting pressure1.

The lesson also shows that this approach scales easily. If you later create a Level structure that also contains a DUT_Analog, the same gauge can be reused for level transmitters with no extra work. As long as your equipment uses common structured types under the hood, your visual objects remain reusable and consistent.

By the end of the lesson you will understand how to build visualization objects that accept structured data, how to map structured elements to graphic properties and why this approach dramatically reduces engineering time, tagging effort and maintenance work in large SCADA or HMI projects.

#AlwaysLearning #Automation #Codesys #PLC #HMI