Running Simscape on the Computer and get Data from a TCP/Client.
3 views (last 30 days)
Show older comments
I want to couple a simscape Model in Simulink with a TCP Client for Software in the Loop testing. How can i execute Simscape on my Computer nearly in Real Time? How can i send data to the client with a fix Delay like 100ms. I tried a lot in the solvers, but i am far away from a good solution. I didnt want to use a hardware like speedgoat to execute my programm. I want to execute it on the computer and want to comunicate to a client on the network card. Is there any oppertunity to run the simulation with a constant timedelay (frequency). I wan to Send Data To the Client, and get Data from the Client an want to put the data into the simscape modell.
2 Comments
Jonas
on 3 Jul 2020
Edited: Jonas
on 3 Jul 2020
What is the sample time you are using to calculate the Simscape model?
Which domains have you implemented in Simscape?
For high sample rates and complex models you will need an FPGA with a SpeedGoat to be able to execute the Simscape model in real-time. Your desktop PC won't be able to reach the sample rate.
If you are calculating something like a slow temperature fluid model it may work, but certainly not for fast electrical systems for example.
Answers (1)
Vasco Lenzi
on 9 Jul 2020
Hi David
As you anticipated the solution that will work for sure with robustness and precision is Speedgoat.
If this is not possible for any reason, you can try the Instrument Control Toolbox. It offers a Simulink Library of TCP/IP, Serial and UDP input/output blocks. This should do the trick.
If your model is not fast enought, you can try to speed up execution by isolating simscape within a subsytem and use simulink coder to transform it in a s-function. This will convert the Simscape network in a C-based "black box" that execute fast.
For the real time part, you can then use the new Real-Time pacing feature of simulink starting from 2018a
You don't need the RT Pacer block from aerospace blockset anymore.
Alternatively for real-time you can take a look at Simulink Desktop Real-Time, which creates a real-time kernel on your windows machine where the simulink model is executed at near real-time.
0 Comments
See Also
Categories
Find more on Model Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!