Clear Simulink model from memory
49 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everybody,
I'm having a problem with the loading and unloading of Simulink schemes. I use a parfor loop to run some simulations with different parameters. I want to be able to control the simulation mode from the command line, therefor I start my file with the following statements to set for example the rapid accelerator mode:
% Set model to rapid-accelerator
load_system(['Validation_models_FKA/' modelname])
set_param(modelname,'SimulationMode','accelerator')
save_system(modelname)
bdclose(modelname)
I use a function to run my Simulink model and I use this in the parfor loop as followings:
parfor i = 1:length(scales{k})
s_par(i) = Run_simulation(Sim,steering_systems(i),PitmanArm,DragLink,HydroPulse,['Validation_models_FKA/' modelname]);
end
This does not always work, I always get the following warning:
Warning: Block diagram 'Steering_system_xhydro_input_sw_free_FKA_VALIDATION' is being edited but the file has changed on disk since it was loaded. You should close and reload the block diagram.
> In rapid_accel_target_utils>init_up_to_date_check_on
In rapid_accel_target_utils
In build_rapid_accel_target
In sl (line 15)
In Run_simulation (line 14)
In parallel_function>make_general_channel/channel_general (line 914)
In remoteParallelFunction (line 38)
Warning: The file containing block diagram 'Steering_system_xhydro_input_sw_free_FKA_VALIDATION' has been changed on disk since it was loaded. Simulink is unable to reload it automatically because it is the root model. Close it and reopen it manually.
Apparantly the file is still in the memory somewhere. I can get it to work if I open and close the model by hand, restart MATLAB or do both but not always. Also when I set the simulation mode to normal, I still get errors related to the rapid-accelerator mode. Therefor I guess that the setting of the SimulationMode doesn't go as I want it to go.
Best regards,
Jan
0 Kommentare
Antworten (1)
Jaimin
am 6 Jan. 2025
Hi @Jan
Based on the description of the issue, it seems you want to run multiple Simulink sessions with different configurations.
To achieve this, you can use the “parsim” function.
For more information kindly refer to following MathWorks documentation.
I hope this will be helpful.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!