PLC Integer Input Signal - Represents a 32-bit integer input signal to PLC from simulation. 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 byte[] | GetByteValue () |
| override int | GetByteSize () |
| override string | GetVisuText () |
| Virtual for getting the text for the Hierarchy View. | |
| override bool | IsInput () |
| Virtual for getting information if the signal is an Input. | |
| override void | SetValue (string value) |
| Virtual for setting the value. | |
| override void | SetValue (byte[] value) |
| override void | SetValue (object value) |
| Sets the value of the signal. | |
| override object | GetValue () |
| Gets the value of the signal. | |
| void | SetValue (int value) |
| Sets the value as an int. | |
| void | FixedUpdate () |
Public Member Functions inherited from realvirtual.Signal | |
| delegate void | OnSignalChangedDelegate (Signal obj) |
| void | OnInspectValueChanged () |
| bool | OnObjectDrop (Object reference) |
| void | OnInspectedToggleChanged (bool arg0) |
| string | GetSignalName () |
| 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 | SetMetadata (string key, object value) |
| Set metadata value for this signal. | |
| T | GetMetadata< T > (string key, T defaultValue=default(T)) |
| Get metadata value with automatic type conversion. | |
| bool | HasMetadata (string key) |
| Check if metadata key exists for this signal. | |
| void | RemoveMetadata (string key) |
| Remove metadata key from this signal. | |
| IEnumerable< string > | GetMetadataKeys () |
| Get all metadata keys for this signal. | |
Public Member Functions inherited from realvirtual.realvirtualBehavior | |
| virtual void | OnOwnershipChanged (bool isOwner) |
| Called when network ownership changes. | |
| void | SetNetworkOwner (bool isOwner) |
| Sets IsNetworkOwner and triggers OnOwnershipChanged callback. | |
| 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, bool includeTriggers=true) |
| 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 warning 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 |
Public Attributes inherited from realvirtual.Signal | |
| string | Comment |
| string | OriginDataType |
| SettingsSignal | Settings |
| SignalEvent | EventSignalChanged |
| bool | Autoconnected |
| bool | UpdateEnable |
| List< Connection > | ConnectionInfo |
| InterfaceSignal | interfacesignal |
| SignalMetadata | Metadata |
| Metadata for PLC communication and interface configuration. | |
Public Attributes inherited from realvirtual.realvirtualBehavior | |
| 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 |
| bool | IsNetworkOwner |
| True when this component owns its simulation (local authority). Set to false by MultiplayerWEB on remote clients. | |
Properties | |
| int | Value [get, set] |
Additional Inherited Members | |
Public Types inherited from realvirtual.realvirtualBehavior | |
| enum | ActiveOnly { Always , Connected , Disconnected , Never , DontChange } |
Static Public Member Functions inherited from realvirtual.realvirtualBehavior | |
| static bool | DirectionIsLinear (DIRECTION direction) |
| Gets back if the direction is linear or a rotation. | |
Protected Member Functions inherited from realvirtual.Signal | |
| void | SignalChangedEvent (Signal signal) |
| new bool | hidename () |
Protected Member Functions inherited from realvirtual.realvirtualBehavior | |
| 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 () |
Protected Attributes inherited from realvirtual.Signal | |
| string | Visutext |
Events inherited from realvirtual.Signal | |
| OnSignalChangedDelegate | SignalChanged |
Detailed Description
PLC Integer Input Signal - Represents a 32-bit integer input signal to PLC from simulation.
PLCInputInt is a fundamental signal type for sending integer data from Unity simulation to external PLC systems. This component handles 32-bit signed integer values, essential for providing sensor readings, counters, and status codes to PLC control logic.
Key Features:
- Sends 32-bit signed integer values (-2,147,483,648 to 2,147,483,647) to PLC
- Provides real-time value transmission with change detection
- Supports discrete state representation and counting operations
- Includes override capability for testing and debugging
- Maintains connection status for communication reliability
- Automatic type conversion from various numeric formats
Signal Direction: Simulation → PLC (Input to PLC from PLC perspective) The signal transfers integer values from Unity simulation to PLC controllers, enabling simulation to provide sensor readings, counters, position values, and status codes to PLC programs.
Common Applications:
- Receiving production counters and batch quantities
- Reading state machine codes and operation modes
- Transferring array indices and recipe numbers
- Implementing discrete position values (encoder counts)
- Receiving error codes and diagnostic information
- Reading timer and counter values from PLC
- Transferring part types and product identifiers
Interface Integration: PLCInputInt integrates with all major industrial protocols:
- OPC UA: Maps to OPC UA Int32 nodes with proper data typing
- S7 TCP/IP: Direct reading from Siemens S7 DINT data types
- Modbus TCP/RTU: Maps to holding/input registers (2 registers for 32-bit)
- TwinCAT ADS: Connects to Beckhoff DINT variables
- MQTT: Subscribes to integer values in JSON payloads
- Shared Memory: Direct integer array access for high-speed transfer
Data Range and Precision: Supports full 32-bit signed integer range:
- Minimum: -2,147,483,648
- Maximum: 2,147,483,647
- No decimal places (whole numbers only)
- Ideal for counters, indices, and discrete values
Update Mechanism: The component uses FixedUpdate() for physics-synchronized value monitoring, ensuring consistent timing with Unity's simulation cycle. Value changes trigger EventSignalChanged events, allowing dependent components to react to new integer values immediately. This is particularly important for state machines and sequence control logic.
Type Conversion: Automatically handles conversion from various sources:
- String parsing for text-based protocols
- Byte array conversion for binary protocols
- Object casting with proper type checking
- Safe conversion from floating-point values when needed
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.
◆ IsInput()
|
virtual |
Virtual for getting information if the signal is an Input.
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.PLCInputInt.SetValue | ( | int | value | ) |
Sets the value as an int.
◆ SetValue() [3/4]
|
virtual |
Sets the value of the signal.
Reimplemented from realvirtual.Signal.
◆ SetValue() [4/4]
|
virtual |
Virtual for setting the value.
Reimplemented from realvirtual.Signal.
Public Member Functions inherited from