Main Content

Application lifespan (days)

Duration in days before timer overflow occurs

Model Configuration Pane: Math and Data Types

Description

The Application lifespan (days) parameter specifies how long, in days, an application that contains blocks or Stateflow® charts that depend on absolute or elapsed time can execute before a timer overflow occurs.

Settings

auto | positive scalar value | inf

The default setting depends on the model code generation configuration.

Default Parameter Settings

Code Generation ConfigurationDefault
GRT-based system target fileauto with an underlying value of inf
ERT-based system target file and data code interfaceauto with an underlying value of 1
ERT-based system target file and service code interfaceinf

You can specify a positive scalar value (for example, 0.5) or inf.

If you set the parameter to inf, the code generator uses a word size of 64 bits, which meets the 64-bit integer data type requirement for continuous execution.

If you are generating production code, you should set the value of this parameter based on your model timer requirements.

This parameter is ignored when you operate your model in external mode, select the model configuration parameter MAT-file logging, or have a continuous sample time because a 64-bit timer is required in those cases.

Tips

  • If your model does not include blocks or Stateflow charts that depend on absolute or elapsed time, this parameter does not affect simulation or generated code.

  • Simulink® evaluates this parameter first against the model workspace. If Simulink cannot resolve the parameter by using the model workspace, Simulink evaluates the parameter against the base workspace.

  • For simulation, setting this parameter to a value greater than the simulation time prevents timer overflows.

  • For simulation, the application lifespan setting can be different for the parent and referenced models. For code generation, the setting must be the same for parent and referenced models.

  • For models intended for generating production code, avoid using blocks that depend on time.

  • To minimize the amount of RAM used by time counters, specify the smallest application lifespan possible and, for models that use asynchronous rates, the largest step size possible. For information on how Simulink represents timers for absolute and elapsed time, see Timer Representation and Computation (Simulink Coder).

  • For GRT-based models and ERT-based models configured to use a data code interface, if you set the application lifespan to inf, the code generator represents time as two 32-bit unsigned integers. For ERT-based models configured to use a service code interface, the code generator uses an unsigned 64-bit integer data type. If the target hardware does not support 64-bit integers, the code generator represents a 64-bit timer as a multiword unsigned 64-bit integer data type.

  • If your model contains blocks that depend on fixed-point data and time, this parameter affects simulation and generated code.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyFinite value
Safety precautioninf

Programmatic Use

Parameter: LifeSpan
Type: character vector
Value: positive scalar value or 'inf'
Default: GRT-based system target file — 'auto' with an underlying value of 'inf'; ERT-based system target file and data code interface — 'auto' with an underlying value of 1; ERT-based system target file and service code interface — 'inf'

Version History

Introduced in R2009b