top of page
Search
Writer's pictureIvaylo Fiziev

User defined external connections


External connections are core part of

the virtual commissioning capabilities of Process Simulate. They allow us to communicate with 3rd party hardware/software devices during simulation. Often these are referred to as Hardware in the Loop (HiL) and Software in the Loop (SiL) solutions.

Historically we have tried to develop a number of external connections: OPC, WinMOD, PLCSIM Advanced etc. One of the biggest challenges we face in this area is getting to know the underlying communication protocols. Some vendors provide SDKs that make our life easier. Others however require us to deal with the low level workings of the connection (data interpretation and formatting) which are specific for each and every family of devices. As you might imagine this process does not scale well. This is why we're trying to outsource some of the connections to interested partners or clients. How do we do it? We are simply enabling users to implement custom external connections. These are plug-ins that users develop and register with Process Simulate. Once this is done we redirect the IO calls to them. The code within the plug-in takes care of the communication details. I recall this feature was introduced in version 17.


When the connection is registered users can use it like any other external connection. It will appear in the list of available connection types. When selected, the connection will present the user with its own settings dialog. Once confirmed the connection will appear in the list of defined connections so users can validate the settings. In this example I am showing a custom 'loopback' connection that returns all signals that are sent to it:


How do I create a new connection? It is just a COM dll that delivers an object that we can instantiate and use over a well-known interface. We provide a sample project which is distributed with Process Simulate. You can find it under your installation folder in: TecnomatixSDKHelp\Samples\ExternalConnections


You can (64Bit) build the project with Visual Studio and then register the dll using:

regasm.exe /codebase ExtConnDemo.dll


Next you need to register the dll as Process Simulate add-on by adding a key (GUID) of the external connection object in the registry: [HKEY_LOCAL_MACHINE\SOFTWARE\Tecnomatix\TUNE Add-ons\ExternalConnections\{98EC1520-68CE-4965-B851-8CE8DC5C06B6}]

@="ExtConnDemo"


When you start Process Simulate you'll have the name of your connection (as defined by the add-on) in the list of available connections.

The connection state (settings) is opaque to Process Simulate. The add-on should serialize it into a string and provide it to us. We store this string and later use it to initialize a new instance of the connection (usually on simulation start). The add-on's responsibility is to format and parse this string. Usually it will rely on JSON, XML, CSV or other textual format to do so. The settings are presented in the dialog upon request.

Process Simulate does not make concurrent calls to the add-on instance so you don't have to care about concurrency. This is important to mention since later we'll be using custom external connections from multiple threads. And each thread will have it's own instance of the connection. This has a lot to do with time critical SCL scripts. But this is another topic.


I'll give you some time to walk through the demo project.

Have a nice one!

13 views0 comments

コメント

5つ星のうち0と評価されています。
まだ評価がありません

評価を追加
bottom of page