Real Time TCP/ip communication

7 views (last 30 days)
Rui Rodrigues
Rui Rodrigues on 7 Mar 2018
Answered: Dimitri MANKOV on 8 Dec 2021
Hello all. I am quite new to matlab and simulink so please bear with me.
I have a model where I capture and process various signals. Now I want to integrate that model with an external app (C#) so I can send and receive commands/data.
My first step was to learn how to setup a simple TCP/IP server on matlab and get it to work but I want that server to be inside the model and make sure it works without interrupting the signals capturing/processing. Actually I don't care if I use the model as a server or as a client, right now I am focusing on learning.
I believe the best way to go would be to use the RTW blocks for TCP/IP in 2017b. Am I wrong? is there any other way?
I have been trying to compile and run this example:
but I always get and error when calling
rtwbuild('TargetToTargetTCPClient');
I get:
Error using coder.internal.callMakeHook
The call to slrt_make_rtw_hook, during the entry hook generated the following error: Model is configured for target computer 'TargetPC1', which does not exist
I changed the model tried the server on "127.0.0.0" and also using my LAN ip address but the error presists.
I understand I am missing something and I am quite lost. Any pointers/help would greatly appreciated.
Thank you in advance.

Answers (1)

Dimitri MANKOV
Dimitri MANKOV on 8 Dec 2021
Hi Rui,
In order for this example to work, you need a target machine (for instance those made by Speedgoat), on which the real-time application compiled from your Simulink model would be loaded. In other words, your model is not running on the PC used to design it when using Simulink Real-Time.
Do you have a target machine?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!