Obtain data using the Emulation module with Modbus?

Obtain data using the Emulation module with Modbus?

antonio_ga2
Not applicable
17 Views
6 Replies
Message 1 of 7

Obtain data using the Emulation module with Modbus?

antonio_ga2
Not applicable

[ FlexSim 18.2.2 ]

Hello How could I obtain data using the Emulation module with Modbus tcp / ipv4 either in JAVA or in c ++? If possible with an example to understand its operation.

0 Likes
Accepted solutions (1)
18 Views
6 Replies
Replies (6)
Message 2 of 7

joshua_s
Not applicable

What data are you trying to obtain? Most of the data would would want is found in the "Variables" Tab of the Emulation properties window where you can read and write to the PLCs, Servers,or Client.

0 Likes
Message 3 of 7

antonio_ga2
Not applicable

Maybe, the time it takes to assemble a product.

But what I need is a way to get some kind of data in a program in JAVA or c ++, I was trying to connect JAVA with FlexSim using sockets, but I have not obtained results.

0 Likes
Message 4 of 7

joshua_s
Not applicable
Accepted solution

A basic script to communicate with a C++ or Java server using FlexSim as the client is as such

socketinit();
int client=0;
client = clientcreate();
string hostname="127.0.0.1";
int port=502;
clientconnect(client,hostname,port);
print(client);
clientsend (client, "TestConnection");
print(clientreceive(client, NULL, 1024, 0));
clientclose(client);

The Emulation module in FlexSim is very specific to Modbus and OPC connections

0 Likes
Message 5 of 7

antonio_ga2
Not applicable

thanks, this script, in what part of the program do I place it?

14625-screenshot-9.png

0 Likes
Message 6 of 7

antonio_ga2
Not applicable

I could re-publish the answer, apparently it is no longer available.

Message 7 of 7

joshua_s
Not applicable

If you could that would be great so it can still be a good resource for others.

0 Likes