TwinCAT ADS interface to Beckhoff PLCs (real and virtual)

Inheritance diagram for game4automation.TwinCatAdsInterface:
game4automation.InterfaceThreadedBaseClass game4automation.InterfaceBaseClass game4automation.Game4AutomationBehavior

Public Types

enum  updatemode { Cyclic, OnChange, CyclicSumCommand }
- Public Types inherited from game4automation.Game4AutomationBehavior
enum  ActiveOnly {
  Always, Connected, Disconnected, Never,

Public Member Functions

override void OpenInterface ()
 Opens a connection to TwinCAT ADS Client and initializes the stream readers and Router and ADS Notifications. More...
override void CloseInterface ()
 Closes the connection to TwinCAT ADS Client.
void ImportSignals (bool simstart)
 Imports all signal objects under the interface gameobject. More...
- Public Member Functions inherited from game4automation.InterfaceBaseClass
void UpdateInterfaceSignals (ref int inputs, ref int outputs)
 Creates a new List of InterfaceSignals based on the Components under this Interface GameObject.
Signal CreateSignalObject (string name, SIGNALTYPE type, SIGNALDIRECTION direction)
 Create a signal object as sub gameobject.
Signal AddSignal (InterfaceSignal interfacesignal)
void RemoveSignal (InterfaceSignal interfacesignal)
virtual GameObject GetSignal (string name)
 Gets a signal with a name.
void SetAllSignalStatus (bool connected)
void DestroyAllSignals ()
void DeleteSignals ()
- Public Member Functions inherited from game4automation.Game4AutomationBehavior
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< BehaviorInterfaceConnectionUpdateConnectionInfo ()
List< SignalGetConnectedSignals ()
void SetVisibility (bool visibility)
 Sets the visibility of this object including all subobjects.
List< BehaviorInterfaceConnectionGetConnections ()
List< SignalGetSignals ()
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.
virtual void AwakeAlsoDeactivated ()

Public Attributes

string NetId = ""
 The TwinCAT NetID of the PLC to communicate with.
int Port = 851
 The TwinCAT Port of the PLC to communicate with.
updatemode UpdateMode
int PLCOutputsMinUpdateCycleMs
 Specifies if the event should be fired cyclically or only if the variable has changed. More...
int PLCOutputsMaxUpdateDelay
 The ADS server checks whether the variable has changed after this time interval. Unit is in ms. More...
int MaxNumberADSSubCommands = 1000
bool ReadAllOutputsOnStart = false
bool WriteAllInputsOnStart = false
bool DebugMode = false
string ConnectionStatus
 The connection Status to the PLC - Connected if everything is ok (ReadOnly)
string RouterStatus
 The Status to the Router -.
string PLCStatus
int NumberInputs
 The number of Inputs in the interface (ReadOnly)
int NumberOutputs
 The number of Outputs in the interface (ReadOnly)
int StreamLength
 The number of Outputs in the interface (ReadOnly)
List< string > RegExImportSignals
List< string > RegExSkipSignals
 Regex to limit the imported signals to certain symbols. If nothing is in this list every symbol is imported.
List< string > RegExSymbolIsPLCInput
 Regex to limit the imported signals to certain symbols. All Signals which are matchting these Regexs are not imported;.
bool CreateSubFolders = true
 Regex to define which variables are PLCInputs. For some variables like globals which are not linked directly to an input or output it can not be detected automatically.
bool ReadSignalValuesOnImport = true
 Create Subfolders for the Symbols with "." separating the name.
- Public Attributes inherited from game4automation.InterfaceThreadedBaseClass
int MinCommCycleMs = 0
int CommCycleMeasures = 1000
int CommCycleNr
int CommCycleMs
int CommCycleMin
float CommCycleMed
int CommCycleMax
int CommCycleMeasureNum
string ThreadStatus
bool NoThreading = false
- Public Attributes inherited from game4automation.InterfaceBaseClass
bool IsConnected =false
List< InterfaceSignalInterfaceSignals = new List<InterfaceSignal>()
- Public Attributes inherited from game4automation.Game4AutomationBehavior
string Name
 The name of the component if it should be different from the GameObject name.
ActiveOnly Active
GameObject FromTemplate
Game4AutomationController Game4AutomationController
bool HideNonG44Components

Protected Member Functions

override void CommunicationThreadUpdate ()
- Protected Member Functions inherited from game4automation.InterfaceThreadedBaseClass
virtual void CommunicationThreadClose ()
- Protected Member Functions inherited from game4automation.InterfaceBaseClass
void OnConnected ()
void OnDisconnected ()
- Protected Member Functions inherited from game4automation.Game4AutomationBehavior
bool hidename ()
bool hideactiveonly ()
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 Game4AutomationController in the scene.
virtual void AfterAwake ()
void Awake ()

Additional Inherited Members

- Static Public Member Functions inherited from game4automation.Game4AutomationBehavior
static bool DirectionIsLinear (DIRECTION direction)
 Gets back if the direction is linear or a rotation.

Member Function Documentation

◆ CommunicationThreadUpdate()

override void game4automation.TwinCatAdsInterface.CommunicationThreadUpdate ( )

Block Read

Reimplemented from game4automation.InterfaceThreadedBaseClass.

◆ ImportSignals()

void game4automation.TwinCatAdsInterface.ImportSignals ( bool  simstart)

Create Signals Object if not existing

◆ OpenInterface()

override void game4automation.TwinCatAdsInterface.OpenInterface ( )

Creates a new List of InterfaceSignals based on the Components under this Interface GameObject

Starts Multithreading

Reimplemented from game4automation.InterfaceThreadedBaseClass.

Member Data Documentation

◆ PLCOutputsMaxUpdateDelay

int game4automation.TwinCatAdsInterface.PLCOutputsMaxUpdateDelay
Initial value:

◆ PLCOutputsMinUpdateCycleMs

int game4automation.TwinCatAdsInterface.PLCOutputsMinUpdateCycleMs
Initial value:

◆ UpdateMode

updatemode game4automation.TwinCatAdsInterface.UpdateMode
Initial value: