Signal Connector
A SignalConnector passes the value of one signal on to another signal and converts it on the way. The typical case is two controllers in one model: the robot controller reports RobotReady, and the cell PLC expects that information on its own input Rob_Ready. The connector copies it across, and it can also turn an INT into a BOOL, pick a single bit out of a status word, build a word from single bits, or scale a value.
The connector runs in the model. It works in the browser simulation with the virtual PLC, and it works when the signals come from real controllers through realvirtual CONNECT. Which controller is behind each signal is configured in CONNECT, not in the connector.
How it works
Section titled “How it works”- One connector has one source and one target. To couple in both directions, use two connectors.
- The source is a PLC output: a value the controller writes, such as a robot output. The target is a PLC input: a value the model writes, which the other controller reads.
- The connector writes whenever the source changes, and only when the converted value differs from what the target already holds.
- If an external binding currently controls the target, the connector writes nothing. When the binding releases the target, the connector writes the current converted value at once.
- After a simulation reset the connector writes its current value again.
You can put a connector on any node. It does not have to sit on one of the two signals.
The Mode decides the conversion and which two signal slots are used. Every mode uses exactly one source slot and one target slot.
| Mode | Source → target | What it does |
|---|---|---|
| Copy | BOOL → BOOL, INT → INT, REAL → REAL, INT → REAL | Passes the value on unchanged. With Invert, a BOOL is negated. |
| IntToBool | INT → BOOL | True when the INT is not 0, equals Compare Value, or is at least Compare Value (see Condition). |
| BoolToInt | BOOL → INT | Writes True Value for true and False Value for false. |
| BitFromWord | INT → BOOL | Reads one bit (Bit) of the INT. |
| BitToWord | BOOL → INT | Sets one bit (Bit) of the target word. Several connectors with different bits build the word together. |
| Scale | INT or REAL → INT or REAL | Writes source × Factor + Offset. |
One connector handles one bit. To read eight bits of a status byte, use eight connectors with the same source and different Bit values. To build a word from eight BOOLs, use eight BitToWord connectors with the same target.
Properties
Section titled “Properties”| Property | What it does |
|---|---|
| Mode | The conversion, see above. Default is Copy. |
| Enabled | When off, the connector writes nothing and is not checked. Default is on. |
| Source Bool, Source Int, Source Float | The source signal. Only the slot that fits the mode is used: Source Bool for Copy (BOOL), BoolToInt and BitToWord; Source Int for Copy (INT and INT → REAL), IntToBool, BitFromWord and Scale; Source Float for Copy (REAL) and Scale. |
| Target Bool, Target Int, Target Float | The target signal, a PLC input. Target Bool for Copy (BOOL), IntToBool and BitFromWord; Target Int for Copy (INT), BoolToInt, BitToWord and Scale; Target Float for Copy (INT → REAL and REAL) and Scale. |
| Condition | IntToBool only. NotZero (default): true for every value other than 0, negative values included. Equals: true when the value equals Compare Value. GreaterOrEqual: true when the value is at least Compare Value. |
| Compare Value | IntToBool only. The value Equals and GreaterOrEqual compare with. Default is 0. |
| True Value, False Value | BoolToInt only. The INT written for true and for false. Defaults are 1 and 0. |
| Bit | BitFromWord and BitToWord. The bit number, 0 is the least significant bit. Must be smaller than the width: 0–7 for Byte, 0–15 for Word, 0–31 for DWord. Default is 0. |
| Width | The size of the INT: Byte (8 bit), Word (16 bit, default) or DWord (32 bit). It sets the range of Bit, how Scale reads an INT source, and the range an INT target is limited to. |
| Signed | Whether the INT is read and written as signed at Width. A Byte is −128 to 127 when signed and 0 to 255 when not. Default is on. |
| Factor, Offset | Scale only. The result is source × Factor + Offset. Defaults are 1 and 0. Both have no unit. |
| Rounding | Scale with an INT target. Round (default) rounds halves away from zero, so 2.5 becomes 3 and −2.5 becomes −3. Truncate cuts towards zero, so 2.9 becomes 2 and −2.9 becomes −2. |
| Invert | Negates the BOOL result of Copy (BOOL), IntToBool and BitFromWord, and the bit a BitToWord connector contributes. Default is off. |
When you change the Mode in the editor, the slots the new mode does not use are cleared in the same step, and one undo brings back both the mode and the slots. If a file from elsewhere sets a slot that the mode does not use, the connector still works on the slots of its mode. The Problems panel lists the unused slot as a warning.
Set up a connector in the editor
Section titled “Set up a connector in the editor”- Open the model in the editor and select the node that should carry the connector, for example an empty node next to the signals.
- Add the component SignalConnector.
- Choose the Mode. The inspector then shows only the settings and the two signal slots this mode uses.
- Link the source and the target slot to their signals, the same way as any other signal slot.
- Set the remaining options, such as Bit and Width, and save the model.
Below the settings, the inspector shows a live preview while the model runs: the current source value (an INT also as bits, grouped by four and cut to Width) and the result the connector writes. If the connector does not write, the preview says so; the reason is in the Problems panel.
Create bit connectors
Section titled “Create bit connectors”A status word with 16 bits needs 16 connectors. Instead of adding them one by one, set up one connector in BitFromWord or BitToWord mode, link its INT slot to the word, and open Create bit connectors… in the inspector:
- Bits: the bit numbers, as a range or a list, for example
0-15or0,2,5. - Signals: the BOOL signals, one per bit in the order of Bits, separated by commas. For BitFromWord these are the targets, for BitToWord the sources. Leave the field empty to link them later.
Create adds one child node per bit, named Bit00, Bit01 and so on, each with its own connector. Width, Signed and Invert are taken from the connector you started from. All new connectors are created in one step, so one undo removes them all. If a child node for one of the bits already exists (for example Bit03), nothing is created and the inspector says which one.
Number rules
Section titled “Number rules”The same rules apply wherever the connector runs, so a model behaves the same in every runtime.
- INT values are 32-bit signed. A DWORD with bit 31 set is a negative number:
0x80000000is −2147483648 and0xFFFFFFFFis −1. BitFromWord with Bit 31 on −2147483648 gives true. - Width and Signed only change how a number is read or limited. With Byte and Signed on, the INT 255 is read as −1. With Signed off, it is read as 255.
- Scale into an INT target is limited to the range of Width and Signed. 300 into an unsigned Byte becomes 255, 40000 into a signed Word becomes 32767, and 2147483647.5 into a signed DWord becomes 2147483647.
- REAL targets are 32-bit floats. 16777217 is written as 16777216. A result that is not a finite number, such as NaN or a value beyond the float range like 10³⁹, is not written. The target keeps its last value and the Problems panel shows a warning, which disappears as soon as a valid value is written again.
- BitToWord builds the whole word. The target word holds exactly the bits of the BitToWord connectors that write it. Bits that no connector writes are 0. The connector never reads the target back. When you disable or remove a bit connector, its bit becomes 0. When the last one goes, the word is set to 0. If the connectors of one word have different settings, the widest Width applies, and the word is signed only when all of them are Signed.
- IntToBool with NotZero treats negative values as true. The older ConnectSignal component is different: it only turns positive values into true (see below).
Problems
Section titled “Problems”The connector checks itself and all other connectors when the model loads and after every change: slot, mode, Enabled, undo and redo. A connector with an error writes nothing until the error is fixed. The Problems panel lists these codes:
| Code | Severity | Meaning |
|---|---|---|
signal-connector-unresolved | Error | A slot the mode needs is empty, names something that is not a signal, names a signal that does not exist (for example after a rename), or names a signal of the wrong type, such as an INT signal in Target Bool. When the missing signal appears later, the connector picks it up on its own. |
signal-connector-slot-mismatch | Warning | A slot is set that the mode does not use. The connector still works. |
signal-connector-direction | Error | The target is a PLC output. A connector only writes PLC inputs. |
signal-connector-fan-in | Error | More than one writer on the same target, for example two connectors, a connector and a ConnectSignal, or — while realvirtual CONNECT is connected — a connector and a 1:1 signal mapping of CONNECT that writes the same signal. Several BitToWord connectors may share one word only if each uses a different bit and a different source. Placing the same asset twice also leads here when its connector targets one of the asset’s own PLC signals: PLC signals keep their names in every copy, so both copies write the same signal. |
signal-connector-cycle | Error | Connectors form a loop, for example A → B and B → A. |
signal-connector-width | Error | Bit does not fit the Width, for example bit 16 in a Word. |
signal-connector-nonfinite | Warning | The converted value is NaN or beyond the float range and was not written. |
Example: robot and PLC
Section titled “Example: robot and PLC”A robot controller and a cell PLC share a model. The robot reports its state with the BOOL output RobotReady and the INT status word RobotStatus. The PLC expects BOOL inputs.
| Connector | Mode | Source | Target | Settings |
|---|---|---|---|---|
| Ready | Copy | RobotReady (robot output) | Rob_Ready (PLC input) | — |
| In home position | BitFromWord | RobotStatus | Rob_Home | Bit 0, Width Word |
| Gripper closed | BitFromWord | RobotStatus | Rob_GripClosed | Bit 3, Width Word |
| Fault | IntToBool | RobotErrorCode | Rob_Fault | Condition NotZero |
In the other direction, the PLC releases the robot with BOOL outputs that the robot reads as one INT command word:
| Connector | Mode | Source | Target | Settings |
|---|---|---|---|---|
| Start | BitToWord | PLC_RobStart | RobotCommand | Bit 0 |
| Reset | BitToWord | PLC_RobReset | RobotCommand | Bit 1 |
With PLC_RobStart true and PLC_RobReset false, RobotCommand is 1.
Using the connector from an AI agent
Section titled “Using the connector from an AI agent”An agent connected through the realvirtual MCP server works with the same commands as the inspector:
editor.addComponentadds a connector,editor.setFieldlinks slots and sets options.signalConnector.setModechanges the Mode and clears the slots the new mode does not use, in one undo step.editor.setFieldon Mode does the same.signalConnector.createBitscreates the bit connectors, like Create bit connectors….signalConnector.list(throughweb_query) lists every connector with its mode, its two signals, their current values and its problem codes.
The two changing commands work in the editor and are recorded in macros with all values filled in, so a replay creates the same connectors no matter what is selected.
ConnectSignal
Section titled “ConnectSignal”The older ConnectSignal component sits on the target signal and copies one source onto it without options. It follows a fixed rule: an INT onto a BOOL is true when the INT is greater than 0 (a negative INT is false), a BOOL onto an INT is 1 or 0, and everything else is copied unchanged. Existing models keep working. For new couplings, use the SignalConnector.
See also
Section titled “See also”- Signals and Logic: signals, slots and bindings
- Virtual PLC: the PLC program in the browser