Clone
1
plc_modules
ispyisail edited this page 2026-09-17 11:33:19 +12:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PLC modules: I/O tables and linking a wire to a specific point

A PLC module (an I/O card, a controller) is drawn as one master element that lists every I/O point it has, and each wire leaving it is a separate slave element that gets linked to exactly one of those points — so the drawing always shows which physical terminal a given wire actually attaches to, with its address, function text and comment carried along automatically.

This is a specific case of QET's general master/slave mechanism — the Linking elements page (§2, §5) documents the .elmt data format this is built on. This page is the workflow: how to author a PLC master's I/O table, how to link a slave to a specific entry, and what the linking widget actually shows you.

Source: sources/ui/plclinkwidget.{cpp,h} (linking UI), sources/editor/ui/elementpropertieseditorwidget.cpp (I/O table editor), sources/editor/graphicspart/partplctable.{cpp,h} (symbol placeholder), sources/properties/elementdata.h (the PlcIO data itself).


1. Authoring a PLC master

In the Element Editor, under File → Element properties, set the element's type to Maître and its master type to Module PLC. This does two things the ordinary master editor doesn't:

  • Hides the max slaves and contact groups controls entirely — a PLC master doesn't cap how many slaves may attach to it as a whole (see §5 for what actually limits it).
  • Replaces them with a Configuration PLC group: an I/O table you build row by row with +/- buttons.

Each row is one I/O point:

Column Holds
Type one of six values — see below
Adresse e.g. 1.0, 1.1
Fonction free text, e.g. Motor K1
Commentaire free text
Réf. croisée auto-filled once a slave links here — leave it blank

A second table alongside it sets how many terminals that row has (14) and their labels; leaving labels blank falls back to T1, T2, … automatically.

The six I/O types are digital/analogue/universal, each input or output: Entrée digitale, Sortie digitale, Entrée analogique, Sortie analogique, Entrée universelle, Sortie universelle.

On the symbol's own drawing, add a table PLC part (from the drawing tools, alongside line/rectangle/terminal) and position it where the live table should render. It's a placeholder only — you're marking where the table goes and sizing space for it, not drawing the table's contents; the actual rows come from the I/O table above, filled in at runtime from every slave that ends up linked to this master.


2. Authoring a PLC slave

A slave that represents one wire from one PLC I/O point needs link_type set to Esclave, and in the state list — not the type list — pick Esclave PLC. This is the one entry in that list that isn't really a state: choosing it sets type = plc and state = Other behind the scenes, and disables the ordinary type list, exactly as documented in Linking elements §3.


3. Linking a slave to a specific I/O entry

Both elements need to already be placed somewhere in the project — the master on any folio, the slave wherever its wire actually is. Then:

  1. Select the slave on its diagram and open its properties. Because its type is PLC, the properties panel shows an Automate (PLC) tab instead of the ordinary single-link widget.
  2. That tab lists every PLC master in the project as an expandable tree — Master label (folio N), each expanding to its I/O rows with columns for Label/Type/Adresse/Fonction/Commentaire/Bornes.
  3. Already-linked rows are struck through and greyed out, with a tooltip naming which slave holds them — they can't be selected.
  4. Right-click a free row → Connecter. The link is made immediately and is undoable like any other edit.

Once linked, the tab changes shape: the tree disappears, replaced by Cet élément est déjà lié, a Délier button, and Voir cet élément (jumps to and highlights the master on its folio). Unlink first if you need to attach the slave somewhere else — there's no direct re-link.

Finding the right row in a large project

  • The search field filters live, across every master's rows at once — by label, type, address, function or comment text, whichever column matches.
  • "Masquer les éléments connectés" hides every already-linked row (and collapses a master entirely if all of its rows are taken). This is a per-user preference, remembered between sessions — check it once and it stays checked.

4. What updates automatically, and what doesn't

  • The cross-reference column fills in once you link — don't type anything into it yourself while authoring the master; it's overwritten by whichever slave ends up attached.
  • Terminal labels come from the I/O row's own terminal-count/labels table, not from the slave.
  • The master's drawn table repaints live when a linked slave movesMasterElement::connectSlavePositionUpdates() wires slave position changes straight to the master's repaint, so nothing needs a manual refresh after moving a wire.

5. A PLC master's own "full" behaviour is not what you'd expect

An ordinary master (coil, protection, commutator) with max_slaves set disappears entirely from linking UIs once it hits that count — the "masqués" note in this widget exists for exactly that case. A PLC master never does this, checked directly: max_slaves is forced to -1 for a PLC master (§1), and MasterElement::isFull() has no PLC-specific branch — it only ever checks max_slaves or contact-group count, neither of which a PLC master has.

So a PLC master whose I/O table is completely linked stays visible in the tree — every one of its rows will simply show struck-through, with the master item itself collapsing out of view only if the hide linked checkbox is on and hides every child. It is not reported as full, because per-row capacity (one slave per I/O entry) and whole-master capacity (max_slaves) are two different, independently-tracked limits, and only the second one is what "full" means anywhere else in QET.


6. What this shares with, and doesn't share with, ordinary master/slave

Same rules as any master/slave pair: a link needs matching types (a PLC slave can only take a PLC master's I/O entry, never an ordinary master's slot, and vice versa) and a free target. Everything else is different in shape:

Ordinary master/slave PLC master/slave
What a master offers up to max_slaves slots, or explicit contact groups one row per I/O point, no overall cap
What "full" means slot/group count reached never, at the master level — only per-row
What the link carries which contact this slave represents which I/O point, with address/function/comment
Where you pick the target inline on the diagram (single-link widget) a searchable, filterable tree of every master in the project

See also: Linking elements · Elements XML