Specify how long (in days) an application that contains blocks depending on elapsed or absolute time should be able to execute before timer overflow.
Category: Math and Data Types
Default:
auto
Min: Must
be greater than zero
Max:
inf
Enter a positive (nonzero) scalar value (for example, 0.5
) or
inf
.
If you use Embedded Coder® and select an ERT target for your model, the underlying value for
auto
is 1
. If you are generating
production code, you should set the value of this parameter based on your
model.
If you use Simulink®
Coder™ and select a GRT target for your model, the underlying value for
auto
is inf
.
This parameter is ignored when you are operating your model in external mode, have MAT-file logging enabled, or have a continuous sample time because a 64 bit timer is required in these cases.
Specifying a lifespan, along with the simulation step size, determines the data type used by blocks to store absolute time values.
For simulation, setting this parameter to a value greater than the simulation time will ensure time does not overflow.
Simulink software evaluates this parameter first against the model workspace. If this does not resolve the parameter, Simulink software then evaluates it against the base workspace.
The Application lifespan also determines the word size used by timers in the generated code, which can lower RAM usage. For more information, see Control Memory Allocation for Time Counters (Simulink Coder).
Application lifespan, when combined with the step size of each task, determines the data type used for integer absolute time for each task, as follows:
If your model does not require absolute time, this option affects neither simulation nor the generated code.
If your model requires absolute time, this option optimizes
the word size used for storing integer absolute time in
generated code. This ensures that timers do not overflow within
the lifespan you specify. If you set Application
lifespan to inf
, two
uint32
words are used.
If your model contains fixed-point blocks that require absolute time, this option affects both simulation and generated code.
For example, using 64 bits to store timing data enables models with a step size of 0.001 microsecond (10E-09 seconds) to run for more than 500 years, which would rarely be required. To run a model with a step size of one millisecond (0.001 seconds) for one day would require a 32-bit timer (but it could continue running for 49 days).
A timer will allocate 64 bits of memory if you specify a value of
inf
.
To minimize the amount of RAM used by time counters, specify a lifespan no longer than necessary.
For code generation, must be the same for parent and referenced models. For simulation, the setting can be different for the parent and referenced models.
Optimize the size of counters used to compute absolute and elapsed time.
Parameter:
LifeSpan |
Type: character vector |
Value: positive (nonzero) scalar value
or 'inf' |
Default:
'auto' |
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | Finite value |
Safety precaution | inf |