This document is a general-purpose knowledge note for AI agents working with the Autonomy-Logic OpenPLC Editor / Runtime ecosystem.
It is intentionally not tied to any one project. The goal is to help future agents reason about .ld files, avoid common false assumptions, and know what to verify before editing ladder programs.
For Autonomy-Logic OpenPLC Editor, a .ld file is not reliably the same thing as the older LDmicro-style plain-text .ld files that dominate many web search results.
In practice, Autonomy-Logic ladder POUs are represented as a hybrid artifact with:
- an IEC wrapper such as
PROGRAM ... VAR ... END_VAR ... END_PROGRAM, and - an embedded ladder JSON structure that stores the editor graph for rungs, nodes, and edges.
This conclusion is grounded more strongly by:
- the current editor source code,
- observed Autonomy-Logic project files,
- and the editor's ladder-to-XML generator,
than by generic web search results.
When searching the web for openplc .ld, many results describe:
- LDmicro text syntax,
- older
thiagoralves/OpenPLCtooling, - or generic ladder concepts without the Autonomy-Logic serialization format.
Those results are useful for:
- IEC 61131-3 timer semantics,
- ladder logic concepts,
- contact/coil behavior,
- standard function blocks like
TON,TOF,TP.
They are not reliable as a source of truth for the exact on-disk .ld serialization used by Autonomy-Logic OpenPLC Editor.
If the task is about file structure, serialization, editing .ld by hand, or how the editor stores ladder diagrams, prefer:
- Autonomy-Logic editor source code,
- official Autonomy docs,
- a real
.ldfile from an Autonomy-Logic project, - and only then general web results.
Think of an Autonomy-Logic ladder .ld file as having two layers:
This layer declares the program and variables, for example:
PROGRAM main
VAR
SOME_INPUT : BOOL;
SOME_TIMER : TON;
SOME_OUTPUT : BOOL AT %QX0.0;
END_VAR
This is where you define:
- state bits,
- timer instances,
- counters,
- internal memory bits,
- addressed inputs/outputs,
- and function block instances.
Between END_VAR and END_PROGRAM, the editor stores a JSON object representing the ladder diagram graph.
At a high level, it looks like:
{
"name": "main",
"rungs": [
{
"id": "...",
"comment": "...",
"defaultBounds": [number, number],
"reactFlowViewport": [number, number],
"nodes": [...],
"edges": [...]
}
]
}The editor treats the ladder diagram as a graph of nodes and edges, then later converts that graph to PLCopen-style XML / runtime-oriented output.
From the current Autonomy-Logic editor source:
Each rung has these stable high-level fields:
idcommentdefaultBoundsreactFlowViewportnodesedges
Saved nodes minimally include:
idtypepositionheight(optional in schema)width(optional in schema)measured(optional in schema)draggableselectabledata
Saved edges minimally include:
idsourcesourceHandletargettargetHandletype(optional)
The editor source explicitly enumerates these ladder node types:
blockcontactcoilparallelpowerRailvariable
Represents the left or right power rail of a rung.
Typical characteristics:
- left/right variant
- a connector handle
- non-draggable / non-deletable behavior in editor flows
Represents ladder contacts.
Typical variants include:
defaultnegatedrisingEdgefallingEdge
Contacts usually bind to a boolean variable name in data.variable.
Represents ladder coils.
Typical variants include:
defaultnegatedrisingEdgefallingEdgesetreset
Coils also usually bind to a boolean variable name in data.variable.
Represents a function or function block.
This is how timer blocks such as TON, TOF, and TP are commonly represented.
Important concepts:
data.variant.nameidentifies the block type, e.g.TONdata.variant.typedistinguishes function vs function-block style usagedata.variable.namecan hold the instance name for function blocks- input/output handles define formal parameters such as
IN,PT,Q,ET
Used to connect literal values or variables to block pins.
For example, a timer preset is commonly modeled as a separate variable node bound to a block handle such as PT.
Typical variants include:
inputoutput
Represents ladder branching / merging.
This is the least safe node type to hand-edit without an existing example, because it relies on extra connector relationships and matching open/close behavior.
If you must edit an Autonomy-Logic .ld file manually:
- VAR declarations in the IEC section
- references inside ladder JSON nodes
- debug variable metadata if the project/runtime uses it
Do not aggressively normalize or simplify node objects.
Even if the schema is loose at the top level, real files often contain:
- handles,
- numeric IDs,
- connector metadata,
- variant objects,
- connected variable metadata,
- geometry fields,
- and other editor-generated details.
If a file already has a pattern, copy that pattern instead of inventing a smaller one.
Before adding a timer block, parallel branch, or complex rung, inspect an existing Autonomy-Logic .ld file that already contains the same construct.
Branching logic is much easier to break than simple serial contacts/coils. When possible, modify an existing parallel pattern instead of creating one from scratch.
For IEC 61131-3 semantics, it is generally safe to assume:
TON= on-delay timerTOF= off-delay timerTP= pulse timer
And for time literals:
T#3sT#200msT#1m10s
are valid IEC-style duration literals.
Autonomy-Logic projects commonly represent timer function blocks as:
- a
blocknode for the timer instance, and - a separate
variablenode feeding thePTinput.
That means if you add a timer, you usually need both:
- a timer instance in the IEC
VARsection, and - graph nodes/edges for the timer block plus its preset connection.
TONneedsINto remain true untilPTelapses.TPemits a pulse for a fixed duration after a triggering edge.- Effective timing still depends on PLC scan behavior, so exact behavior is bounded by runtime scan resolution.
Autonomy-Logic documentation describes OpenPLC projects as PLCopen-oriented at the project level.
The ladder editor source also contains a ladder-to-XML conversion path that maps:
- power rails,
- contacts,
- coils,
- blocks,
- variables,
from the editor graph into ladder XML structures.
This implies an important architectural point:
The editor's
.ldstorage format and the PLCopen/runtime-facing XML representation are related, but they are not the same thing.
So if you are editing the source .ld file, you are editing the editor graph representation, not the final compiled/runtime representation directly.
After any manual .ld change, validate in this order:
-
IEC section sanity
- Program wrapper still exists
VAR ... END_VARis syntactically intact- all new variables are declared
-
Embedded JSON sanity
- find the first
{belonging to the ladder object - parse JSON successfully
- confirm
nameexists - confirm
rungsis an array
- find the first
-
Graph integrity
- each edge references existing node IDs
- handles named in edges exist on the corresponding nodes
- timer blocks that need
PThave a valid preset connection
-
Semantic consistency
- every referenced variable exists in the IEC declarations, unless it is an intentional literal such as
T#3s - addressed outputs still use valid IEC syntax such as
%QX0.0
- every referenced variable exists in the IEC declarations, unless it is an intentional literal such as
-
Project metadata consistency
- if the project stores debug-variable lists, update them too
- if the project references a POU by name, confirm the name still matches
-
Editor/runtime sanity
- reopen the project in the editor if possible
- verify the rung still renders
- compile or export if tooling is available
This is the biggest failure mode. Many search results describe the wrong format.
If you add a new timer or state bit in VAR but do not update the ladder JSON, the editor graph and declarations will drift apart.
If a rung references a new variable name that is not declared in VAR, the project becomes inconsistent.
The top-level schema is permissive, but the editor often depends on richer node metadata than a minimal JSON object suggests.
Branching is harder than serial logic because it depends on special connector relationships and path reconstruction.
The file stores the editor graph. Final execution depends on how the editor exports/compiles that graph into PLCopen/runtime code.
When asked to modify an Autonomy-Logic .ld file:
- Read the target
.ldfile completely. - Read the surrounding project metadata/configuration files.
- Search for existing examples of the same construct in the same codebase.
- If unsure about serialization details, inspect the current Autonomy-Logic editor source.
- Make the smallest possible edit that preserves the surrounding format.
- Parse the embedded JSON and confirm it is still valid.
- Re-check IEC declarations and project metadata.
- If possible, reopen in editor / compile / export.
.ldin Autonomy-Logic should be treated differently from legacy LDmicro.ld- ladder storage contains a JSON graph with
rungs,nodes, andedges - known node types include
block,contact,coil,parallel,powerRail,variable - timer semantics like
TON,TOF,TPand literals likeT#3sfollow IEC conventions
- many editor-generated node details can be safely copied from existing examples
- timer presets are commonly represented via separate
variablenodes connected toPT
- exact required
datapayload for complex nodes in all editor versions - the safest way to author
parallelnodes from scratch - any assumption about runtime/export behavior not backed by current source or by a real local example
When building or extending this knowledge, use this order:
- Autonomy-Logic editor source code
- official Autonomy documentation
- real Autonomy project files
- IEC 61131-3 references for semantics
- Perplexity/web search only as a discovery aid
Perplexity is still useful, but mainly for:
- finding official pages,
- recalling IEC timer behavior,
- and spotting terminology.
It should not be trusted by itself for exact .ld serialization details.
Primary grounding:
- Autonomy-Logic OpenPLC Editor source
src/renderer/store/slices/ladder/types.tssrc/renderer/store/slices/react-flow/types.tssrc/utils/PLC/xml-generator/codesys/language/ladder-xml.ts
- Official overview
https://old.autonomylogic.com/docs/3-1-openplc-editor-overview/
Secondary supporting references:
- Perplexity-assisted discovery for IEC timer semantics and public OpenPLC context
- IEC-style timer references such as Fernhill-style documentation for
TON,TOF,TP, andTIMEliterals
This file is intentionally plain knowledge, not an executable skill.
To promote it into a reusable skill, convert it into:
- a
SKILL.mdwith explicit triggers, - a decision tree for when to inspect source vs local files,
- and a required validation procedure after edits.
Good trigger phrases would include:
edit openplc ldfix ladder jsonautonomy logic .ldmanual ladder file editopenplc timer rung