PLC Integer Output Signal - Represents a 32-bit integer output signal from simulation to PLC. More...

Public Member Functions | |
override void | SetStatusConnected (bool status) |
Virtual for setting the Status to connected. | |
override bool | GetStatusConnected () |
Virtual for getting the connected Status. | |
override void | SetValue (string value) |
Virtual for setting the value. | |
void | SetValue (int value) |
Sets the value as an int. | |
override void | SetValue (object value) |
Sets the value as an int. | |
override void | SetValue (byte[] value) |
override object | GetValue () |
Gets the value of the signal. | |
override byte[] | GetByteValue () |
override int | GetByteSize () |
override string | GetVisuText () |
Virtual for getting the text for the Hierarchy View. | |
void | Update () |
![]() | |
delegate void | OnSignalChangedDelegate (Signal obj) |
void | OnInspectValueChanged () |
bool | OnObjectDrop (Object reference) |
void | OnInspectedToggleChanged (bool arg0) |
string | GetSignalName () |
virtual bool | IsInput () |
Virtual for getting information if the signal is an Input. | |
virtual void | OnToggleHierarchy () |
Virtual for toogle in hierarhy view. | |
void | Unforce () |
Unforces the signal. | |
void | DeleteSignalConnectionInfos () |
void | AddSignalConnectionInfo (GameObject behavior, string connectionname) |
bool | IsConnectedToBehavior () |
Returns true if InterfaceSignal is connected to any Behavior Script. | |
string | GetTypeString () |
Returns the type of the Signal as a String. | |
InterfaceSignal | GetInterfaceSignal () |
Returns an InterfaceSignal Object based on the Signal Component. | |
![]() | |
void | PreStartSim () |
Is called by the realvirtualController before the component is started. | |
void | StartSim () |
Is called by the realvirtualController to start or stop the component. | |
void | StopSim () |
Vector3 | DirectionToVector (DIRECTION direction) |
Transfers the direction enumeration to a vector. | |
DIRECTION | VectorToDirection (bool torotatoin, Vector3 vector) |
Transfers a vector to the direction enumeration. | |
float | GetLocalScale (Transform thetransform, DIRECTION direction) |
List< BehaviorInterfaceConnection > | UpdateConnectionInfo () |
List< Signal > | GetConnectedSignals () |
void | SetVisibility (bool visibility) |
Sets the visibility of this object including all subobjects. | |
List< BehaviorInterfaceConnection > | GetConnections () |
List< Signal > | GetSignals () |
GameObject | GetChildByName (string name) |
Gets a child by name. | |
List< GameObject > | GetChildsByName (string name) |
Gets all child by name. | |
GameObject | GetChildByNameAlsoHidden (string name) |
List< GameObject > | GetAllMeshesWithGroup (string group) |
List< GameObject > | GetAllWithGroup (string group) |
List< GameObject > | GetAllWithGroups (List< string > groups) |
List< GameObject > | GetAllMeshesWithGroups (List< string > groups) |
List< string > | GetMyGroups () |
List< GameObject > | GetMeshesWithSameGroups () |
List< GameObject > | GetAllWithSameGroups () |
MeshRenderer | GetMeshRenderer () |
Gets the mesh renderers in the childrens. | |
void | SetCollider (bool enabled) |
sets the collider in all child objects | |
void | ErrorMessage (string message) |
Displays an error message. | |
void | ChangeConnectionMode (bool isconnected) |
void | Log (string message) |
Logs a message. | |
void | Log (string message, object obj) |
Logs a message with a relation to an object. | |
void | Warning (string message, object obj) |
Logs a warinng with a relation to an object. | |
void | Error (string message, object obj) |
Logs an error with a relation to an object. | |
void | Error (string message) |
Logs an error. | |
GameObject | DebugPosition (string debugname, Vector3 position, Quaternion quaternation, float scale) |
Displays a gizmo for debugging positions. | |
void | SetFreezePosition (bool enabled) |
Freezes all child components to the current poosition. | |
void | SetRbConstraints (RigidbodyConstraints constraints) |
virtual void | AwakeAlsoDeactivated () |
Public Attributes | |
StatusInt | Status |
![]() | |
string | Comment |
string | OriginDataType |
SettingsSignal | Settings |
SignalEvent | EventSignalChanged |
bool | Autoconnected |
bool | UpdateEnable |
List< Connection > | ConnectionInfo |
InterfaceSignal | interfacesignal |
![]() | |
string | Name |
The name of the component if it should be different from the GameObject name. | |
ActiveOnly | Active |
GameObject | FromTemplate |
realvirtualController | realvirtualController |
bool | HideNonG44Components |
bool | SceneIsAdditive |
bool | ForceStop |
Properties | |
int | Value [get, set] |
Additional Inherited Members | |
![]() | |
enum | ActiveOnly { Always , Connected , Disconnected , Never , DontChange } |
![]() | |
static bool | DirectionIsLinear (DIRECTION direction) |
Gets back if the direction is linear or a rotation. | |
![]() | |
void | SignalChangedEvent (Signal signal) |
new bool | hidename () |
![]() | |
bool | hidename () |
bool | hideactiveonly () |
virtual void | OnStopSim () |
virtual void | OnPreStartSim () |
virtual void | OnStartSim () |
MU | GetTopOfMu (GameObject obj) |
Gets the top of an MU component (the first MU script going up in the hierarchy) | |
void | InitGame4Automation () |
Initialiates the components and gets the reference to the realvirtualController in the scene. | |
virtual void | AfterAwake () |
void | Awake () |
![]() | |
string | Visutext |
![]() | |
OnSignalChangedDelegate | SignalChanged |
Detailed Description
PLC Integer Output Signal - Represents a 32-bit integer output signal from simulation to PLC.
PLCOutputInt is an essential signal type for sending integer data from the Unity simulation environment to external PLC systems. This component transmits 32-bit signed integer values, providing discrete feedback, counts, state information, and calculated integer results to PLC programs.
Key Features:
- Sends 32-bit signed integer values to connected PLC systems
- Provides automatic change detection and event notification
- Supports discrete state and counter value transmission
- Includes override functionality for testing and manual control
- Maintains connection status for communication monitoring
- Robust type conversion with error handling
Signal Direction: Simulation → PLC (Output from PLC perspective) The signal flows from Unity simulation to PLC controllers, enabling the simulation to provide integer feedback such as counts, states, positions, and diagnostic codes to PLC control programs.
Common Applications:
- Sending simulated encoder positions and pulse counts
- Providing part counting and production statistics
- Transmitting state machine status codes
- Reporting error codes and diagnostic information
- Sending calculated integer results (total counts, averages)
- Providing array indices and selection values
- Transmitting quality codes and inspection results
Interface Integration: PLCOutputInt supports all major industrial communication protocols:
- OPC UA: Writes to OPC UA Int32 nodes with proper typing
- S7 TCP/IP: Direct writing to Siemens S7 DINT data blocks
- Modbus TCP/RTU: Updates holding registers (2 registers for 32-bit)
- TwinCAT ADS: Writes to Beckhoff DINT variables
- MQTT: Publishes integer values in JSON format
- Shared Memory: High-speed integer array updates
Data Integrity and Conversion: The component ensures reliable data transmission:
- Safe conversion from various numeric types (float, double, long)
- Overflow protection with Convert.ToInt32()
- Null value handling to prevent exceptions
- Byte array conversion for binary protocols
- String formatting for text-based communication
Update Mechanism: Value changes are monitored in Update() for responsive updates. When the value changes, EventSignalChanged is invoked to notify all connected interfaces. This ensures that PLC programs receive timely updates for counter values, state changes, and other discrete information critical for sequence control and decision making.
Virtual Commissioning: In virtual commissioning scenarios, PLCOutputInt signals simulate discrete sensors, encoders, and counting devices. This allows complete testing of PLC counting logic, state machines, and discrete control algorithms without physical hardware. The override feature enables manual value injection for comprehensive test coverage.
Performance Considerations: Integer signals are highly efficient for discrete value transmission, using only 4 bytes per value. They are ideal for high-frequency updates like encoder feedback and counter values, providing optimal network bandwidth usage compared to float types.
Member Function Documentation
◆ GetByteSize()
|
virtual |
Reimplemented from realvirtual.Signal.
◆ GetByteValue()
|
virtual |
Reimplemented from realvirtual.Signal.
◆ GetStatusConnected()
|
virtual |
Virtual for getting the connected Status.
Reimplemented from realvirtual.Signal.
◆ GetValue()
|
virtual |
Gets the value of the signal.
Reimplemented from realvirtual.Signal.
◆ GetVisuText()
|
virtual |
Virtual for getting the text for the Hierarchy View.
Reimplemented from realvirtual.Signal.
◆ SetStatusConnected()
|
virtual |
Virtual for setting the Status to connected.
Reimplemented from realvirtual.Signal.
◆ SetValue() [1/4]
|
virtual |
Reimplemented from realvirtual.Signal.
◆ SetValue() [2/4]
void realvirtual.PLCOutputInt.SetValue | ( | int | value | ) |
Sets the value as an int.
◆ SetValue() [3/4]
|
virtual |
Sets the value as an int.
Reimplemented from realvirtual.Signal.
◆ SetValue() [4/4]
|
virtual |
Virtual for setting the value.
Reimplemented from realvirtual.Signal.