nass-simscape/run_simulations.m

42 lines
965 B
Matlab

%% Open Loop simulation and save the final state
steady_time = 10;
initializeSimConf(struct('Tsim', steady_time, 'cl_time', steady_time));
set_param('Assemblage',...
'SaveFinalState','on',...
'FinalStateName','myOperPoint',...
'SaveCompleteFinalSimState','on'...
);
sim('Assemblage')
save('./data/myOperPoint.mat', 'myOperPoint');
set_param('Assemblage',...
'SaveFinalState','off',...
'SaveCompleteFinalSimState','off'...
);
save('./data/exp_open_loop.mat', 'Dmeas');
%% Close the Loop and start from steady state
sim_time = 10;
initializeSimConf(struct('Tsim', steady_time+sim_time, 'cl_time', steady_time));
load('./data/myOperPoint.mat', 'myOperPoint');
set_param('Assemblage',...
'LoadInitialState','on',...
'InitialState','myOperPoint'...
);
sim('Assemblage')
set_param('Assemblage',...
'LoadInitialState','off' ...
);
save('./data/exp_close_loop_xyz.mat', 'Dmeas');