FeatureBuilt · in the lab
PLC programming
Controller programs in ladder, structured text and function block diagram on a simulated controller, an operator screen, motion blocks, PLCopen XML, a building automation planner, message definitions for edge data, a bench controller download, a control room, process control, plant network planning, drive sizing and G-code to a simulated machine.
Use this add-on:
Screenshots and a short video come with the listing (AL.3).
Overview
PLC programming lets you write controller programs in the three everyday languages of the controller standard, ladder, structured text and function block diagram, and run them at once on a simulated controller. You watch every variable change, force inputs, press buttons on an operator screen bound to your variables, and move simulated axes with motion blocks. Programs go out and come in as PLCopen XML.
It also plans a building automation system: group addresses, bus lines with their device counts, currents and cable lengths, and object lists, checked against limits that each say where they were read. And it defines the messages that carry your variables to an edge gateway. It is a design and learning aid: it does not load a real controller, and it is not an approval.
Who it’s for
- A controls engineer who wants to sketch and test logic before the hardware is on the bench.
- A student or apprentice learning ladder, structured text and function block diagram side by side.
- A machine builder who wants a first operator screen and motion sequence to show a customer.
- A building automation planner counting devices, currents and addresses before ordering.
What you can do
- Write a project of program units, each in ladder, structured text or function block diagram, and run them in tasks with their own intervals and priorities. PLC programming tab, Project. verified
- Type a ladder rung or a block diagram in a short notation and see it drawn at once; in CadCraft, draw it into the drawing. Program unit. {#plcprog-ladder} verified
- Run the project on a simulated controller, watch every variable and force any of them. Check and simulate. verified
- Build an operator screen of lamps, buttons, switches, values, number entries and bars bound to your variables. Operator screen. verified
- Move simulated axes with motion blocks: power, home, move absolute, move relative, move velocity, stop. Motion axes. verified
- Save and open PLCopen XML with all three languages. Files. verified
- Plan group addresses, bus lines and object lists and check them against cited limits. Building automation plan. verified
- Define topics and payloads for edge data, check them against the MQTT 3.1.1 topic rules, and preview the payloads with live values. Messages for edge data. verified
- Pack the project as PLCopen XML with a manifest and checksum, load it into a simulated bench controller (stop, load, check, start), change it while running, and compare it with the project. Download to a controller. verified
- Run a control room on the bench controller: tags, alarms with limits, delay, deadband and acknowledgement, trends, an overview screen and an alarm log. Control room. verified
- Place motor and valve objects made from one type each, run recipes and batches with limits and phases, and test a pair of controllers where the second takes over. Process control. verified
- Plan a plant network: the load on every link and the delay of every cyclic flow. Plant network. verified
- Size a drive for a move and pick from your own motor table. Drive sizing. verified
- Read G-code, estimate its time and stream it to a simulated machine controller. Machine control with G-code. verified
Methods and standards
All three languages run on one scan-cycle interpreter with a simulated clock, so every timer is exact and repeatable. Ladder is a power-flow graph: a contact passes power when it has power and its own condition holds, branches that meet are joined, and every block is called once per scan. A function block diagram is evaluated in data-flow order; a wire that closes a loop through a function block reads the value of the scan before. Tasks run on a common clock that ticks by the greatest common divisor of their intervals; tasks due together run in priority order.
Motion uses the trapezoid speed profile. For a move of length D with speed limit V, acceleration a and deceleration d, the time is V/a + V/d + (D - V²/2a - V²/2d)/V when the speed limit is reached, and otherwise the peak speed is the square root of 2·D·a·d/(a+d). Positions are worked out from the closed form at each sample, not added up step by step.
The building automation check counts and compares: devices per line segment, cable lengths, the sum of device currents against the power supply, and for a lighting line the voltage drop 2·L·I·ρ/A with copper at 1/58 ohm·mm²/m. Message topics are checked against the topic rules of MQTT 3.1.1.
The download package is the PLCopen XML plus a manifest with a CRC-32 (IEEE 802.3, check value CBF43926 for the nine digits) of each unit and of the file; the bench controller refuses a package whose checksum or manifest does not match, whose project does not compile, or, while running, whose change alters the type of a variable. Alarms raise after the value has stayed past a limit for the delay and clear when it is back by the deadband; a value that returns before anyone acknowledges it waits as returned. A trend cut to fewer points keeps the minimum and the maximum of every bucket, so a spike stays. A redundant standby copies every variable at the end of each cycle and takes over after the set number of missed beats, so the count loses at most that many cycles. A flow's load on a link is its frame bits (payload at least 46 bytes plus 38) per period over the link speed, and its delay is the frame time on every link plus 5 ns per metre plus the switch delay. A move's torque is (motor inertia + load inertia over the ratio squared) times the motor acceleration plus the reflected load torque, over a trapezoid of the stated shares; the best ratio for a pure inertia is the square root of the inertia quotient. An arc's length is its radius times its sweep; a move of length d at speed v with acceleration a takes d/v + v/a, or 2 sqrt(d/a) when it never reaches v.
Data and sources
The add-on ships a small table of bus limits, and each row says which standard it belongs to, where we read it and how far it was checked. The twisted pair line figures (devices per segment, segments, lines, areas, cable lengths) were read in a public application note that quotes them. The lighting line address counts and scenes were read on the lighting alliance's public page. The group address ranges, the lighting bus current, voltage drop and cable length, the number of lighting groups and the object instance range are commonly quoted figures that we could not read at their source: they are marked "not checked against the standard" in the panel. The message topic rules were read in the MQTT 3.1.1 standard itself. Device currents you do not type use starting figures that are not from any standard. No maker's device data is included.
Verification
| Case | Result |
|---|---|
| Function block diagram against the same logic in structured text | A diagram with a timer, a counter, arithmetic and a comparison gives the same value of every variable as the same logic written in structured text on each of 60 scans; a 50 ms on-delay on a 10 ms cycle switches 5 scans after its input (bin/test-plcprog.mjs) |
| Ladder: seal-in, timer and counter against a hand-worked sequence | A start and stop rung with a seal-in contact, a 30 ms timer and a counter reset by the timer follow the sequence worked by hand over 12 scans (bin/test-plcprog.mjs) |
| Tasks on a common clock | In 300 ms a 10 ms task runs 30 times and a 30 ms task 10 times; the higher-priority task runs first on a shared tick; global variables are shared (bin/test-plcprog.mjs) |
| Watch and force | A forced input address reaches the program and its output; a forced variable that the program writes is held, and its output address follows; removing the force gives it back (bin/test-plcprog.mjs) |
| PLCopen XML round trip | A project with one ladder, one function block diagram and one structured text unit and three tasks is written, read and written again to the same file, and the diagram read back behaves the same on 40 scans; a hand-written diagram file with elements in another order reads correctly (bin/test-plcprog |
| Motion blocks against the closed forms of the trapezoid | A move of 100 at speed 50 with ramps of 100 takes 2.5 s, is at 12.5 after 0.5 s and at 50 after 1.25 s; a short move peaks at the square root of distance times acceleration; unequal ramps match their closed forms; the speed curve integrates to the distance; the move absolute block reports Done at 2. |
| Operator screen on the sample project | Start latches the motor, six bottle pulses fill a case and stop it, and a typed lift target of 120 is reached in the closed-form 1.7 s (bin/test-plcprog.mjs) |
| Building automation checks on hand-worked cases | 65 devices on a segment break the limit of 64; 3 devices at 10 mA and one at 12 mA draw 42 mA; 200 mA over 300 m of 1.5 mm² copper drops 1.379 V; address 1/2/3 is the number 2563 in every style (bin/test-plcprog.mjs) |
| Message topic rules of MQTT 3.1.1 | Wildcards, an empty topic, a topic starting with $, a topic of 65536 bytes and a quality of service of 3 are refused with the rule named; 65535 bytes pass (bin/test-plcprog.mjs) |
| Download to the bench controller | The CRC-32 of the nine digits is CBF43926; a package passes its own check and a changed file fails the checksum; 100 cycles count to 100, a warm download keeps the count and a cold one resets it, a change while running keeps the count and runs the new body, and a type change is refused (bin/test-plc |
| Alarms, trends and screens | A value over its limit raises only after the delay, stays inside the deadband, needs an acknowledgement, and returns unacknowledged if it came back first; a spike shorter than the delay never alarms; a trend of 100 points cut to 10 buckets keeps the spike; the screen draws the bar half full at 50 an |
| Objects, recipes and the redundant pair | A motor with no feedback faults after 2 s; a recipe with a value over its limit is refused; a heating phase of a first-order lag ends at 220 ms; after the first of a pair fails the second takes over in 3 cycles and the count goes on from 50 (bin/test-plcprog2.mjs) |
| Network load and delay | A 100 byte flow every 1 ms loads a 100 Mb/s link 1.104 percent, takes 2 x 11.04 + 0.5 + 5 microseconds over two links and a switch, a hundred of them overload it, and a ring blocks one link (bin/test-plcprog2.mjs) |
| Drive sizing against closed forms | A turn in 1 s with a third of the time speeding up is 90 rpm, a load of 0.011 kg m2 needs 0.311 N m, the rms is that times the square root of two thirds, and the best ratio of a pure inertia is the square root of 10 for the stated inertias (bin/test-plcprog2.mjs) |
| G-code lengths and times | A clockwise quarter circle of radius 10 is 5 pi long, 10 mm at 600 mm/min with 100 mm/s2 takes 1.1 s, 0.5 mm takes 2 sqrt(0.5/100) s, and the simulated controller streams a program in exactly the estimated time with every line answered and at most 127 characters waiting (bin/test-plcprog2.mjs) |
Limits
It is a design aid, not an approval or a certificate, and it does not connect to or load a real controller: programs must be tested on the real machine, with its safety functions, before use. Ladder and block diagrams are typed in a short notation and drawn; they cannot be edited by dragging yet. Sequential function chart and instruction list are not supported; arrays, structures and pointers are not supported in structured text. The motion blocks are a subset, follow the published names as commonly documented and were not checked against the specification: the axis is a number, there is no jerk limit and no buffer mode. PLCopen XML is written from the published schema structure and was not validated against the schema file or opened in another vendor's tool. The building automation plan counts and compares; it does not commission devices, and several limits are marked as not checked against the standard. Messages are defined and previewed; nothing is sent to a broker. Download works only to the bench controller in the page; download to a real controller needs the maker's tool and a device and is not built. The control room's alarm states follow common practice in our own words (the standards were not read) and the screens are drawn in the page; the reference HTTP server for them has been tried only in a test, not in Studio. The redundant pair is a model in software. Network planning counts frames and ignores queues; its 5 microsecond switch delay is a setting. Drive sizing is textbook mechanics for a trapezoid move with your own motor table; confirm with the maker's tool. G-code goes to a simulated controller only; a real machine needs a device.
Files and formats
Reads and writes PLCopen XML (program units, variables, tasks; ladder, structured text and function block diagram bodies) and its own project file (JSON, with the axes, the operator screen, the building automation plan and the messages). Writes CSV files of the group addresses and the object list, and a JSON file of the message definitions. In CadCraft it writes lines, polylines and text on PLC- layers, which export to DXF and DWG.
Get started
- Switch the add-on on in Settings, Add-ons, then open the PLC programming tab. A sample project is loaded.
- Press Check, then Start, under Check and simulate.
- On the Operator screen press Start, flip the bottle switch a few times, and switch on Raise the lift.
- Open Building automation plan and press Check the plan; open Messages for edge data and press Check the messages.
Languages
The text is available in:
- English (en)
Works in
| Edition | Works | Note |
|---|---|---|
| Browser (/use) (yours) | Added on demand | Fetched the first time you use it, then kept for offline use. |
| Studio from getcadcraft.com | Added on demand | Fetched the first time you use it, then kept for offline use. |
| Microsoft Store | Added on demand | Fetched the first time you use it, then kept for offline use. |
| Google Play | Added on demand | Fetched the first time you use it, then kept for offline use. |
| iPad and iPhone (App Store) | Included; switch it on | Part of the reviewed app; your list switches it on. |
| Custom build | Added on demand | Fetched the first time you use it, then kept for offline use. |
Comes with
Nothing else.
Versions
| Version | Channel | Date | What changed |
|---|---|---|---|
| 1.0.0 | lab | November 25, 2026 | First version in the Library. |
Licence and maker
CadCraft (CadCraft, first-party). Licence: Apache-2.0. Dependencies carry their own licences, listed on their pages.