FMI logo

This layered standard on top of FMI 3.0, defines how to describe and simulate network signals as input and output variables of an FMU.

[Note: Although the document refers to version 3.0 of the FMI standard, everything described in this document also applies to all subsequent minor versions. For further information on compatibility, see section Versioning and Layered Standards in the FMI 3.0 specification.]


Copyright © 2023-2025 The Modelica Association Project FMI.

This document is licensed under the Attribution-ShareAlike 4.0 International license. The code is released under the 2-Clause BSD License. The licenses text can be found in the LICENSE.txt file that accompanies this distribution.

1. Introduction

1.1. Intent of This Document

Automotive CAN, LIN, FlexRay, CAN FD, CAN XL and Ethernet are network technologies that have been applied successfully over many years by all automotive OEMs worldwide. Virtualizing electronic control units (ECUs) and then simulating multiple such virtual ECUs requires connecting them using a virtual version of these network technologies.

This layered standard defines what input and output variables and which FMI 3.0 features are used and how to emulate a transport layer for such network traffic. At this point it should be explicitly mentioned that this layered standard not only relates to automotive buses, but can also be extended to buses from other domains in the future.

There are mainly two base use cases envisioned here:

  • Physical Signal Abstraction (or High-Cut) to simply transport physical signal values between virtual ECUs.
    The network properties are largely idealized: Infinite bandwidth, zero-delay etc. Signals, groups of signals and their properties (e.g., units) are usually derived from existing and validated standard network topology description formats, such as DBC, LDF, Fibex and ARXML.

  • Network Abstraction (or Low-Cut) to realize virtualized bus driver implementations [1].
    This transport layer emulation allows anything from idealized to more detailed network simulations, including bandwidth restrictions, message arbitration and delays. It forwards the network payloads using binary variables. The Low-Cut abstraction layer is meant to allow virtualized bus driver implementations, including feedback from the physical drivers about transmission status or network node states. Since the Network Abstraction layer is protocol-independent, it can also be used for the simulation of non-automotive control units, e.g., from the field of industrial automation.

So that this layered standard can be supported in a variety of FMU importers and other types of simulators three possible communication architectures for bus communication are specified:

  • Direct Communication: Limited to exactly two FMUs and uses a common FMU importer that does not require any special features for simulating buses. The importer only needs to support FMI variables, Clocks, and terminals, which are sufficient to emulate bus communication between the FMUs. Note, even though Clocks are listed in the ModelVariables element in the modelDescription.xml of the FMU, Clocks will be treated differently than all other variables. In this document we will call variables of type Clock 'Clocks', and all variables that are not Clocks 'variables'.

  • Composition with dedicated Bus Simulation FMU: A separate Bus Simulation FMU is used to simulate the specific bus behavior. Other FMUs that want to emulate bus communication provide and relate network information via this Bus Simulation FMU. This communication architecture can be operated by a common FMU importer and allows complex and detailed bus simulations.

  • Importer with integrated Bus Simulation: Works analogously to the Composition with dedicated Bus Simulation FMU architecture, whereby the Bus Simulation FMU is directly integrated into an importer or other simulator.

1.2. System Simulation Effects

This standard allows a highly accurate bus simulation using FMI 3.0 mechanisms. To profit from such accuracy on a system level to predict system behavior, all system simulation components must provide at least that level of accuracy. When focusing on single virtual ECU use cases, such as protocol validation, the accuracy requirements for the rest of the system can be relaxed.

Contrary, on system level, the accuracy of the simulation depends on the accuracy of all its components. These components can be virtual ECUs, plant models, residual bus simulators, data replay components and, of course, the bus simulation. A single low-accuracy component limits the overall system simulation accuracy. The level of detail of these runtime models determine the size of the window for data transmission events. With virtual ECUs using the zero-time execution model [2], the time of data transmission can only be determined to be somewhere within the given smallest granularity of the virtual ECU’s internal scheduler. More detailed models, like instruction set simulators or even System-C models of the hardware, can narrow the window for these events significantly. However, current modelling technologies, as of writing this standard, do not allow practical implementations in terms of modelling time and runtime of virtual ECUs that can be used to simulate all realistic bus simulation effects, such as collision and arbitration events.

1.3. How to Read This Document

Conventions used in this document:

  • Non-normative text is given in square brackets in italic font: [Especially examples are defined in this style.]

  • The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119] (regardless of formatting and capitalization).

In key parts of this document, non-normative examples are used to help understand the standard. To keep the standard itself brief, the FMI LS BUS Implementer’s Guide was created. It contains further technical discussions and examples on how to implement certain aspects of the standard for both FMUs and importers. Contrary to the standard, the FMI LS BUS Implementer’s Guide will be a living document, enhanced with further tips and tricks as the FMI community encounters them.

1.4. Remarks

This layered standard currently only refers to the FMI for Co-Simulation (CS). At the current time, Model Exchange (ME) and Scheduled Execution (SE) are not taken into account. All explanations in this document are therefore to be understood in the context of FMI for Co-Simulation (CS).

2. Layered Standard Manifest File

This layered standard defines requires the use of a layered standard manifest file and Table 1 shows the content of fmi-ls-manifest.xml.

Table 1. Attribute Details.
Attribute Namespace Value Description

fmi-ls-name

http://fmi-standard.org/fmi-ls-manifest

org.fmi-standard.fmi-ls-bus

Name of the layered standard in reverse domain name notation.

fmi-ls-version

http://fmi-standard.org/fmi-ls-manifest

1.0.0

Version of the layered standard. This layered standard uses semantic versioning, as defined in [PW13].

fmi-ls-description

http://fmi-standard.org/fmi-ls-manifest

Layered Standard for the simulation of bus communication on a Physical Signal Abstraction or Network Abstraction based level.

String with a brief description of the layered standard that is suitable for display to users.

isBusSimulationFMU

true or false

Defines whether the respective FMU is a Bus Simulation FMU or not. The importer may use this information at the time of importing the FMU, depending on which System Compositions the FMUs are integrated into. If true, this FMU represents a Bus Simulation FMU. Default: false.

An example of a manifest file for this layered standard is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<fmiLayeredStandardManifest
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../schema/fmi3LayeredStandardBusManifest.xsd"
    xmlns:fmi-ls="http://fmi-standard.org/fmi-ls-manifest"
    fmi-ls:fmi-ls-name="org.fmi-standard.fmi-ls-bus"
    fmi-ls:fmi-ls-version="1.0.0"
    fmi-ls:fmi-ls-description="Layered Standard for the simulation of bus communication on a Physical Signal Abstraction or Network Abstraction based level."
    isBusSimulationFMU="false"/>

The manifest file shall be stored inside the FMU at the following path: /extra/org.fmi-standard.fmi-ls-bus/fmi-ls-manifest.xml.

3. Common Concepts

Physical Signal Abstraction and Network Abstraction layers represent different levels for the exchange of bus messages. Physical Signal Abstraction focuses primarily on the exchange of signal values, while Network Abstraction provides a complete way of implementing a virtual bus driver. Depending on the exporting tool, one of the abstraction layers is more "natural" to the FMU, while the other might have to be emulated with additional internal effort or an adapter (FMU) could be used. Importers, on the other hand, rarely require both abstraction layers for system level compositions, because the engineering tasks define the required level of abstraction for the network communication. FMUs may choose to only support one abstraction layer providing only the corresponding variables. However, for versatility, having FMUs capable of communicating on both abstraction layers is more convenient for users.

For both abstraction layers, the exchange of network data is implemented via variables.

In the case of the Physical Signal Abstraction, a separate variable of the respective type is created for each network signal to transfer. The network signals are structured via a PDU and frame hierarchy by using terminals.

In the case of the Network Abstraction, the bus is simulated using a separate, bus-specific protocol. The protocol consists of well defined Bus Operations that are used to provide a detailed simulation of network communication above the electrical bus level. These Bus Operations are exchanged between FMUs using binary variables.

For both abstraction layers, Clocks are used to indicate when network data is sent or received. Since Clocks are strictly related to the Event Mode, networked FMUs shall set the Co-Simulation attribute hasEventMode = "true" in the model description file.

The point in time when network data gets exchanged is defined by the Clock of the sending FMU. Such a communication point will be called Bus Communication Point.

While the values and semantics of Clocks are transparent, the exchange of Bus Operations via binary variables is opaque to the importer. The internal structure of these binary variables representing Bus Operations to implement the transport mechanism of the specific network technology is specified in this document. These Bus Operations do not just transport the network-specific payload but also carry protocol-specific status information. This status information allows, for example, the MCAL emulation of a virtual ECU to report back to the COM-stack if a send request was successful or not.

When executing an FMU with a fixed step size, multiple message sends may fall into the time-interval of one fmiDoStep call. In such a setup, the High-Cut signal variables will miss all but the last value sent, while Low-Cut FMUs will buffer all Bus Operations and exchange them after the fmiDoStep.

3.1. General Recommendations regarding Clocks

If triggered output Clocks are used, the importer must ensure to schedule and potentially roll-back FMUs that have advanced their fmi3DoStep past such a (surprising) triggered Clock activation from another FMU. It is strongly recommended to avoid using triggered output Clocks and to instead use time-based Clocks to avoid these complications and potential performance problems. For time-based Clocks, the event times are known before a simulation step is started, and the importer can adapt the next communicationStepSize for all networked FMUs accordingly.

A time-based Clock can be periodic or aperiodic. Both allow defining Bus Communication Points with fixed or variable distances. For a quick overview, the differences between the various time-based Clock types are listed in the following table. For a detailed specification of time-based Clocks please refer to the FMI standard.

Table 2. Time-based Clock properties.

Clock properties

intervalVariability

Description

periodic

constant

The Bus Communication Point interval is defined in the modelDescription.xml and is constant during simulation.

periodic

fixed

The Bus Communication Point interval gets fixed during Initialization Mode and stays fixed during simulation.

periodic

tunable

The Bus Communication Point interval can change in any Event Mode.

aperiodic

changing

The Bus Communication Point interval can change in any Event Mode if this Clock ticked.

aperiodic

countdown

The Bus Communication Point interval can change in any Event Mode, where the interval can also be unknown in some Event Mode.

[Selecting a suitable intervalVariability for sending Clocks allows the FMU (or better the exporting tool) to balance the accuracy and performance of its network communication:

- While aperiodic Clocks allow very accurate network simulations, frequently entering Event Mode might reduce the network simulation speed.

- Using periodic Clocks and queueing (or even dropping of intermediate) data to be transmitted reduces the number of Event Mode entries and might speeds up the simulation at the cost of simulation accuracy.

- One could use (structural) parameters to define the accuracy of aperiodic Clocks, allowing control of the simulation accuracy and performance with the same FMU.

Note: The statements regarding aperiodic and periodic Clocks and their impact on performance should be understood as general tendencies rather than universally valid truths, as other aspects such as baud rates and expected bus loads must be taken into account for a more precise estimate.]

3.2. System Compositions

This standard considers three possible communication architectures for bus communication. It should be explicitly noted at this point that the FMUs for integration in the respective use case do not necessarily have to be different, so that the same FMU can be integrated across all three communication architectures. The interface of the FMU to the importer is always the same, but a different subset of the features is actually used. Depending on the abstraction layer (Physical Signal Abstraction or Network Abstraction) and communication architectures, the feature set of the FMI-LS-BUS can vary, so that certain features are only available in specific combinations.

3.2.1. Direct Communication

The first option is to use a common FMU importer. For such a composition, the FMU importer does not require any special features for simulating buses, apart from supporting FMI variables, Clocks and terminals. The figure below illustrates the direct communication of two FMUs:

architecture direct connection
Figure 1. Direct communication of two FMUs.

The bus simulation can here be only idealized, i.e., the simulation of bus transmission times or arbitration, for example, is not supported. Such an ideal network differs from physical networks in the following ways (and potentially others):

  • Network congestion/bandwidth: Too many network frames sent for the bandwidth of the network.
    Here the network has infinite capacity.[3][4]

  • Network frame arbitration: Frames are sent on the wire according to network-specific priority rules.
    Here all frames are transmitted at the same time without delay.[4]

  • Protocol functions of higher levels: E.g. CAN request for retransmit is a specific protocol function.
    Here such specialties must be handled by a higher layer inside the FMU.[4]

  • Incoming buffer overflow: When an ECU receives more frames than its buffer can hold.
    Here the FMU will receive all frames, regardless of buffer size and would need to handle those limitations internally.[4]

Additionally, for Network Abstraction, direct bus communication is limited to exactly two FMUs. The simulation of Low-Cut bus communication between more than two FMUs is not possible in such a naive way.

3.2.2. Composition with dedicated Bus Simulation FMU

If more realistic network properties are required, a bus simulation component must be added.

Within this communication architecture the specified FMUs are connected to a dedicated Bus Simulation FMU. The Bus Simulation FMU is used to simulate the bus behavior (e.g., transmission timing) and differs depending on the bus type (e.g., for CAN, LIN, Ethernet or FlexRay) to simulate. In this context, a Bus Simulation FMU must provide enough Bus Terminals for all FMUs that are interconnected via a bus. The basic concept is that all FMUs that want to transmit network data provide them to the Bus Simulation FMU. The Bus Simulation FMU receives these network data and distributes them accordingly across the network. In this situation the Bus Simulation FMU can then acknowledge[4], delay[3][4], reject[4] or forward them to the recipients combined with a calculated transmission timing[3][4].

Also in this case, the FMU importer does not require any special features for bus simulation, apart from supporting FMI variables, Clocks and terminals. The figure below shows two FMUs which are connected to a specific Bus Simulation FMU. A total of three FMUs are executed using a common FMI 3.0 importer.

architecture bus simulation fmu
Figure 2. Bus simulation by using a dedicated Bus Simulation FMU.

This type of communication allows the simulation of all bus features, such as arbitration[4], failure injection[4] or the simulation of timing[3][4]. However, the supported bus features depend on the respective Bus Simulation FMU. The Bus Simulation FMU could expose (structural) parameters to configure these bus features. This communication architecture enables complex bus simulations to be implemented on lightweight FMU importers. An n:m bus communication of several FMUs is also permitted. Depending on the needs, it may be necessary to dynamically provision the Bus Simulation FMU so that it provides the appropriate number of inputs and outputs to allow all FMUs to be connected.

3.2.3. Importer with integrated Bus Simulation

In the third variant of the communication architecture, the bus simulation is built directly into the respective importer. The supported bus features are analogous to the Composition with dedicated Bus Simulation FMU use case. Actually, the difference is the type and manner of implementation while the FMI-LS-BUS interfaces remain stable.

The following figure illustrates two FMUs, which are integrated by an importer that directly supports this standard and needs no further Bus Simulation FMU.

architecture bus simulation importer
Figure 3. Bus simulation by using an importer with internal bus simulation support.

The usage of this architecture type allows the integration of this layered standard into an already existing simulator, which implements network communication with proprietary interfaces and e.g. allows the combination of manufacturer-specific solutions with FMI-LS-BUS implementing FMUs.

4. Physical Signal Abstraction (High-Cut)

This chapter describes the Physical Signal Abstraction or High-Cut in detail.

4.1. Overview

Physical Signal Abstraction allows an idealized exchange of unit-based variables between FMUs. Variables representing these physical signals are clocked to reflect the bus timing aspects of the information flow. Changes to these clocked variables always reach the destination. An FMU can take on specific roles here. This role can be a Bus Simulation FMU or an importer with bus simulation support on one side, and Network FMUs (e.g., virtual ECUs) on the other side (see System Compositions). To allow importers an easy distinction between these FMU roles, for Bus Simulation FMUs the attribute isBusSimulationFMU shall be set to true in the Manifest file.

The figure below shows an example architecture of a Physical Signal Abstraction. The signals (Signal 1…​8) are modeled as clocked variables of a specific type. The corresponding signals are structurally combined using Protocol Data Units (PDUs), which in turn are assigned to frames. The PDU and frame structuring is done via terminals (PDU A, B, C and Frame X, Y). The respective variables are connected to a Bus Simulation, which emulates them according to their own needs for e.g. according to accuracy.

high cut network fmu
Figure 4. Physical Signal Abstraction example architecture.

4.2. Signal Variables

To define the Physical Signal Abstraction layer, signal variables are used.

A signal variable carries the physical value of a network signal normally packaged inside a PDU or frame. The unit definition of the variable must match the one defined in the network description file, if provided.

Each network signal must be listed as a Terminal Member Variable of its corresponding PDU terminal.

In case multiplexed signals are present in a frame/PDU/container PDU: All signals/PDUs are present, but only the active signal according to the multiplex switch signal contains a valid value, all inactive variables have undefined values. [These values could even be outside their specified min-max range without fault.]

All signal variables are clocked to indicate when they have been sent/received, see Section 4.3.

4.3. Clocks

In order to use FMU input and output variables as transport layer for networks, Clocks are used to indicate the timing. The sending FMU uses a Clock to indicate the transmission of the corresponding frame or frames.

The Clock type (periodic or aperiodic) is defined by the sending FMU.

The Clocks of a receiving frame shall be triggered Clocks if they are to be driven by the respective Clock of the sending frame.
Alternatively, Clocks of a receiving frame can be periodic Clocks matching the relevant Clock of the sending frame, which causes them to be scheduled for the same time instances. [This may allow for more efficient simulation in the case that there exists a more or less static communications schedule, and more detailed simulation of timing variation is not needed.]

Signal variables belonging to frame BusName.FrameName must share the same causality (input or output).

4.4. Network Description Files

Standardized network description files may optionally be shipped with each FMU to describe properties of signals and frames, such as signal units, frame composition and trigger conditions. If these network description files are shipped, they must be placed into the /extra/org.fmi-standard.fmi-ls-bus folder. DBC, LDF, Fibex and ARXML files are allowed, e.g., Powertrain.dbc. The case-sensitive root name of the network description file must be used as network identifier in the Bus Terminal type and prefix in the variable names.

Multiple files can be specified, each one defining one network used by the FMU. This standard does not support composing one network from multiple network description files, even if using internal include mechanisms, it rather enforces the rule: One network - one file.

It is recommended to use ARXML over DBC files for CAN whenever possible, because the DBC standard lacks some key frame/PDU properties that were added only later using non-standard extensions with different dialects in use.

This document does not address potential open points of these description formats, it is assumed that such ambiguities will be handled elsewhere (e.g., message timing in the DBC format). This document does not address IP protection or copyright issues. These are technical and legal issues that need attention from standardization bodies of the referenced description formats, tool vendors and end users.

4.5. Terminal Definitions

This section defines terminals for Physical Signal Abstraction.

4.5.1. Bus Terminal

Each network connected to the FMU must be described in icons/terminalsAndIcons.xml as a <Terminal> element of <fmiTerminalsAndIcons><Terminals> that wraps all its frame terminals. The attribute name of the <Terminal> element must match the root name of its network description file if it exists [e.g., Powertrain, if the file is /extra/org.fmi-standard.fmi-ls-bus/Powertrain.dbc].

Attribute definitions
  • terminalKind must be org.fmi-ls-bus.network-terminal.

  • matchingRule must be bus.

  • name is the network name, e.g., Powertrain, see examples and constraints above.

Element definitions
  • All signal variables and Clocks related to the Physical Signal Abstraction in the modelDescription.xml must be covered by a <Terminal> element representing the network frame the signals belong to.

Annotation element
  • If a network description file is shipped with the specified FMU, there must be an <Annotation> element defining which node or nodes (as comma-separated list without spaces) of the network description file are wrapped inside the FMU. If the combination of nodes specified for this FMU turns a frame and its signals into both input and output because sending and receiving nodes are specified, only the sending (output) role will be defined in the FMU interface. Receiving such frames must then be handled internally to the FMU. If no network description file is shipped with the specified FMU the <Annotation> shall not exist.

4.5.2. Frame Terminal

Each frame listed in the network description file must be an element of its corresponding Bus Terminal.

Attribute definitions
  • terminalKind must be org.fmi-ls-bus.frame-terminal.

  • matchingRule must be bus.

  • name must match the frame name as defined in the network description file in /extra/org.fmi-standard.fmi-ls-bus.

Element definitions
  • There must be one PDU terminal element per PDU of this frame.

  • There must be one <TerminalMemberVariable> for the Clock this frame is connected to. The memberName of this variable must be TransmissionClock.

The Terminal Member Variable must have the same causality as all variables referenced in the PDU terminals included here.

4.5.3. PDU Terminal

Each PDU listed in the network description file must be an element of its corresponding frame terminal.

Attribute definitions
  • terminalKind must be org.fmi-ls-bus.pdu-terminal.

  • matchingRule must be bus.

  • name must match a PDU name of the network description file in /extra/org.fmi-standard.fmi-ls-bus, if given. For network types not natively referencing a "PDU", like CAN, a synthetic PDU with the same name as its frame is inserted.

Element definitions
  • There must be one <TerminalMemberVariable> per signal of this PDU.

All TerminalMemberVariables must have the same causality of either input or output.

4.5.4. Terminal Member Variable for Signals

PDU terminals list all the contained signals as <TerminalMemberVariable>.

Attribute definitions
  • variableName refers to the input or output variable name of the FMU. These variables represent the Physical Signal Abstraction layer. Unless there are other requirements, it is recommended to build the variable names as follows: BusName.FrameName.PDUName.SignalName, e.g., Powertrain.tcuSensors.tcuSensors.vCar. This approach automatically provides unique names for all bus-related variables, and can also be used for Clocks, to allow automatic grouping by non-terminal-aware tools.

  • memberName is the SignalName as given in the network description file, e.g., vCar, if given. This is redundant information but simplifies signal name extraction.

  • variableKind is signal.

4.6. Examples

The following excerpts from files are used throughout this document as examples and should illustrate how the different concepts relate.

4.6.1. CAN Bus Databases (DBC)

The following partial DBC file lists merely the CAN message (frame) structure. Signal trigger conditions are not included because they have no bearing on this standard.

Example Powertrain.dbc file.
...
BO_ 256 tcuSensors: 4 TCU
 SG_ vCar :          0|16@1- (32,0)  [-500|500] "km/h" ECU
 SG_ oilTemp :      16|9@1-  (2,50)  [-50|150]  "Degree C" ECU

BO_ 257 tcuState: 2 TCU
 SG_ state :         0|2@1+  (1,0)   [ 0|2] "-" ECU
 SG_ gear :          2|4@1-  (1,0)   [-2|6] "-" ECU
 SG_ targetGear :    6|4@1-  (1,0)   [-2|6] "-" ECU

BO_ 512 ecuState: 4 ECU
 SG_ accelPedal :    0|8@1+ (2,0)   [0|100]   "%" TCU
 SG_ k15 :           8|1@1+ (1,0)   [0|1]     "-" TCU
 SG_ oilTemp :       9|9@1- (2,50)  [-50|150] "Degree C" TCU
 SG_ radiatorTemp : 18|9@1- (2,50)  [-50|150] "Degree C" TCU
...

The modelDescription.xml excerpt listed below shows which variables would exist for the Powertrain.dbc shown above.

Example modelDescription.xml for ECU node.
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0" modelName="Network4FMI"
    instantiationToken="Network4FMI">
  <ModelVariables>
    <Clock name="Powertrain.tcuSensors_Clock" valueReference="1007"
        causality="input" variability="discrete" intervalVariability="triggered"/>
    <Float64 name="Powertrain.tcuSensors.tcuSensors.vCar" valueReference="1005"
        causality="input" variability="discrete" start="0" clocks="1007"/>
    <Float64 name="Powertrain.tcuSensors.tcuSensors.oilTemp" valueReference="1006"
        causality="input" variability="discrete" start="20" clocks="1007"/>

    <Clock name="Powertrain.tcuState_Clock" valueReference="1011"
        causality="input" variability="discrete" intervalVariability="triggered"/>
    <Float64 name="Powertrain.tcuState.tcuState.state" valueReference="1008"
        causality="input" variability="discrete" start="0" clocks="1011"/>
    <Float64 name="Powertrain.tcuState.tcuState.gear" valueReference="1009"
        causality="input" variability="discrete" start="0" clocks="1011"/>
    <Float64 name="Powertrain.tcuState.tcuState.targetGear" valueReference="1010"
        causality="input" variability="discrete" start="0" clocks="1011"/>

    <Clock name="Powertrain.ecuState_Clock" valueReference="1016"
        causality="output" variability="discrete" intervalVariability="triggered"/>
    <Float64 name="Powertrain.ecuState.ecuState.accelPedal" valueReference="1012"
        causality="output" variability="discrete" start="0" clocks="1016"/>
    <Float64 name="Powertrain.ecuState.ecuState.k15" valueReference="1013"
        causality="output" variability="discrete" start="0" clocks="1016"/>
    <Float64 name="Powertrain.ecuState.ecuState.oilTemp" valueReference="1014"
        causality="output" variability="discrete" start="0" clocks="1016"/>
    <Float64 name="Powertrain.ecuState.ecuState.radiatorTemp" valueReference="1015"
        causality="output" variability="discrete" start="0" clocks="1016"/>
  </ModelVariables>
  <ModelStructure>
  </ModelStructure>
</fmiModelDescription>

The following file shows the Bus Terminal definition representing the network and frame structure defined with Powertrain.dbc above. The name of the frame terminal and the PDU terminal are derived from the DBC attribute _BO. The SignalName, and so the resulting memberName, is derived from the DBC attribute _SG.

Example terminalsAndIcons.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<fmiTerminalsAndIcons fmiVersion="3.0">
  <Terminals>
    <Terminal terminalKind="org.fmi-ls-bus.network-terminal" name="Powertrain" matchingRule="bus"
        description="Powertrain CAN bus defined with dbc file">
      <Terminal terminalKind="org.fmi-ls-bus.frame-terminal" name="tcuSensors" matchingRule="bus">
        <TerminalMemberVariable variableKind="signal"
          variableName="Powertrain.tcuSensors_Clock" memberName="TransmissionClock" />
        <Terminal terminalKind="org.fmi-ls-bus.pdu-terminal" name="tcuSensors" matchingRule="bus">
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.tcuSensors.tcuSensors.vCar" memberName="vCar" />
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.tcuSensors.tcuSensors.oilTemp" memberName="oilTemp" />
        </Terminal>
      </Terminal>
      <Terminal terminalKind="org.fmi-ls-bus.frame-terminal" name="tcuState" matchingRule="bus">
        <TerminalMemberVariable variableKind="signal"
          variableName="Powertrain.tcuState_Clock" memberName="TransmissionClock" />
        <Terminal terminalKind="org.fmi-ls-bus.pdu-terminal" name="tcuState" matchingRule="bus">
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.tcuState.tcuState.state" memberName="state" />
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.tcuState.tcuState.gear" memberName="gear" />
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.tcuState.tcuState.targetGear" memberName="targetGear" />
        </Terminal>
      </Terminal>
      <Terminal terminalKind="org.fmi-ls-bus.frame-terminal" name="ecuState" matchingRule="bus">
        <TerminalMemberVariable variableKind="signal"
          variableName="Powertrain.ecuState_Clock" memberName="TransmissionClock" />
        <Terminal terminalKind="org.fmi-ls-bus.pdu-terminal" name="ecuState" matchingRule="bus">
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.ecuState.ecuState.accelPedal" memberName="accelPedal" />
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.ecuState.ecuState.k15" memberName="k15" />
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.ecuState.ecuState.oilTemp" memberName="oilTemp" />
          <TerminalMemberVariable variableKind="signal"
            variableName="Powertrain.ecuState.ecuState.radiatorTemp" memberName="radiatorTemp" />
        </Terminal>
      </Terminal>
      <Annotations>
        <Annotation type="ECU" />
      </Annotations>
    </Terminal>
  </Terminals>
</fmiTerminalsAndIcons>

4.6.2. AUTOSAR

The following AUTOSAR system extract (in ARXML format) shows the mapping of an AUTOSAR Frame-Triggering, PDU-Triggering and Signal-Triggering structure within the Physical Signal Abstraction.

Incomplete example AUTOSAR Powertrain.arxml system extract file.
...
<AR-PACKAGE>
  <SHORT-NAME>SystemExtract</SHORT-NAME>
  <ELEMENTS>
    <CAN-CLUSTER>
      <SHORT-NAME>PowertrainCluster</SHORT-NAME>
      <CAN-CLUSTER-VARIANTS>
        <CAN-CLUSTER-CONDITIONAL>
          <PHYSICAL-CHANNELS>
            <CAN-PHYSICAL-CHANNEL>
              <SHORT-NAME>Powertrain</SHORT-NAME>
              <FRAME-TRIGGERINGS>
                <CAN-FRAME-TRIGGERING>
                  <SHORT-NAME>tcuSensors_FrameTriggering</SHORT-NAME>
                  <FRAME-REF>/.../Frames/tcuSensors</FRAME-REF>
                  <PDU-TRIGGERINGS>
                    <PDU-TRIGGERING-REF-CONDITIONAL>
                      <PDU-TRIGGERING-REF>/.../tcuSensors_PduTriggering</PDU-TRIGGERING-REF>
                    </PDU-TRIGGERING-REF-CONDITIONAL>
                  </PDU-TRIGGERINGS>
                  <IDENTIFIER>256</IDENTIFIER>
                </CAN-FRAME-TRIGGERING>
              </FRAME-TRIGGERINGS>
              <I-SIGNAL-TRIGGERINGS>
                <I-SIGNAL-TRIGGERING>
                  <SHORT-NAME>vCar_ISignalTriggering</SHORT-NAME>
                  <I-SIGNAL-REF>/.../ISignals/vCar</I-SIGNAL-REF>
                </I-SIGNAL-TRIGGERING>
                <I-SIGNAL-TRIGGERING>
                  <SHORT-NAME>oilTemp_ISignalTriggering</SHORT-NAME>
                  <I-SIGNAL-REF>/.../ISignals/oilTemp</I-SIGNAL-REF>
                </I-SIGNAL-TRIGGERING>
              </I-SIGNAL-TRIGGERINGS>
              <PDU-TRIGGERINGS>
                <PDU-TRIGGERING>
                  <SHORT-NAME>tcuSensors_PduTriggering</SHORT-NAME>
                  <I-PDU-REF>/.../PDUs/tcuSensors</I-PDU-REF>
                  <I-SIGNAL-TRIGGERINGS>
                    <I-SIGNAL-TRIGGERING-REF-CONDITIONAL>
                      <I-SIGNAL-TRIGGERING-REF>/.../vCar_ISignalTriggering</I-SIGNAL-TRIGGERING-REF>
                    </I-SIGNAL-TRIGGERING-REF-CONDITIONAL>
                    <I-SIGNAL-TRIGGERING-REF-CONDITIONAL>
                      <I-SIGNAL-TRIGGERING-REF>/.../oilTemp_ISignalTriggering</I-SIGNAL-TRIGGERING-REF>
                    </I-SIGNAL-TRIGGERING-REF-CONDITIONAL>
                  </I-SIGNAL-TRIGGERINGS>
            ...
  </ELEMENTS>
</AR-PACKAGE>
...

The modelDescription.xml excerpt listed below shows which variables would exist for the Powertrain.arxml shown above.

Example modelDescription.xml for ECU node.
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0" modelName="Network4FMI"
    instantiationToken="Network4FMI">
  <ModelVariables>
    <Clock name="PowertrainCluster.Powertrain.tcuSensors_FrameTriggering_Clock" valueReference="1007"
        causality="input" variability="discrete" intervalVariability="triggered"/>
    <Float64 name="PowertrainCluster.Powertrain.tcuSensors.vCar_ISignalTriggering" valueReference="1005"
        causality="input" variability="discrete" start="0" clocks="1007"/>
    <Float64 name="PowertrainCluster.Powertrain.tcuSensors.oilTemp_ISignalTriggering" valueReference="1006"
        causality="input" variability="discrete" start="20" clocks="1007"/>
  </ModelVariables>
  <ModelStructure>
  </ModelStructure>
</fmiModelDescription>

The following file shows the Bus Terminal definition representing the network and frame structure defined with Powertrain.arxml above. The name of the frame terminal is derived from the ShortName attribute of the respective AUTOSAR frame. The name of the PDU terminal is derived from the ShortName attribute of the respective AUTOSAR PDU. The SignalName, and so the resulting memberName, is derived from the respective AUTOSAR ISignal. The BusName is derived from the AUTOSAR Cluster ShortName concatenated via a . character with the AUTOSAR Physical Channel ShortName.

Example terminalsAndIcons.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<fmiTerminalsAndIcons fmiVersion="3.0">
  <Terminals>
    <Terminal terminalKind="org.fmi-ls-bus.network-terminal" name="Powertrain" matchingRule="bus"
        description="Powertrain CAN bus defined by an AUTOSAR system extract">
      <Terminal terminalKind="org.fmi-ls-bus.frame-terminal" name="tcuSensors" matchingRule="bus">
        <TerminalMemberVariable variableKind="signal"
          variableName="PowertrainCluster.Powertrain.tcuSensors_Clock" memberName="TransmissionClock" />
        <Terminal terminalKind="org.fmi-ls-bus.pdu-terminal" name="tcuSensors" matchingRule="bus">
          <TerminalMemberVariable variableKind="signal"
            variableName="PowertrainCluster.Powertrain.tcuSensors.vCar_SignalTriggering" memberName="vCar" />
          <TerminalMemberVariable variableKind="signal"
            variableName="PowertrainCluster.Powertrain.tcuSensors.oilTemp_SignalTriggering" memberName="oilTemp" />
        </Terminal>
      </Terminal>
      <Annotations>
        <Annotation type="ECU" />
      </Annotations>
    </Terminal>
  </Terminals>
</fmiTerminalsAndIcons>

4.7. Limitations

Physical Signal Abstraction maps several network protocols onto co-simulation variables as transport layer simulating in many ways an ideal network. Such an ideal network differs from physical networks in the following ways (and potentially others):

  • Network frame arbitration: Frames are sent on the wire according to network-specific priority rules.
    Here all frames are transmitted at the same time without delay.

  • Network congestion/bandwidth: Too many network frames sent for the bandwidth of the network.
    Here the network has infinite capacity.
    If network properties are required, a bus simulation component must be added or included with the importer.

  • Protocol functions of higher levels: I.e. CAN request for retransmit is a specific protocol function.
    Here such specialties must be handled by the first layer inside the FMU.

  • Incoming buffer overflow: When an ECU receives more frames than its buffer can hold.
    Here the FMU will receive all frames, regardless of buffer size and would need to handle those limitations internally.

  • Network protocols allow frames to be sent from more than one node.
    Here this is also possible, with output variables for frames (and their signals) that are sent by more than one FMU. This requires the importer to handle the case when multiple source FMUs are sending the same frame. Importers must know how to handle this, just like they must know how to handle flow variables according to Kirchhoff’s law.

5. Network Abstraction (Low-Cut)

This chapter describes the Network Abstraction or Low-Cut in detail.

5.1. Overview

The Network Abstraction allows the implementation of virtual bus drivers within FMUs on the level of the hardware abstraction layer. Exchanging data in terms of the Layered Standard Bus Protocol via variables grouped by a dedicated Bus Terminal (see Variables), allows the implementation of bus simulations in a wide range from idealized up to detailed behavior, including e.g., timing, arbitration, error, status and other effects. During simulation, the network communication is controlled by send and receive Bus Operations. Based on these operations, FMUs implementing this layered standard have to react depending on their role as specified in this document. This role can be a Bus Simulation FMU or an importer with bus simulation support on one side, and Network FMUs (e.g., virtual ECUs) on the other side (see System Compositions). To allow importers an easy distinction between these FMU roles, for Bus Simulation FMUs the attribute isBusSimulationFMU shall be set to true in the Manifest file.

In general, the Layered Standard Bus Protocol is bus-type-specific, but there are some similarities among different bus types. Bus communication often follows a Transmit/Confirm pattern, where a Network FMU sends a Transmit operation containing the network message as payload. Depending on the System Composition, the importer forwards the Transmit operation either directly to receiving FMUs or to a dedicated bus simulation. The Bus Simulation then might delay the transfer of the Transmit operation to the receiving FMUs to simulate timing behavior, before sending a bus-specific Confirm operation back to the sending FMU.

transmit messages
Figure 5. Transmission overview.

The point in time at which FMUs will (potentially) send new network messages can be given to the importer in advance with the proper Clock type. Based on these times, the importer has to calculate the next communicationStepSize for all networked FMUs. For simulating bus communication with timing effects, the FMUs should set the Co-Simulation attribute canHandleVariableCommunicationStepSize = "true".

bus simulation example
Figure 6. Example for network simulation with timing behavior.

For simplification reasons or if a detailed bus simulation is not desired, fixed-step size FMUs can also be used with Network Abstraction. However, depending on the chosen simulation step-size, delay effects of the bus simulation have to be taken into account. Compositions with fixed-step size and variable-step size FMUs require the decoupling of the Bus Simulation logic and the Bus Simulation timing. This decoupling is realized by queuing Tx/Rx Bus Operations inside the Bus Simulation as well as queuing Tx Bus Operations inside Network FMUs. By queuing Bus Operations, System Compositions with variable-step size FMUs as well as fixed-step size FMUs can be simulated together without affecting each other.

5.2. Layered Standard Bus Protocol

The Layered Standard Bus Protocol allows the transmission of Bus Operations between FMUs in binary form via Clocks and clocked variables (see Variables). Depending on their role (Network or Bus Simulation), FMUs have to respond to received operations as specified by this layered standard. Operations and the reaction on receipt are bus-type-specific and therefore described in the bus-specific chapters. However, the description follows a uniform structure and consists of two parts, an overview table and a detailed description of all operations.

The overview table represents the binary format of operations and is structured as follows:

  • OP Code: The operation code defines the unique value of the operation. It consists of four bytes in length.

  • Length: A four byte total data length (OP Code + Length + Arguments) field following the OP Code. For operation with variable size arguments, the total length can vary in value at runtime.

  • Arguments: The arguments of the respective operation. The number of arguments is defined for each operation within this standard. For arguments with a variable length, an argument pair composed of length and data is used.

The following table shows an example of an operation definition. The name is OperationName and has the OP Code 0x01. The operation has three arguments Arg1 (2 bytes long), Arg2_Length (1 byte long), Arg2_Data (<Arg2Length> bytes long), whereby argument 2 and argument 3 form a coherent variable length argument.

Table 3. Definition of an operation within the Layered Standard Bus Protocol.

Operation Type

Operation Content

OP Code

Length

Specific Content

OperationName

0x01

10 + <Arg2_Length>

1 byte Arg1

1 byte Arg2_Length

<Arg2_Length> byte Arg2_Data

Additionally, all operations are described separately in detail in the following structure:

Table 4. Operation example within the Layered Standard Bus Protocol.

Name

Name of the operation (e.g., OperationName)

Description

Contains a description of the specified operation.

OP Code [hex]

OP code of the operation (e.g., 0x01)

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code of the specified operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 10 + <Arg2_Length>.

Arg1

1 byte

The first argument of the operation.

Arg2_Length

1 byte

Contains the length of the Arg2_Data argument in bytes.

Arg2_Data

n byte

The second argument of the operation.

Behavior

Describes the behavior of a Network FMU and the Bus Simulation in the context of this operation. e.g., The specified operation shall be produced by a Network FMU and consumed by the Bus Simulation.

Remarks:

  • Numbers shall be transmitted with little-endian byte order.

  • Since the standard allows concatenating multiple operations (see Tx/Rx Data Variables), the Length field is introduced to allow the implementation of a generic parser for received operations.

A CAN frame will serve as a concrete example. Sending a CAN frame is represented by the Bus Operation: CAN Transmit. Since the FMI-LS-BUS describes the simulation of network communication above the electrical level, not all content of a CAN frame is relevant. The corresponding argument values ​​do not have to be analogous to those of the original frame representation. Argument values can be transformed, i.e., presented in a different form, for easier use. Figure 7 illustrates the mapping between the FMI-LS-BUS CAN Transmit Bus Operation and a Standard CAN Data Frame. The information that can be mapped directly is shown in green. The yellow representation describes transformed values and the information shown in red is not required/used.

bus operation can frame mapping example
Figure 7. Mapping between the FMI-LS-BUS CAN Transmit Bus Operation and a Standard CAN Data Frame.

5.2.1. Format Error

A Format Error operation will be sent by a network participant if a corrupt Bus Operation was received. A corrupt Bus Operation is an operation that does not match the expected format, e.g. an unknown OP Code or an operation with an invalid length.

Table 5. Detailed description of the Format Error operation.

Name

Format Error

Description

Represents a generic format operation error, which can be initiated by every operation. This error shall be used when generally encountering a problem with the content of an operation.

OP Code [hex]

0x01

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code of the specified operation. For this operation, the OP Code always has the value 0x01 within all bus types.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 10 + Length of Data argument in bytes.

Data Length

2 bytes

Specifies the length of the Data argument in bytes.

Data

n byte

Stores the complete binary data of the operation that caused the specified Format Error.

Behavior

The specified operation shall be produced and consumed by Network FMUs and the Bus Simulation.

5.2.2. Provided C Implementation

To facilitate the implementation of Low Cut FMUs, C header files with implementations for Bus Operations are provided:

  • fmi3LsBus.h provides general macros, types and structures for common Bus Operations. These header files apply to all supported bus types of the layered standard.

  • fmi3LsBusUtil.h provides common utility macros and structures for all supported bus types.

  • fmi3LsBusCan.h provides macros, types and structures of Bus Operations for CAN, CAN FD and CAN XL.

  • fmi3LsBusUtilCan.h provides CAN, CAN FD and CAN XL explicit utility macros.

  • fmi3LsBusFlexRay.h provides macros, types and structures of Bus Operations for FlexRay.

  • fmi3LsBusUtilFlexRay.h provides FlexRay explicit utility macros.

  • fmi3LsBusEthernet.h provides macros, types and structures of Bus Operations for Ethernet.

  • fmi3LsBusUtilEthernet.h provides Ethernet explicit utility macros.

5.2.3. Basic Type Definitions

The following basic types are defined for this standard, which apply to all supported buses. These basic types are used in the bus-specific parts within the operation definitions as operation arguments.

The following values for the boolean basic type are defined:

Table 6. Overview of the available boolean values.

Boolean

Value

Description

FALSE

0x00

Describes the boolean value: False.

TRUE

0x01

Describes the boolean value: True.

5.3. Variables

This section explains how layered standard bus protocol operations are sent and received by FMUs using Clocks and clocked variables [5].
While Tx Clock and Rx Clock are used for scheduling and time synchronization, Tx/Rx Data Variables are used to carry Bus Operations in binary form.

  • The Rx_Data variable is clocked by the Rx_Clock Clock, both with causality set to input.

  • The Tx_Data variable is clocked by the Tx_Clock Clock.

  • The causality of the Tx_Data variable shall be output.

  • The causality of Tx_Clock depends on the selected Clock type (see Tx Clocks).

Both variables (and their corresponding Clocks) must be members of its corresponding Bus Terminal.

5.3.1. Tx Clocks

As described in the FMI 3.0 specification, Clocks are used to synchronize events between the importer and across FMUs.

[Note: The Clock type of Tx_Clock can influence the bus simulation significantly - the differences should be taken into account.]

5.3.1.1. Time-based Tx Clocks

For time-based Clocks, the event times are known before a simulation step is started, and the importer can adapt the next communicationStepSize for all networked FMUs accordingly.

Figure 8 illustrates the operating principle of the exchange of Bus Operations using a time-based Tx_Clock with intervalVariability=countdown. The network topology is shown on the left part and the corresponding data flow on the right part of the figure. In this example FMU 1 and FMU 2 are communicating via a Bus Simulation. Each of them have a Bus Terminal where the specified Bus Operations are exchanged. Within the first communication point (first black dot), FMU 1 announces the time point when it wants to transmit data by setting the interval and the interval qualifier of the countdown Tx_Clock. The importer will then call the fmi3DoStep functions of the FMUs with a corresponding communication step size to hit the requested time point (first red dot). In the Event Mode the Bus Operation (the clocked binary variable) is then passed from FMU 1 to the Bus Simulation. The Bus Simulation itself also uses a countdown Tx_Clock and announces a point in the future at which the Bus Operation should be transmitted to FMU 2. The interval provided by the Bus Simulation might consider effects of the bus like the actual transmission time, but the interval could even be zero in case of an ideal bus abstraction. When the corresponding Tx_Clock Clock becomes active, the Bus Operation is passed from the Bus Simulation to FMU 2.

low cut communication points
Figure 8. Example Bus Communication Points announced by time-based aperiodic countdown Tx_Clock.

The announced Tx time however does not mean that a Bus Operation really has to be transferred, but that the connected networked FMUs should enter the Event Mode at that time. An importer has to determine proper communication step sizes to synchronize networked FMUs at the announced Tx time.

[Note: During simulation it can happen that no Tx_Data has to be transferred to the Rx_Data variable at the announced Tx time. In this case the returned 'valueSize' of the Tx_Data variable is 0.]

Although the causality of a time-based Tx_Clock and a triggered Rx_Clock are each input, it is allowed to connect both, since a time-based Clock of an FMU is considered only to be a request to the importer to provide a corresponding Clock source.

low cut time based port connection
Figure 9. Consideration of time-base Tx_Clock connections.

However, because of the common Clock source, both Clocks (Rx_Clock and Tx_Clock) might get active at the same time. To make sure that the Rx_Data variable is set properly, an importer has to activate the Rx_Clock respecting the Tx_Data and Rx_Data dependency.

[Note: For clarity, a connecting line between Tx_Clock and Rx_Clock is always shown in figures of this document.]

Network FMUs using a time-based Tx_Clock should set the Co-Simulation attribute canHandleVariableCommunicationStepSize = "true" in the model description file, since fmi3DoStep is typically called with variable communicationStepSize.

5.3.1.2. Triggered Tx Clocks

A triggered Clock basically allows signalling events when returning from fmi3DoStep either by using an Early Return or when the requested communication point at \(t_{i+1}\) was reached. Since signaling Tx_Clock events with an early return at \(t < t_{i+1}\) would require to set connected networked FMUs back in time to reach Bus Communication Points synchronously, a triggered Tx_Clock must only be set when returning from fmi3DoStep with the earlyReturn argument set to fmi3False. In consequence, Bus Communication Points and regular communication points coincide and take place at the same time. The time of a Bus Communication Point can therefore not be defined independently, but is given by the importer. Pending Tx data shall be signaled by returning from fmi3DoStep with the eventHandlingNeeded arguments set to fmi3True.

low cut communication with triggered tx clock
Figure 10. Triggered Tx_Clock/Rx_Clock connection.

5.3.2. Rx Clocks

The input Clocks (Rx_Clock) shall be triggered Clocks.

5.3.3. Tx/Rx Data Variables

The Tx_Data/Rx_Data variables are of type fmi3Binary and may contain zero, one or multiple Bus Operations, as sent or received by the FMU. If no Bus Operations shall be sent by a specified Network FMU at a given Bus Communication Point, the size of the corresponding binary Tx_Data variable shall be set to zero. A sending FMU can choose how many Bus Operations are buffered and/or for how long Bus Operations are buffered before it indicates that the corresponding time based Clock should be activated or the corresponding triggered Clock get triggered. This allows senders to trade accuracy for speed: Buffering more and interrupting the simulation less will lead to faster simulations, but less accurate timing of the network communication.

5.3.4. MIME Types

Every binary variable has a mimeType, which indicates the type of data passed as a binary. This type indicates which specific bus type is involved. It ensures that only bus types of the same type can be interconnected, since FMI only allows the connection of two MIME types of the same binary variables. The following table lists the MIME types to use for the Tx/Rx data variables within a Bus Terminal:

Table 7. Overview of the available MIME types for the supported bus types.
MIME type Description

application/org.fmi-standard.fmi-ls-bus.can; version="1.0.0"

Binary variables simulating a CAN network including CAN, CAN FD and CAN XL

The version of a bus type is defined in the version parameter of the MIME type. The MIME type and the associated versioning help importers to detect incompatible bus types. The version number marks the set of available operations for a specified bus type. The versioning follows the rules of semantic versioning, as defined in [PW13].

5.4. Terminal Definitions

A schematic representation of an FMU with a Bus Terminal is shown in the following figure:

bus terminal
Figure 11. Frame variables and terminals.

5.4.1. Bus Terminal

Each network connected to the FMU must be described in icons/terminalsAndIcons.xml as a <Terminal> element of <fmiTerminalsAndIcons><Terminals>. There shall be exactly one <Terminal> element for each network of the FMU.

Attributes of a Bus Terminal
  • terminalKind must be org.fmi-ls-bus.network-terminal.

  • matchingRule must be org.fmi-ls-bus.transceiver.
    Terminal member variables with memberName Tx_{Data|Clock} variables shall be connected to Terminal member variables with memberName Rx_{Data|Clock}, and vice versa.
    The variable type shall be equal.

  • name should be the network name, e.g., "Powertrain", see example.

Elements of a Bus Terminal
  • A Bus Terminal shall contain four <TerminalMemberVariable> elements with the following memberName attributes:
    Tx_Data, Tx_Clock, Rx_Data and Rx_Clock.
    The memberName attribute is used to define the role of the referred variable in the Bus Terminal.
    The variableKind of these four members must be signal.

  • The use of the same variable within different Bus Terminals is not allowed.

  • Bus systems can add specific configuration parameters in a nested Configuration Terminal.
    Empty Configuration Terminals can be omitted.

5.4.1.1. Configuration Terminal
Attributes of the nested Configuration Terminal
  • name must be "Configuration".

  • terminalKind must be org.fmi-ls-bus.network-terminal.configuration.

  • matchingRule must be bus.

5.4.2. Example

The following excerpts from files are used throughout this document as examples and illustrate how the different concepts relate.

Example modelDescription.xml for ECU node.
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription fmiVersion="3.0" modelName="Network4FMI"
    instantiationToken="Network4FMI">
  <ModelVariables>
    <Clock name="Powertrain.Rx_Clock" valueReference="1002"
        causality="input" variability="discrete" intervalVariability="triggered"/>
    <Binary name="Powertrain.Rx_Data" valueReference="1001" causality="input"
        mimeType="application/org.fmi-standard.fmi-ls-bus.can; version=&quot;1.0.0&quot;" variability="discrete" clocks="1002"/>
    <Clock name="Powertrain.Tx_Clock" valueReference="1004"
        causality="input" variability="discrete" intervalVariability="changing"/>
    <Binary name="Powertrain.Tx_Data" valueReference="1003" causality="output"
        mimeType="application/org.fmi-standard.fmi-ls-bus.can; version=&quot;1.0.0&quot;" variability="discrete" clocks="1004"/>
    <Boolean name="BusNotification" valueReference="1005" causality="parameter" variability="fixed" start="false"/>
  </ModelVariables>
  <ModelStructure>
  </ModelStructure>
</fmiModelDescription>

The following file shows the Bus Terminal-related definition:

Example terminalsAndIcons.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<fmiTerminalsAndIcons fmiVersion="3.0">
  <Terminals>
    <Terminal terminalKind="org.fmi-ls-bus.network-terminal" name="Powertrain" matchingRule="org.fmi-ls-bus.transceiver"
        description="Powertrain CAN Bus Terminal definition">
      <TerminalMemberVariable variableKind="signal"
        variableName="Powertrain.Rx_Clock" memberName="Rx_Clock" />
      <TerminalMemberVariable variableKind="signal"
        variableName="Powertrain.Rx_Data" memberName="Rx_Data" />
      <TerminalMemberVariable variableKind="signal"
        variableName="Powertrain.Tx_Clock" memberName="Tx_Clock" />
      <TerminalMemberVariable variableKind="signal"
        variableName="Powertrain.Tx_Data" memberName="Tx_Data" />
      <Terminal terminalKind="org.fmi-ls-bus.network-terminal.configuration" name="Configuration" matchingRule="bus">
        <TerminalMemberVariable variableKind="signal"
          variableName="BusNotification" memberName="BusNotification" />
      </Terminal>
    </Terminal>
  </Terminals>
</fmiTerminalsAndIcons>

5.5. Bus-Specific Details

For each supported bus type, the Layered Standard Bus Protocol is defined. This chapter describes the operations of the Layered Standard Bus Protocol to enable the simulation of supported bus types.

5.5.1. CAN, CAN FD, CAN XL

This chapter describes the Layered Standard Bus Protocol for CAN, CAN FD and CAN XL. The various CAN standards CAN, CAN FD and CAN XL are considered together, because they are very similar and can also be combined in certain scenarios.

5.5.1.1. Overview

To simulate CAN, CAN FD and CAN XL buses, CAN-specific operations are specified based on the Layered Standard Bus Protocol. Overall, the following groups of operations exists:

  • Transmit: This group of operations is used to simulate a frame transmission. There are three specializations of this operation, one each for CAN, CAN FD and CAN XL frames.

  • Confirm: An acknowledgment of transmitted CAN frames is defined by the CAN standard. This kind of operation is used to simulate this behavior.

  • Error: This group of operations is used for protocol format errors and to simulate bus failures. For example, the failure of a transmission can be indicated.

  • Arbitration Lost: The operation is used by Bus Simulations to inform Network FMUs that a frame could not be transmitted immediately.

  • Configuration: This operation enables the configuration of bus-specific parameters and options that are required to simulate the bus behavior properly. For example, it allows the specification of the baud rate or influencing the buffer behavior.

  • Status: This operation is used by Networked FMUs to inform Bus Simulations about the internal state (Active/Passive/Bus-Off) which concerns the reaction on bus errors.

  • Wake up: CAN supports wake up and sleep scenarios. Normally there are two ways to wake up from sleep mode: A local wake up on a specified wake-up pin, or a wake-up on the CAN bus via a CAN specific wake-up pulse. This operation is used to simulate triggering a wake-up from bus side.

The following table gives a detailed overview of the available operations. It shows all operations and the arguments they contain.

Table 8. Overview of the available operations for CAN, CAN FD and CAN XL.

Operation Name

Operation Content

OP Code

Length

Specific Content

Format Error

0x01

:= 10 + n
(4 bytes)

DL [6]
(2 bytes)

Data
(n bytes)

CAN Transmit

0x10

:= 16 + DL
(4 bytes)

ID
(4 bytes)

Ide
(1 byte)

Rtr
(1 byte)

DL
(2 bytes)

Data
(n bytes)

CAN FD Transmit

0x11

:= 17 + DL
(4 bytes)

ID
(4 bytes)

Ide
(1 byte)

Brs
(1 byte)

Esi
(1 byte)

DL
(2 bytes)

Data
(n bytes)

CAN XL Transmit

0x12

:= 22 + DL
(4 bytes)

ID
(4 bytes)

Ide
(1 byte)

Sec
(1 byte)

SDT
(1 byte)

VCID
(1 byte)

AF
(4 bytes)

DL
(2 bytes)

Data
(n bytes)

Confirm

0x20

:= 12
(4 bytes)

ID
(4 bytes)

Arbitration Lost

0x30

:= 12
(4 bytes)

ID
(4 bytes)

Bus Error

0x31

:= 15
(4 byte)

ID
(4 bytes)

Error Code
(1 byte)

Error Flag
(1 byte)

Is Sender
(1 byte)

Configuration

0x40

<Length>
(4 bytes)

Kind
(1 byte)

Dynamic Part

Status

0x41

:= 9
(4 bytes)

Status
(1 byte)

Wakeup

0x42

:= 8
(4 bytes)

---

5.5.1.2. Operations

This section defines the specified operations for CAN, CAN FD and CAN XL. The following tables provide an overview of all operations and specifies the position and length of the corresponding arguments, as well as the respective flow direction.

5.5.1.2.1. Transmit

There are three types of Transmit operations for transmission of CAN, CAN FD and CAN XL frames.

Table 9. Detailed description of the CAN Transmit operation.

Name

CAN Transmit

Description

Initiates the transmission of CAN frames.

OP Code [hex]

0x10

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x10) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 16 + Data Length.

ID

4 bytes

The specified ID of the CAN message. The ID must be considered here as a purely numerical value. This means that there is no need for separate segmentation between the 11-bit base CAN identifier and an 18-bit CAN identifier extension information that is known from the CAN protocol. Additional information such as Ide is also not part of the ID, but is treated separately.

Ide

1 byte

Specified whether the ID should be transmitted as standard (11-bit) or extended (29-bit) message identifier. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Rtr

1 byte

Specifies whether the given frame represents a Remote Transmission Request frame. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Data Length

2 bytes

Specifies the length of the Data argument in bytes. Note: The argument value describes the actual data length and not the CAN Data Length Code (DLC).

Data

n bytes

Stores the given frame data to transfer, whereby the valid length of the data depends on the CAN Format. Note: The value of this argument also includes padding bytes if these are required by the CAN format in the respective situation.

Behavior

The CAN Transmit operation shall be provided by Network FMUs to initiate the transmission of a CAN frame. In case of directly connected Network FMUs (see Section 3.2.1), the FMU importer forwards the operation directly to the receiving Network FMUs. If a Bus Simulation is involved (see Section 3.2.2 and Section 3.2.3), the FMU importer forwards the operation initially to the Bus Simulation, where the operation is distributed with respect to the simulated bus behavior. Depending on the simulation details, the Bus Simulation might respond with a Confirm, Arbitration Lost, Bus Error or Format Error operation. Depending on the status of the specified Network FMU, further restrictions for CAN Transmit operations exist.

Table 10. Detailed description of the CAN FD Transmit operation.

Name

CAN FD Transmit

Description

Represents an operation for the transmission of a CAN FD frame.

OP Code [hex]

0x11

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x11) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 17 + Data Length.

ID

4 bytes

The specified ID of the CAN message. The ID must be considered here as a purely numerical value. This means that there is no need for separate segmentation between the 11-bit base CAN identifier and an 18-bit CAN identifier extension information that is known from the CAN protocol. Additional information such as Ide is also not part of the ID, but is treated separately.

Ide

1 byte

Specified whether the ID should be transmitted as standard (11-bit) or extended (29-bit) message identifier. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Brs

1 byte

Defines the Bit Rate Switch. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Esi

1 byte

Error State indicator. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Data Length

2 bytes

Specifies the length of the Data argument in bytes. Note: The argument value describes the actual data length and not the CAN Data Length Code (DLC).

Data

n bytes

Stores the given frame data to transfer, whereby the valid length of the data depends on the CAN FD Format. Note: The value of this argument also includes padding bytes if these are required by the CAN format in the respective situation.

Behavior

The behavior is identical to the CAN Transmit behavior.

Table 11. Detailed description of the CAN XL Transmit operation.

Name

CAN XL Transmit

Description

Represents an operation for the transmission of a CAN XL frame.

OP Code [hex]

0x12

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x12) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 22 + Data Length.

ID

4 bytes

The specified ID of the CAN message. The ID must be considered here as a purely numerical value. This means that there is no need for separate segmentation between the 11-bit base CAN identifier and an 18-bit CAN identifier extension information that is known from the CAN protocol. Additional information such as Ide is also not part of the ID, but is treated separately.

Ide

1 byte

Specified whether the ID should be transmitted as standard (11-bit) or extended (29-bit) message identifier. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Sec

1 byte

Simple Extended Content For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

SDT

1 byte

Describes the structure of the frames Data Field content (SDU type).

VCID

1 byte

Represents the virtual CAN network ID.

AF

4 bytes

Represents the CAN XL Acceptance Field (AF).

Data Length

2 bytes

Specifies the length of the Data argument in bytes. Note: The argument value describes the actual data length and not the CAN Data Length Code (DLC).

Data

n bytes

Stores the given frame data to transfer, whereby the valid length of the data depends on the CAN XL Format. Note: The value of this argument also includes padding bytes if these are required by the CAN format in the respective situation.

Behavior

The behavior is identical to the CAN Transmit behavior.

5.5.1.2.2. Confirm

The Confirm operation is used to signal the successful reception of a transmitted CAN frame (see Transmit operation) by at least one Network FMU.

Table 12. Detailed description of the Confirm operation.

Name

Confirm

Description

Signals successful receipt of a transmitted CAN, CAN FD and CAN XL frame to simulate a CAN acknowledgment behavior.

OP Code [hex]

0x20

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x20) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 12.

ID

4 bytes

The ID of the confirmed CAN message.

Behavior

This operation shall be produced by the Bus Simulation and consumed by Network FMUs.
Only Network FMUs with the corresponding optionally exposed BusNotifications parameter set to fmi3True might wait for this operation. Depending on the status of the receiving Network FMU further restrictions for Confirm operations exist.

5.5.1.2.3. Format Error

See Format Error for definition.

5.5.1.2.4. Arbitration Lost

The Arbitration Lost operation defines a feedback message from a Bus Simulation to a Network FMU that a Transmit operation could not be sent immediately due to a concurrent transmit request.

Table 13. Detailed description of the Arbitration Lost operation.

Name

Arbitration Lost

Description

The Arbitration Lost operation indicates that a CAN frame could not be sent immediately and was therefore discarded by the Bus Simulation. See Section 5.5.1.7 for further details.

OP Code [hex]

0x30

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x30) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 12.

ID

4 bytes

The ID of the CAN message which could not be transmitted immediately because it lost arbitration.

Behavior

During simulation, several Transmit operations can be sent by Network FMUs to a Bus Simulation at the same time. In such case, the Bus Simulation has to decide which Transmit operation should be processed first. Depending on the configuration (see the Arbitration Lost Behavior argument of the Configuration operation), the deferred Transmit operations shall either be buffered or they shall be discarded and the Arbitration Lost operation shall be sent back to the respective Network FMUs. A Network FMU receiving the Arbitration Lost operation can decide to provide the Transmit operation again or e.g., to raise an internal transmit timeout failure after a while.
Only Network FMUs with the corresponding optionally exposed BusNotifications parameter set to fmi3True might wait for this operation and respond accordingly.

5.5.1.2.5. Bus Error

The Bus Error operation represents special bus communication errors, which are delivered to every participant in the network.

Table 14. Detailed description of the Bus Error operation.

Name

Bus Error

Description

Represents an operation for simulated bus errors.

OP Code [hex]

0x31

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x31) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 15.

ID

4 bytes

The ID of the CAN message that was transmitted while the error happened.

Error Code

1 byte

The simulated bus error, based on the table below.

Error Flag

1 byte

Defines whether the Error was detected by a specified Network FMU. For specification the boolean values PRIMARY_ERROR_FLAG and SECONDARY_ERROR_FLAG (see Table 16) shall be used.

Is Sender

1 byte

Set if the Bus Error operation is a reaction to a Transmit operation that was provided by the specified Network FMU from the Bus Simulation. For specification, the boolean values TRUE and FALSE (see Table 6) shall be used.

Behavior

When transmitting CAN frames, various kinds of bus error may happen. A Bus Simulation can simulate such errors by providing Bus Error operations to the Network FMUs. Based on consumed Bus Error operations, Network FMUs shall maintain an internal CAN node state (see Section 5.5.1.6). To determine the CAN node state properly, Network FMUs need the information about their role at the time when the simulated error happened. For a Network FMU that initiated the Transmit operation, the argument Is Sender shall be set to TRUE in the corresponding Bus Error operation. For a Network FMU considered to be the one detecting the error first, the argument Error Flag = PRIMARY_ERROR_FLAG shall be set. The arguments Is Sender = TRUE and Error Flag = PRIMARY_ERROR_FLAG must only be set once per simulated error.
Only Network FMUs with the corresponding optionally exposed BusNotifications parameter set to fmi3True might wait for this operation and respond accordingly.

The following Error Codes are specified:

Table 15. Overview of the available error codes.

State

Error Code

Description

BIT_ERROR

0x01

Within the CAN standard, the sender also receives transmitted data for comparison. If the sent and received bits are not identical, this failure results in a Bit Error.

BIT_STUFFING_ERROR

0x02

A Bit Stuff Error occurs if 6 consecutive bits of equal value are detected on the bus.

FORM_ERROR

0x03

Occurs during a violation of End-of-Frame (EOF) format.

CRC_ERROR

0x04

Occurs when the data of a frame and the related checksum do not harmonize.

ACK_ERROR

0x05

All receiving nodes identify an invalid CAN frame.

BROKEN_ERROR_FRAME

0x06

Represents an invalid transmission of a CAN Error frame. Within CAN, an Error frame is transmitted by any unit on detection of a bus error.

The following values for the Error Flag option are defined:

Table 16. Overview of the available Error Flag values.

Error Flag

Value

Description

PRIMARY_ERROR_FLAG

0x01

Defines that a specified Network FMU is detecting the given Bus Error first.

SECONDARY_ERROR_FLAG

0x02

Defines that a specified Network FMU is reacting on a Bus Error and does not detect it.

5.5.1.2.6. Configuration

The Configuration operation is used by Network FMUs to send simulation specific options like baud rate settings to Bus Simulations. The following information is included within this operation:

Table 17. Detailed description of the Configuration operation.

Name

Configuration

Description

Represents an operation for the configuration of a Bus Simulation. In detail, the configuration of a CAN, CAN FD and CAN XL baud rate is possible. Also the configuration of further options, like buffer handling, is supported by this operation.

OP Code [hex]

0x40

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x40) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 9 + Length of parameter arguments in bytes.

Parameter Type

1 byte

Defines the current configuration parameter. Note that only one parameter can be set per Configuration operation.

Parameters

CAN_BAUDRATE

Baud Rate

4 bytes

The CAN baud rate value to configure. The required unit for the baud rate value is bit/s.

CAN_FD_BAUDRATE

Baud Rate

4 bytes

The CAN FD baud rate value to configure. The required unit for the baud rate value is bit/s.

CAN_XL_BAUDRATE

Baud Rate

4 bytes

The CAN XL baud rate value to configure. The required unit for the baud rate value is bit/s.

ARBITRATION_LOST_BEHAVIOR

Arbitration Lost Behavior

1 byte

This parameter defines how a Bus Simulation shall behave in cases of an arbitration lost scenario. If the option is set to BUFFER_AND_RETRANSMIT, Transmit operations shall be buffered by the Bus Simulation and no Arbitration Lost operation shall be sent. If the option is set to DISCARD_AND_NOTIFY, the Transmit operation shall be discarded and an Arbitration Lost operation shall be sent to the Network FMU (see Section 5.5.1.7).

Behavior

The specified operation shall be produced by a Network FMU and consumed by the Bus Simulation. The operation shall not be routed to other Network FMUs by the Bus Simulation. A Network FMU shall ignore this operation on the consumer side. Configuration operations can be produced multiple times during the runtime of a Network FMU. In context of CAN FD, also a CAN baud rate should be configured by using Parameter Type = CAN_BAUDRATE. If configuration parameters are not adjusted by a Network FMU, the Bus Simulation shall choose a default behavior by itself.

The following configuration parameters are defined:

Table 18. Overview of the available configuration parameters.

Parameter

Value

Description

CAN_BAUDRATE

0x01

This code indicates that a CAN baud rate should be configured for the Bus Simulation.

CAN_FD_BAUDRATE

0x02

Allows the configuration of a CAN FD baud rate for the Bus Simulation.

CAN_XL_BAUDRATE

0x03

Allows the configuration of a CAN XL baud rate for the Bus Simulation.

ARBITRATION_LOST_BEHAVIOR

0x04

This code configures the behavior of a Bus Simulation if an arbitration is lost. See Table 19 for possible values.

The following values for the Arbitration Lost Behavior option are defined:

Table 19. Overview of the available Arbitration Lost Behavior values.

Arbitration Lost Behavior

Value

Description

BUFFER_AND_RETRANSMIT

0x01

Transmit operations shall be buffered by the Bus Simulation.

DISCARD_AND_NOTIFY

0x02

Transmit operations shall be discarded and the specified Network FMU shall be notified by the Bus Simulation via an Arbitration Lost operation.

5.5.1.2.7. Status

By using the Status operation, a Network FMU can communicate the current CAN node state to the Bus Simulation. The following information is included within this operation:

Table 20. Detailed description of the Status operation.

Name

Status

Description

Represents an operation for status handling.

OP Code [hex]

0x41

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x41) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 9.

Status

1 byte

The specified status code, based on the table below.

Behavior

The specified operation shall be produced by Network FMUs and consumed by the Bus Simulation. The operation shall not be routed to other Network FMUs by the Bus Simulation. A Network FMU shall ignore this operation on the consumer side. A Network FMU shall report its status to the Bus Simulation after it changes.

The following status values can be used:

Table 21. Overview of the available status values.

Kind

Value

Description

ERROR_ACTIVE

0x01

Indicates that a simulated CAN controller within the Network FMU has currently the CAN node state: ERROR ACTIVE. If the status is not adjusted by a Network FMU, the Bus Simulation shall choose ERROR_ACTIVE by itself for a specified Network FMU.

ERROR_PASSIVE

0x02

Indicates that a simulated CAN controller within the Network FMU has currently the CAN node state: ERROR PASSIVE. This node state is relevant for arbitration, because ERROR_ACTIVE and ERROR_PASSIVE nodes requires different prioritization. See Section 5.5.1.7 for further details.

BUS_OFF

0x03

Indicates that a simulated CAN controller within the Network FMU has currently the CAN node state: Bus-Off. If a Network FMU communicates the status BUS_OFF to the Bus Simulation, the specified Network FMU shall not provide any new Transmission operations to the Bus Simulation. If all Network FMUs, except the Transmit operation initiating Network FMU, communicate the status BUS_OFF, the Bus Simulation shall not provide a confirmation.

5.5.1.2.8. Wake Up

By using the Wakeup operation, the underlying Bus Simulation can trigger a bus-specific wake-up.

Table 22. Detailed description of the Wakeup operation.

Name

Wakeup

Description

Represents an operation for triggering a bus-specific wake-up.

OP Code [hex]

0x42

Content

Argument

Length

Description

OP Code

4 bytes

Contains the OP Code (0x42) of the operation.

Length

4 bytes

Defines the cumulative length of all arguments in bytes. The following applies for this operation: Length = 8.

Behavior

The specified operation shall be produced by a Network FMU and distributed to all participants, except the wake-up initiator, of the bus using the Bus Simulation. If a Network FMU does not support wake up, this operation can be ignored on the consumer side.

5.5.1.3. Network Parameters

This chapter defines parameters that Network FMU might provide to configure CAN-specific behavior.

5.5.1.3.1. Bus Notification Parameter

For a detailed simulation, the CAN bus behavior regarding acknowledgment, bus errors and arbitration losses must be considered. A Bus Simulation can simulate these effects by sending bus notifications in terms of Confirm-, Bus Error- and Arbitration Lost operations to the Network FMUs.

However, in scenarios where Network FMUs are connected directly to each other, or where the Bus Simulation does not simulate such effects, it must be possible to configure the Network FMU such that it does not wait for any response after a Transmit operation. Therefore, a parameter with memberName = "BusNotifications" can be added within the CAN-specific Configuration Terminal.
If a Network FMU supports bus notifications, the BusNotifications parameter shall be exposed. The default value of this parameter shall be false.
[The default value false allows a simple integration of Network FMUs to simulation scenarios where Confirm-, Bus Error- or Arbitration Lost operations are not used.]

Only Network FMUs with the corresponding optionally exposed BusNotifications parameter set to fmi3True might wait for Confirm-, Bus Error- and Arbitration Lost operations and respond accordingly; otherwise Network FMUs must not wait ("fire-and-forget"). Even if the Network FMU does not expect bus notifications, i.e. BusNotifications variable was not set to fmi3True, but receives them, it shall ignore them, i.e. it shall not report warnings or errors.

[Note that the bus notification parameter just informs the Network FMU if it can expect to receive notification operations or not. The parameter doesn’t define in any way on how to react upon receiving notification operations.]

Parameter to configure bus notifications within a CAN Bus Terminal of Network FMUs.
 memberName:    BusNotifications
 type:          Boolean
 causality:     parameter
 variability:   fixed
 start:         false

A Bus Simulation FMU shall indicate via a variable with memberName = "BusNotifications" within the CAN-specific Configuration Terminal whether it provides bus notifications or not. If the provision of bus notifications can be configured (e.g., via a structural parameter), the attributes of the BusNotifications variable shall contain causality = "calculatedParameter" and variability = "fixed"; or causality = "output" and variability = "constant" otherwise.

Parameter to configure bus notifications within a CAN Bus Terminal of the Bus Simulation.
 memberName:    BusNotifications
 type:          Boolean
 causality:     calculatedParameter/output
 variability:   fixed/constant
5.5.1.4. Configuration of Bus Simulation

The configuration of the Bus Simulation is done by the Network FMUs itself. For this purpose, the Configuration operation provides several configuration parameters. Configuration operations can be produced multiple times during the runtime of a Network FMU. Because the Bus Simulation shall choose a default behavior, it might be useful in several scenarios that Network FMUs finish configuration before the production of Transmit operations.

5.5.1.4.1. Baud Rate Handling

In order to calculate the time required for the transmission of a bus message, it is necessary to inform the Bus Simulation about the specified baud rate from a Network FMU. This baud rate information can be configured by using CAN_BAUDRATE, CAN_FD_BAUDRATE and CAN_XL_BAUDRATE configuration kind of the Configuration operation. In a CAN FD scenario, both the configuration for CAN_BAUDRATE and for CAN_FD_BAUDRATE shall be carried out. The Bus Simulation can derive the required CAN, CAN FD or CAN XL controller type from the baud rate configurations a Network FMU carried out. If the baud rate information is not adjusted by a specified Network FMU, the Bus Simulation shall choose a default behavior by itself.

5.5.1.4.2. Buffer Handling

By using the ARBITRATION_LOST_BEHAVIOR kind of Configuration operation, the buffer handling within the Bus Simulation can be adjusted. Using buffer handling is required in arbitration scenarios only and will be described within this context. If the buffering is not adjusted by a specified Network FMU, the Bus Simulation shall choose a default behavior by itself.

5.5.1.5. Transmission and Acknowledge

The Transmit operation represents the sending of a CAN, CAN FD and CAN XL frame. With appropriate options, relevant functionalities can be configured and used on a Network Abstraction level (e.g., Virtual CAN network ID for CAN XL or Bit Rate Switch for CAN FD). In the real world, flawlessly transmitted CAN frames will be acknowledged by at least one receiver CAN node. To simulate this behavior, the Confirm operations are introduced. In addition, the BusNotifications parameter is defined to support lightweight bus simulations and directly connected Network FMUs.

If BusNotifications is false (default), then Network FMUs must not rely on receiving Confirm operations for the specified Bus Terminal. In this case, the bus simulation is idealized and takes place in a "fire-and-forget" manner. If a specified Network FMU is depending on Confirm operations and BusNotifications is false, the self confirmation shall be realized internally within the respective Network FMU for the specified Bus Terminal.

Figure 12 illustrates this communication, whereby FMU 1 transmits network data to FMU 2. Subsequently, FMU 1 self-confirms the transmission internally.

can direct confirmation
Figure 12. Direct Confirmation of transmitted network data.

For a detailed simulation, the Bus Simulation has to support Confirm operations. In this case, the BusNotifications parameter of the Network FMUs can be set to fmi3True as Network FMUs can rely on receiving Confirm operations for the specified Bus Terminal.

The following Figure 13 illustrates the behavior, whereby FMU 1 transmits network data to FMU 2 via a Bus Simulation.

can confirmation with bus simulation fmu
Figure 13. Confirmation of transmitted network data via Bus Simulation.

If all Network FMUs, except the one initiating the Transmit operation, communicate the status BUS_OFF, the Bus Simulation shall not provide a confirmation.

The FMI LS BUS Implementer’s Guide contains an example of the possible transmission results and displays them in a diagram.

5.5.1.6. Error Handling

The CAN protocol includes a sophisticated fault confinement mechanism to prevent malfunctioning within CAN nodes. A Transmit Error Counter (TEC) and a Receive Error Counter (REC) represent a historical communication quality metric. To maintain the TEC and REC values, Bus Error operations shall be provided to all Network FMUs by the Bus Simulation. The argument Is Sender shall be set to TRUE for the Network FMU the Transmit operation originated from. The argument Error Flag shall be set to PRIMARY_ERROR_FLAG if the Network FMU detects the transmission error. If a Network FMU changes its current CAN node state, the Status operation shall be provided to the Bus Simulation. When a Network FMU signals the BUS_OFF state to the Bus Simulation, it shall not provide any new Transmit operations in order to simulate a real Bus-Off behavior.

can error handling overview
Figure 14. Architectural error handling overview.

The FMI LS BUS Implementer’s Guide contains an example of how to realize CAN error handling based on the Bus Operations specified by this layered standard.

5.5.1.7. Arbitration

Arbitration is an instrument of the CAN standard to resolve the conflict of the simultaneous sending of messages from several CAN nodes without a collision. The arbitration is handled in the Bus Simulation and can be recognized by the fact that the Bus Simulation receives a Transmit operation from several FMUs at the same time. As soon as an arbitration is lost, an Arbitration Lost operation shall be returned to the respective sender. As soon as an FMU receives an Arbitration Lost operation, it can independently repeat the corresponding Transmit operation.

can arbitration
Figure 15. Arbitration of two transmissions at the same time.

Within a Configuration operation, the Arbitration Lost Behavior argument can be specified. Once this option is set to BUFFER_AND_RETRANSMIT, the Bus Simulation buffers the frame after losing arbitration and sends it as soon as possible. In this case, it is not necessary for the Network FMU to re-send the respective frame and an Arbitration Lost operation shall not be returned to the specific Network FMU. If the Arbitration Lost Behavior is set to DISCARD_AND_NOTIFY, the specified Network FMU is informed by an Arbitration Lost operation and needs to repeat the corresponding Transmit operation by itself. Arbitration is available in communication architectures with Bus Simulation only, i.e., it is not available for directly connected Network FMUs.

In the case of arbitration, the Bus Simulation must also take the status of the respective Network FMU into account, which is communicated via a Status operation. To simulate the behavior of the CAN Extra Suspend Transmission Time when a CAN node is in Error Passive state, the Bus Simulation shall prefer Network FMUs whose status is ERROR_ACTIVE (see Table 21).

The FMI LS BUS Implementer’s Guide contains examples of the presented arbitration cases and visualizes them using sequence diagrams.

5.5.1.8. Wake Up/Sleep

This standard supports wake up and sleep functionality for the CAN bus. However, the realization of local virtual ECU wake-up and sleeping processes, i.e., the transition to the sleep state as well as the virtual ECU local wake-up process, is considered internal to the FMU implementation. Therefore, only the bus-related aspects are defined in this document.

The CAN-specific wake-up pulse can be simulated by using the Wakeup operation, initiated by one Network FMU. The Bus Simulation shall distribute this operation to all participants on the bus, excluding the wake-up initiator.

can wake up
Figure 16. Wake up initiated by FMU 1 wakes up FMU 2 and FMU 3 via bus.

6. Contributions

  • Christian Bertsch, Robert Bosch GmbH, Germany

  • Clemens Boos, dSPACE GmbH, Germany

  • Martin Engel, dSPACE GmbH, Germany

  • Nikolai Fast, Beckhoff Automation GmbH & Co. KG, Germany

  • Andreas Junghanns, Synopsys, Germany

  • Kahramon Jumayev, Akkodis, Germany

  • Masoud Najafi, Altair, France

  • Pierre R. Mai, PMSF IT Consulting, Germany

  • Benedikt Menne, dSPACE GmbH, Germany

  • Jan Ribbe, Synopsys, Germany

  • Klaus Schuch, AVL List GmbH, Austria

  • Markus Süvern, dSPACE GmbH, Germany

  • Tim Pfitzer, Robert Bosch GmbH, Germany

  • Sonja Pusch, dSPACE GmbH, Germany

  • Patrick Täuber, dSPACE GmbH, Germany

  • Ella Vahle, dSPACE GmbH, Germany

Contributions to this layered standard to the FMI standard are covered by the Corporate Contributors License Agreement (CCLA) of the Modelica Association Project FMI.

References


1. In AUTOSAR context this means a driver implementation within the MicroController Abstraction Layer (MCAL)
2. Simulated tasks are executed infinitely fast.
3. Relevant for Physical Signal Abstraction (High-Cut)
4. Relevant for Network Abstraction (Low-Cut)
5. For details, refer to Functional Mock-up Interface Specification (fmi-standard.org) chapter 2.2.8 Clocks.
6. DL is used as an abbreviation for Data Length throughout the document