I am using the RSim target. My model includes a Constant block that is set to 104. When I follow the steps below, there is a discrepancy in the simulation results when I use the -p option. Otherwise, this problem does not occur. For example, if you use RSIMGETRTP to change the Constant block value to 105 before constructing the rtP structure, the discrepancy does not occur.
Reproduction Steps:
Use rsim.tlc for the Real-Time Workshop system target file and repeat the process for Constant block values 104 and 105.
1. Load 'testdatafile.mat'.
load testdatafile.mat
2. Build rtPTrial.mdl.
3. Run rtPTrial for 300 timesteps and look at the ScopeData output.
4. Get the rtP structure using
rtP = rsimgetrtp('rtPTrial.mdl');
5. Save the rtP structure in a MAT-file.
save rtPmatfile rtP
6. Execute rtPTrial.exe with the -p option for 300 timesteps and save results in 'outmatfile.mat'.
!rtPTrial -p rtPmatfile.mat -tf 300 -o outmatfile.mat
7. Load 'outmatfile.mat'.
load outmatfile
8. Plot the scope data.
simplot(rt_ScopeData) %returns all zeros for 'Constant' block value of 104
Best Answer