SpeedHazardDetection Example#

This example shows a single cyclic Step runnable aligned to metamodel v0.4.1. Canonical VSS semantics are reused where available, runtime quality is explicitly indicated through enum-based runtime companion interfaces, protectionRequired expresses only whether interface protection is required, and FunctionResult is represented as the runtime execution-result contract.

Calibration parameters use VSS-style hierarchical paths under the relevant vehicle-domain branch. Where such paths are not part of the standard catalogue, they shall be treated as approved/illustrative extensions.

  1# *******************************************************************************
  2# Copyright (c) 2026 ZF Friedrichshafen AG
  3#
  4# See the NOTICE file(s) distributed with this work for additional
  5# information regarding copyright ownership.
  6#
  7# This program and the accompanying materials are made available under the
  8# terms of the Apache License Version 2.0 which is available at
  9# https://www.apache.org/licenses/LICENSE-2.0
 10#
 11# SPDX-License-Identifier: Apache-2.0
 12#
 13# Contributors:
 14#   Thomas Pfleiderer - Function specification added
 15#   Saran Gundlapalli - speed_hazard_detection.afs.yaml updated according to metamodel v0.4.1
 16# *******************************************************************************
 17
 18functionSpecification:
 19  name: SpeedHazardDetection
 20  version: 1.0.0
 21  metaModelRef:
 22    name: Eclipse-autoapiframework-Metamodel
 23    version: 0.4.1
 24
 25  description: >-
 26    Detects rapid acceleration and requests hazard warning lights if the
 27    configured threshold is exceeded.
 28
 29  dataInterfaces:
 30    - name: Vehicle.Speed
 31      direction: input
 32      dataType: float
 33      description: Current vehicle speed value.
 34      unit: km/h
 35      min: 0.0
 36      max: 300.0
 37      defaultValue: 0.0
 38      resolution: 0.1
 39      precision: 1
 40      FuSa: true
 41      ASIL: B
 42      minUpdatePeriodMs: 10
 43      accuracy: "+/-0.2 km/h"
 44      protectionRequired: true
 45      runtimeCompanion:
 46        qualityCode:
 47          name: Vehicle.Speed.Qualifier
 48          datatype: enum
 49          enumRef: DataQuality
 50
 51        # Each Data interface explicitly indicates its runtime quality companion.
 52        # The qualifier is an enum-based runtime interface and intentionally does not
 53        # duplicate normal Data properties such as min/max/default/resolution.
 54
 55    - name: Vehicle.Acceleration.Longitudinal
 56      direction: input
 57      dataType: float
 58      description: Longitudinal acceleration used to detect strong acceleration events.
 59      unit: m/s2
 60      min: -20.0
 61      max: 20.0
 62      defaultValue: 0.0
 63      resolution: 0.01
 64      precision: 2
 65      FuSa: true
 66      ASIL: B
 67      minUpdatePeriodMs: 10
 68      accuracy: "+/-0.05 m/s2"
 69      protectionRequired: true
 70      runtimeCompanion:
 71        qualityCode:
 72          name: Vehicle.Acceleration.Longitudinal.Qualifier
 73          datatype: enum
 74          enumRef: DataQuality
 75
 76
 77    # Existing VSS semantics shall be reused where available. If the selected
 78    # VSS release does not provide an equivalent hazard-light request node,
 79    # this path must be treated/documented as an conceptual extension that follows
 80    # VSS canonical naming.
 81
 82    - name: Vehicle.Body.Lights.Hazard.Request
 83      direction: output
 84      dataType: boolean
 85      description: True requests activation of hazard warning lights.
 86      unit: boolean
 87      min: 0
 88      max: 1
 89      defaultValue: false
 90      resolution: 1
 91      precision: 1
 92      FuSa: true
 93      ASIL: B
 94      minUpdatePeriodMs: 20
 95      accuracy: logical
 96      protectionRequired: true
 97      runtimeCompanion:
 98        qualityCode:
 99          name: Vehicle.Body.Lights.Hazard.Request.Qualifier
100          datatype: enum
101          enumRef: DataQuality
102
103
104  parameters:
105    - name: Vehicle.Chassis.SpeedHazardForward
106      dataType: float
107      defaultValue: 10.0
108      description: >-
109        Relative speed increase threshold in percent for triggering
110        hazard request while driving forward.
111      unit: percent
112      tunable: false
113      min: 0.0
114      max: 100.0
115
116    - name: Vehicle.Chassis.HazardRequestDurationMs
117      dataType: uint32
118      defaultValue: 3000
119      description: Hold time for hazard request after trigger.
120      unit: ms
121      tunable: false
122      min: 0
123      max: 600000
124
125  scheduling:
126
127    - functionName: SpeedHazardDetection.Init
128      runType: init
129      description: Initialize internal states and latched outputs.
130      implementedASIL: B
131      executionResult:
132        type: FunctionResult
133      supervision:
134        required: false
135
136    - functionName: SpeedHazardDetection.Step
137      runType: cyclic
138      description: Evaluate inputs and calculate hazard request output.
139      cycleTimeMs: 20
140      implementedASIL: B
141      previousRunnableRef: SpeedHazardDetection.Init
142      executionResult:
143        type: FunctionResult
144      supervision:
145        required: false
146
147    - functionName: SpeedHazardDetection.Terminate
148      runType: terminate
149      description: Shutdown cleanup for deterministic deactivation.
150      implementedASIL: QM
151      previousRunnableRef: SpeedHazardDetection.Step
152      executionResult:
153        type: FunctionResult
154      supervision:
155        required: false