5.1.64. Non-volatile adaptive check-sum (pnv_AdaptiveChecksum)

Store adaptive data.

5.1.64.1. Supported targets

All targets

5.1.64.2. Required license

None (Main library). (See Section 2.3, “Licensed Features”.)

5.1.64.3. Description

Adaptive data can be modified from the default values of scalar, 1-d or 2-d maps, or arrays while the model is running, and recalled next time the model is started. The method depends on the ECU and its configuration options:

  • In most ECUs, adaptive data is stored in flash. This is retained when the ECU is unpowered.

In either case, a checksum is used to validate the data at start-up time. If the checksums match at start-up, the adaptive data is retained from the previous power cycle, otherwise the adaptive data is reverted to default. In most ECUs, the data is also reverted to default if the stored data size or application version number are incompatible with the current build of software.

This block is used to force the stored data to be updated. When the inport calc_checksum transitions from 0 to 1, the block pauses execution of the model, calculates the checksum and stores the adaptive data, then continues execution of the model. In the case of battery-backed RAM, that merely involves computing the new checksum, but in the case of flash the memory is physically reprogrammed. Real-time execution will be briefly affected.

If using battery-backed storage, it is important to trigger the adaptive checksum update and not update adaptive data thereafter before shutting down the ECU. If adaptive data is modified after the checksum has been updated, and the ECU shuts down, next time it powers up, adaptive data will revert to default. (For flash, it will revert to the last saved data.)

To ensure the battery-backed checksum is up to date before shutting down the ECU, the pnv_Status block provides an indication of whether the checksum is correct or not. If not, shutdown of the module can be prevented (if conditions are appropriate) and the checksum updated. That block also indicates if the last flash save was successful.

Note

Flash memory wears out over time, and after a minimum number of checksum updates, the Flash memory is more likely to forget information each time the checksum is updated. For this reason, Flash is only programmed when adaptive data has changed since the last checksum update (either through an adaption operation or reset operation).

See the technical specification for each ECU for information about the Flash capabilities of each ECU.

Old adaptive data is reused so long as it has the expected total data size and was written by an application with the same user-specified version number. Otherwise the values revert to defaults. If the usage of adaptive blocks has changed in a new software version, increase the application sub-minor version number to ensure that any old values are not used, as they may not map appropriately to the blocks in the new model even if the total data size happens to match.

5.1.64.4. Inports

  • calc_checksum

    Transition from 0 to 1 to cause the adaptive data to be saved; no save takes place otherwise.

    Value type:Boolean
    Calibratable:No

5.1.64.5. Outports

None.

5.1.64.6. Mask parameters

  • Sample time

    The periodicity of the block execution.

    Range: [0.001, 3600] seconds

    Value type:Real
    Calibratable:No

5.1.64.7. Notes

None.