Application lifespan (days)
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
Min: Must be greater than zero
Enter a positive (nonzero) scalar value (for example,
If you use Embedded Coder® and select an ERT target for your model, the underlying value for
1. If you are generating
production code, you should set the value of this parameter based on your
If you use Simulink®
Coder™ and select a GRT target for your model, the underlying value for
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 parameter 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).
For models that are configured with a service code interface, an overflow condition results and the code generator returns an error if the value specified for Application lifespan makes the clock tick value exceed 32 bits.
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 parameter 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
uint32words 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 (1E-9 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
To minimize the amount of RAM used by time counters, specify a lifespan no longer than necessary.
For code generation, the Application lifespan setting 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.
|Type: character vector
|Value: positive (nonzero) scalar value
- Optimize Memory Usage for Time Counters (Simulink Coder)
- Time-Based Scheduling and Code Generation (Simulink Coder)
- Timers in Asynchronous Tasks (Simulink Coder)
- Model Configuration Parameters: Code Generation Optimization (Simulink Coder)
- Code Efficiency (Simulink Coder)