Main Content

Configure Time-Based Scheduling

For details about solver options, see Solver Pane.

Configure Start and Stop Times

The value of model configuration parameter Stop time must be greater than or equal to the value of parameter Start time. If the stop time is zero, or if the total simulation time (Stop minus Start) is less than zero, the generated program runs for one step. If the stop time is set to inf, the generated program runs indefinitely.

When using the GRT or ERT targets, you can override the stop time when running a generated program from the Microsoft® Windows® command prompt or UNIX®[1] command line. To override the stop time that was set during code generation, use the -tf switch.

model -tf n

The program runs for n seconds. If n = inf, the program runs indefinitely.

Certain blocks have a dependency on absolute time. If you are designing a program that is intended to run indefinitely (model configuration parameter Stop time = inf), and your generated code does not use the rtModel data structure (that is, it uses simstructs instead), you must not use these blocks. See Absolute Time Limitations for a list of blocks that can potentially overflow timers.

If you know how long an application that depends on absolute time needs to run, you can prevent the timers from overflowing and force the use of optimal word sizes by selecting model configuration parameter Application lifespan (days). See Control Memory Allocation for Time Counters for details.

Configure the Solver Type

For code generation, you must configure a model to use a fixed-step solver for system target files except for S-function and RSim system target files. You can configure the S-function and RSim targets with a fixed-step or variable-step solver.

Configure the Tasking Mode

The code generator supports both single-tasking and multitasking modes for periodic sample times. See Time-Based Scheduling and Code Generation for details.

Related Topics


[1] UNIX is a registered trademark of The Open Group in the United States and other countries.