how to use the interface for commands?

MarkH 1 month ago in realvirtual.io Starter and Professional updated by Support 1 month ago 3

I want to interface the realvirtual digital twin with a c# application. The c# application already exists and controls resources like motors with resource commands. The commands are already expressed in a message that is send via TCP. No PLC is used.

An example message would be:

- message type -> eg resource command request

- object id -> eg Xaxis

- command id -> eg move

- parameters -> eg position, speed, acceleration and deceleration parameters

The individual parameters in the message are extracted from the message by a decoding procedure.

I would like to use an industry standard like MQTT (or OPC UA) to interface with the digital twin. Therefore the TCP message has to be converted to a MQTT message.

I have limited knowledge in this area, but from what I understand is that the digital twin requires signals. Drive_DestinationMotor for example requires 5 PLC outputs and 4 PLC inputs, the PLC outputs/inputs should be mapped to signals, signals should be connected to MQTT topics, each MQTT topic represents 1 signal. Am I right?

I can understand how to convert the TCP message to multiple MQTT messages, but how can I make sure that parameters like position and speed signals are received all at once or before the actual "start drive" signal?

Are there examples available on how to do this or should I use a different approach? What would happen when I replace Drive_DestinationMotor by a controller with states? Are there examples of such a controller?

Hi, it would be best to implement a TCP-IP interface in C# for realvirtual.io which understands your custom commands and then send for example the drive to a position with the public methods of the drive:

if (commandtype = "motordriveto)




I think this is much better than transferring your commands to a PLC like signal  based control of the Drive.

Ok, I thought of that as well, but can you give any direction on how to do that? Documentation? Example?


I am sorry we don't have example code really covering what you need.

You can check our api documentation here - there you will find the public properties and methods for example for our drives:


You can also check here how to implement your own interface:


The rest is more or less standard c# scripting for a tcp-ip communication. Maybe you can start here: