How can one receive updated values in Simulink Real-time from Workspace.

2 views (last 30 days)
Hi everyone,
I have 3- variables (siminA.SiminB and L) which I am sending from MATLAB workspace to Simulink real-time by using "from workspace toolbox". Firstly I run the MATLAB code and then I run Simulink real-time on real time target devise (SpeedGoat). All I want to do is update these variables in Simulink -real time while its running on SpeedGoat. But when I try it first variable update works really fine as 3- variables I am using are in timeseries datatype, so values recieved from these timeseries work really fine but when I try to update timeseries the new list of values don't get updated in Simulink-real time.
Question 1: Is there any other way of updating values of variables from MATLAB to SImulink-Real time on real time ?
Question 2: If we use the following method is there any way to update variables in Simulink Real time without stopping the simulation?
Simulink Real-time block diagram:
(Please ignore the values in the display blocks)
MATLAB code I am using:
sampleTime = 1;
numSteps = 41;
time = sampleTime*(0:numSteps-1);
time = time';
siminA = timeseries(A,time);
siminB = timeseries(B,time);
L = timeseries(Z,time);
L = timeseries(Z,time);

Answers (1)

Dimitri MANKOV
Dimitri MANKOV on 1 Feb 2022
Hi Gurtej,
One thing that comes to mind are the stimulation APIs introduced in MATLAB R2021a. This feature lets you control the stimulation of root inport signal data on the target computer and get the stimulation status of the root-input ports on the target computer. You can start, pause, stop, and restart the stimulation on the target computer without reloading the real-time application. For more information, see Control and Update Stimulation of Inports to Real-Time Application.

Community Treasure Hunt

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

Start Hunting!