Message Boards Message Boards

0
|
7838 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

WSMCOM - running a model from an EXE over TCP

Is there any more documentation for running an EXE version of a system model? All I found was this, and I can't figure out how to send a HELLO_SCS packet... or any other packet.

I opened a session from the command prompt with

myModel.exe -f myModel.sim -server 127.0.0.1:7000

And then using Mathematica, I tried creating a socket and writing to it with Write and BinaryWrite. The 4 parts of the header are

  1. protocol version
  2. packet type
  3. packet specific
  4. payload length

So I thought BinaryWrite[socket,{4,1,0,0,0,0,0,0}] would work for IPv4, HELLO_SCS, and no payload. But that didn't work. Has anyone else used this feature? The two main errors I'm getting are:

Received packet with incompatible protocol version

Failed to receive packet header

POSTED BY: Eric Smith
4 Replies

Sorry for the confusion, seems like I got the number of bytes for paket specific/payload length wrong and the results I got from that tricked me to the wrong conclusion.

POSTED BY: Otto Tronarp

I see that the documentation is lacking in telling what the protocol version is. I'll see that that is added to the next release.

The version is the iteration of the WSMCom interface, which is currently 1. Your call would be:

BinaryWrite[socket,{1,1,0,0,0,0,0,0}]

Attached is a quick and dirty implementation of the basic functionality of the SCS protocol in Mathematica. It covers setting up the connection and evaluating a few commands.

Obviously you would like to add some more failure handling if used for more than proof of concept.

Attachments:
POSTED BY: Malte Lenz
Posted 8 years ago

That's a very helpful notebook, Malte. Thank you for that.

POSTED BY: Updating Name

The correct thing to write would be BinaryWrite[s, {1, 1, 0, 0}]

  • Protocol version: 1
  • Packet type: 1
  • Packet specific: 0
  • Payload length: 0

However after some testing I suspect that BinaryWrite interprets it as string data, when I send the above the simulation interprets it as protocol version 49 (ASCII code for 1). Perhaps someone that knows more about SocketConnect can chime in.

In what language do you want todo this? Perhaps I can give you an example in a language that is closer to what you intend to use?

POSTED BY: Otto Tronarp
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract