Topic: Prototype: simulating control circuits directly from .qet files

Hello everyone,

I'm Tony, an instructor of industrial mechatronics at SENAI (Brazil). My students learn contactor-based control circuits, and most of them use CADe_SIMU on Windows to simulate them. There is no free equivalent on Linux, so I started a small experiment: a simulator that reads QElectroTech .qet files directly.

What works today (command-line prototype, Python, no dependencies):
- reads elements, conductors and master/slave links from the .qet XML
- simulates push buttons, coils and NO/NC contacts (self-holding, interlocking, stop)
- push button type (NO/NC) is inferred from IEC terminal numbers (13-14 / 21-22)

Example: reversing starter with interlock, drawn in QET 0.100.0:

> S1 -> K1 = ON, K2 = off
> S2 -> K1 = ON, K2 = off (interlock blocks K2)
> S0 -> K1 = off, K2 = off
> S2 -> K1 = off, K2 = ON

Repository (GPL-3.0): https://github.com/tonymarim/qet-simulador
Two example .qet files are included.

Disclosure: the prototype was written with the help of an AI assistant (Claude). I reviewed it and tested it with my own circuits.

Some questions for the community:
1. Has anyone worked on simulation on top of .qet files before? I don't want to duplicate effort.
2. Is relying on master/slave links plus IEC terminal numbering a sound approach? Or is there a more reliable way to identify NO/NC push buttons in the element definitions?
3. Would there be interest in this eventually becoming a plugin, like qet_tb_generator?

Any feedback is welcome. And thank you for QElectroTech!

Tony

Re: Prototype: simulating control circuits directly from .qet files

Hi Tony, and welcome!

Nice work!

  1. As far as I know there's no circuit simulation in or around QET today, so this fills a real gap, especially for teaching.

  2. Master/slave links are the right foundation — that's exactly how QET models the relationship. For slave contacts, you can also read state (NO/NC/SW) and type (simple, power, delayOn, delayOff) from the element's kindInformations in the .qet/.elmt XML: more reliable than terminal numbers, and it gives you timers for free. For push buttons (simple elements without that info), IEC terminal numbering is a reasonable fallback, but not everyone numbers terminals, so maybe also check the element name/informations.

  3. Yes, an external plugin in the spirit of qet_tb_generator would be welcome — keeping it outside the core is the best approach.



Laurent

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !