Skip to main content

ILNodeDisturbCounter

Valid for: CANoe DE • CANoe4SW DE

Note

  • This function is not available for all OEM add-ons — depends on the CANoeIL.
  • This function can be used in a global node outside the node context of the IL and in test modules.

Function Syntax

long ILNodeDisturbCounter(dbMsg aMessage, char aSigGroupName[], long counterType, long disturbanceMode, long disturbanceCount, long disturbanceValue, long continueMode); // form 1
long ILNodeDisturbCounter(char aMessageName[], char aSigGroupname[], long counterType, long disturbanceMode, long disturbanceCount, long disturbanceValue, long continueMode); // form 2
long ILNodeDisturbCounter (char sigGroupName[], long type, long disturbanceMode, long disturbanceCount, long disturbanceValue, long continueMode); // form 3

Description

This function modifies the counter. Different fault injections are possible. This function influences a simulation node with an assigned CANoe interaction layer.

Parameters

  • aMessage: Message or PDU that should be modified.
  • aMsgName: Name of the message or PDU that should be modified. Supported qualification patterns for form 2: [DBName::][NodeName::]aMessageName
  • aSigGroupName: Some systems assign a counter to signal group. When specifying the signal group you can apply the disturbance to a dedicated signal group within a message or PDU. Use an empty character array if the counter of the whole message or PDU should be affected. Supported qualification patterns for form 3: [DBName::][NodeName::][MessageName::]aSignalgroupName
  • counterType: The possible values are described in the corresponding OEM add-on manual.
  • disturbanceMode: Identifies the disturbance mode:
    • 0: Value - The disturbance uses the value in disturbanceValue as counter.
    • 1: Freeze - The current counter value is transmitted.
    • 2: Random - A random value is transmitted as counter.
    • 3: Offset - The counter is incremented with the value in disturbanceValue.
  • disturbanceCount:
    • -1: Infinite.
    • 0: Stops the disturbance, e.g., an infinite disturbance.
    • n: Number of disturbances.
  • disturbanceValue: This value is used in combination with the disturbanceMode.
  • continueMode: Defines the behavior of the counter after the disturbances are finished:
    • 0: CorrectCounter - The counter will be incremented with counter value + number of disturbances.
    • 1: LastValidCounter - The counter’s next value bases on the last value before the disturbance has started.
    • 2: LastValue - The counter increments the last counter value (last disturbance value).

Return Values

  • 0: No error
  • -10000: Unspecific error
  • -10001: Node or module not found
  • -10002: No suitable module available
  • -10003: Function is not supported by module
  • -10004: Module returns illegal value
  • other: Error in module

Example

// Disturbs the PDU counter, disturbance pattern: 100x random value,
// after the disturbance the counter's next value bases on
// the last value before the disturbance has started.

variables {
  long countertype = 0;
  long disturbanceMode = 2;  // A random value is transmitted as counter.
  long disturbanceCount = 100;
  long disturbanceValue = 0; // value will be ignored due to disturbance mode
  long continueMode = 1;     // The counter's next value bases on the last value
                             // before the disturbance has started.
}

on key 'a' {
  ILNodeDisturbCounter("PDU_A", counterType, disturbanceMode, disturbanceCount, disturbanceValue, continueMode);
}