Connection between two PCs with Simulink

C
Cruz · Sep 30, 2021 · 2.2K views
Question
I am doing a master degree project and it is based on Hardware-in-the-loop (HIL) to a quadrotor model. The difference between common projects I will not use a external hardware (like a board, Arduino), I will use an other computer (PC) to be the hardware and run the controller block of my model. That is, I want run a model in Simulink (PC1) but only the controller block must run in the PC2 and the two PCs has to exchange the informations (inputs and outputs of this controller block).   How can I do it??
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 24, 2026
The solution depends on whether you need real-time performance. If real-time performance is not needed, then you can run Simulink on the two computers and use the UDP send/receive blocks ( available in the Instrument Control blockset) to send data between the two computers. You will need to configure the UDP Rx blocks to "block" and not execute until data is received. In this way you can keep the execution of the two models synchronized.
 
If you need real-time performance, then you will need to leave the Simulink environment. The most common workflow is to generate C/C++ code from the two Simulink models using Simulink Coder/Embedded Coder and then compiling/linking the code to run on a system with a real-time operating system. MathWorks sells a turnkey software/hardware solution called Simulink Real-Time and Speedgoat, but you can use any RTOS/hardware combination that has the horsepower to run your C/C++ code in real-time.
 
Note. If psuedo real-time is acceptable, you can stay in the Simulink environment and use a "pace" block in the two Simulink models that will slow the simulation of both models to ~real-time. The Pace block is available in the Aerospace blockset, but other implementations can be found on MATLAB central.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!