Skip to content
GitHub

Import a CODESYS screen

Your operators already have a CODESYS screen. Export it from the IDE, import it into HotLoop, and it opens as a HotLoop screen on the same PLC’s variables. This is the way off WebVisu: the PLC keeps running its program, HotLoop reads it through the OPC UA connector, and the screen is HotLoop’s. HotLoop for CODESYS runs the Edge, so this is its import too.

In the CODESYS IDE, select the visualization in the project tree and use Project, Export (the CODESYS native export, a .export file). Not Export PLCopenXML: that file has no visualization in it, and HotLoop says so if you pick it.

On the Dashboards screen, Import, choose the .export file, Read the file. It tells you:

  • the visualization it found (a file with several asks you which),
  • every tag the screen reads that this install does not have. The variables arrive as plc/<GVL>.<variable>: map the device plc to the HotLoop device the PLC is on and every tag moves at once, or map the tags one by one,
  • worth a look: every element it could not put on the screen, with the reason, before anything is saved.

Nothing is saved until nothing is in the way. Importing needs dashboards.write, and a button or a setpoint on a tag that is not marked writable is refused here, the same as a build, so the screen never has a control the gate would turn down.

Through the API it is POST /api/dashboards/import with codesys (the text of the file) in place of file, and visualization to name one of several:

{"codesys": "<ExportFile>...", "visualization": "Overview", "dryRun": true,
"remap": {"devices": {"plc": "line-3"}}}

The report has the usual problems, warnings and remapped, and a conversion with mapped (each element and what it became) and unmapped (each element and why not).

CODESYS element In HotLoop
Rectangle, rounded rectangle, ellipse with text and a variable (Temperature: %2.1f C) a readout: the variable’s tag, the text before it as the caption, the text after it as the unit, the decimals from the format
The same with text and no variable a label
Lamp a lamp, lit by the variable, colored from the lamp’s own color (red is a fault, yellow a warning, blue information, anything else a run lamp). NOT x reads the tag the other way up
Meter, potentiometer a readout of the variable. A knob that set a value also gets a setpoint card with the dial’s scale as its limits
Rocker switch, toggle, push button a lamp showing the state, and a button card: on and off for a toggle, the one value for a tap
Polygon, polyline, and shapes with no text and no variable (the pipes, the vessel, the frames) the picture behind the symbols, drawn from their points and colors
Group its members, placed from the group’s corner

Every element keeps its pixel place: the page is the symbols card, drawn as one scaled picture, so the screen holds its shape at any size and on a phone.

Said in the import, one line each, never dropped quietly:

  • an element type with no HotLoop symbol (a trace, a table, a slider, an image element, and the rest of the toolbox),
  • a variable that is an expression (Temp * 2, a AND b, an array element): HotLoop shows a tag, so add a tag for the expression and point a readout at it,
  • a visibility, color or movement rule driven by a PLC value: the symbol is there all the time and does not change color,
  • a bezier curve is drawn as straight lines between its points, and a rotated element is not rotated,
  • the page size, which the export does not hold: the page is as big as the outermost element, plus a margin,
  • text longer than 40 characters is cut, and the dials are numbers, not dials.

The text styles, fonts and colors of the CODESYS style are HotLoop’s: the screen follows HotLoop’s theme.

CODESYS documents that the native export exists and is XML, and does not document what is in it. The reader here follows what the IDE itself writes (CODESYS 3.5 SP22, Visualization 4.10): every element stores its settings as a list of numbered members, and the number is the CRC-32 of the member’s path in the element’s description, such as m_StaticPosition.iX, which the IDE installs next to itself. The tests hold values read from the IDE’s own export. A setting that carries a variable and is not read is reported as above, so a screen is never imported as complete when it is not.

Open the screen, check the readouts against the plant, and put the setpoint and button cards where your operators expect them. A screen you built by hand and a screen you imported are the same thing from here: it exports as a screen file, versions with every save, and goes to another install the same way.