%% Define Time Delays
% This example shows how to define two absolute time delays in a
% continuous-time chart.

% Copyright 2018-2020 The MathWorks, Inc.

%%

% Set up charts with white background
set_param(0,'ExportBackgroundColorMode','white');

model = 'sf_continuous_time_delays';
load_system(model);
open_system([model '/Chart'])

%%
% The execution of the chart follows these steps:
% 
% # When the chart awakens, the state |Input| activates first.
% # After 5.33 milliseconds of simulation time, the transition from |Input|
% to |Output| occurs.
% # The state |Input| becomes inactive and the state |Output| becomes
% active.
% # After 10.5 seconds of simulation time, the transition from |Output| to
% |Input| occurs.
% # The state |Output| becomes inactive and the state |Input| becomes
% active.
% 
% Steps 2 through 5 are repeated until the simulation ends.

%% 
% If a chart has a discrete sample time, any action in the chart occurs at
% integer multiples of this sample time. For example, suppose that you
% change the configuration parameters so that the Simulink(R) solver uses a
% fixed step of size 0.1 seconds. Then the first transition from state
% |Input| to state |Output| occurs at t = 0.1 seconds. This behavior
% applies because the solver does not wake the chart at exactly t = 5.33
% milliseconds. Instead, the solver wakes the chart at integer multiples of
% 0.1 seconds, such as t = 0.0 and 0.1 seconds.
