%% Simulate a Model in Fast Restart Mode
%%
% Open the model.

% Copyright 2015 The MathWorks, Inc.

open_system('sdoHydraulicCylinder')
%%
% Create a simulation scenario for the model.
simulator = sdo.SimulationTest('sdoHydraulicCylinder');
%%
% Configure the model and |simulator| for fast restart.
simulator = fastRestart(simulator,'on');
%%
% Simulate the model.
simulator = sim(simulator);
%%
% The first simulation in fast restart mode requires the model to compile. 
% Subsequent simulations execute in fast restart mode and reuse the compiled
% data. 
%%
% Adjust tunable model parameters.
Ac = sdo.getParameterFromModel('sdoHydraulicCylinder','Ac');
Ac.Value = 0.5;
simulator.Parameters = Ac;
%%
% Simulate the model again.
simulator = sim(simulator);
%%
% The model simulates in fast restart mode.
%% 
% Turn off fast restart mode.
simulator = fastRestart(simulator,'off');
