Expand description
§Communication between ECUs in a system
This module contains the communication related elements of the AUTOSAR metamodel.
Currently, the following bus types are supported:
- CAN
- Ethernet
- Flexray
For each of the bus types, the following elements are available:
- Communication using Frames, PDUs and signals
- Network management
- Diagnostic transport protocol
Ethernet also has support for:
- Old communication odel (using
SocketConnectionBundles
) - New communication model (using
StaticSocketConnections
) SomeIP
§Example
use autosar_data::*;
use autosar_data_abstraction::*;
use autosar_data_abstraction::communication::*;
use autosar_data_abstraction::datatype::*;
let model = AutosarModelAbstraction::create("can.arxml", AutosarVersion::LATEST);
let system_package = model.get_or_create_package("/System")?;
let system = system_package.create_system("System", SystemCategory::SystemExtract)?;
let cluster_package = model.get_or_create_package("/Network/Clusters")?;
let can_cluster = system.create_can_cluster("CanCluster", &cluster_package, Some(500_000))?;
can_cluster.set_can_fd_baudrate(Some(2_000_000))?;
assert_eq!(can_cluster.element().element_name(), ElementName::CanCluster);
let can_channel = can_cluster.create_physical_channel("CanChannel")?;
let ecu_package = model.get_or_create_package("/Ecus")?;
// create ECU A and connect it to the CAN channel
let ecu_instance_a = system.create_ecu_instance("Ecu_A", &ecu_package)?;
let canctrl_a = ecu_instance_a.create_can_communication_controller("CanController")?;
let channels_iter = canctrl_a.connected_channels();
assert_eq!(channels_iter.count(), 0);
canctrl_a.connect_physical_channel("Ecu_A_connector", &can_channel)?;
let channels_iter = canctrl_a.connected_channels();
assert_eq!(channels_iter.count(), 1);
// create ECU B and connect it to the CAN channel
let ecu_instance_b = system.create_ecu_instance("Ecu_B", &ecu_package)?;
let canctrl_b = ecu_instance_b.create_can_communication_controller("CanController")?;
canctrl_b.connect_physical_channel("Ecu_B_connector", &can_channel)?;
let frame_package = model.get_or_create_package("/Network/Frames")?;
let pdu_package = model.get_or_create_package("/Network/Pdus")?;
let isignal_package = model.get_or_create_package("/Network/Signals")?;
let syssignal_package = model.get_or_create_package("/System/Signals")?;
// create a base type for the CAN signals
let base_type_package = model.get_or_create_package("/BaseTypes")?;
let base_type_u8 = base_type_package.create_sw_base_type(
"uint8",
8,
BaseTypeEncoding::None,
None,
None,
Some("uint8"),
)?;
// create a frame which contains one Pdu: Id 0x101, length 8
let frame = system.create_can_frame("frame", &frame_package, 8)?;
let pdu = system.create_isignal_ipdu("pdu", &pdu_package, 8)?;
let ss_pdusignal1 = syssignal_package.create_system_signal("ss_pdusignal1")?;
let pdusignal1 = system
.create_isignal("pdusignal1", &isignal_package, 4, &ss_pdusignal1, Some(&base_type_u8))?;
let ss_pdusignal2 = syssignal_package.create_system_signal("ss_pdusignal2")?;
let pdusignal2 = system
.create_isignal("pdusignal2", &isignal_package, 4, &ss_pdusignal2, Some(&base_type_u8))?;
// map signal 1 to the first 4 bytes of the Pdu
pdu.map_signal(
&pdusignal1,
0,
ByteOrder::MostSignificantByteFirst,
None,
TransferProperty::Triggered,
)?;
// map signal 2 to the second 4 bytes of the Pdu
pdu.map_signal(
&pdusignal2,
8, // since this signal uses ByteOrder::MostSignificantByteFirst, it starts at byte 8 and ends at byte 4
ByteOrder::MostSignificantByteFirst,
None,
TransferProperty::Triggered,
)?;
// map the pdu to the frame
frame.map_pdu(
&pdu,
0,
ByteOrder::MostSignificantByteLast,
None,
)?;
// trigger the frame on the CAN channel (id 0x101)
let frame_triggering = can_channel
.trigger_frame(&frame, 0x101, CanAddressingMode::Standard, CanFrameType::Can20)?;
// frame connection: Ecu_B -> Ecu_A
frame_triggering.connect_to_ecu(&ecu_instance_a, CommunicationDirection::In)?;
frame_triggering.connect_to_ecu(&ecu_instance_b, CommunicationDirection::Out)?;
Structs§
- CanCluster
- A
CanCluster
contains all configuration items associated with a CAN network. The cluster connects multiple ECUs. - CanCommunication
Connector - A connector between a
CanCommunicationController
in an ECU and aCanPhysicalChannel
- CanCommunication
Controller - An
EcuInstance
needs aCanCommunicationController
in order to connect to a CAN cluster. - CanFrame
- A frame on a CAN bus
- CanFrame
Triggering - The frame triggering connects a frame to a physical channel
- CanNm
Cluster - Can specific
NmCluster
attributes - CanNm
Cluster Coupling - A
CanNmClusterCoupling
couples multipleCanNmCluster
s, and contains CAN specific settings. - CanNm
Cluster Settings - Mandatory settings for a
CanNmCluster
- CanNm
Node - A
CanNmNode
represents a node in aCanNmCluster
. - CanPhysical
Channel - The
CanPhysicalChannel
contains all of the communication on a CAN network - CanTp
Address - A
CanTpAddress
represents a logical address in theCanTp
module - CanTp
Channel - A
CanTpChannel
represents a channel in theCanTp
module - CanTp
Config - Container for
CanTp
configuration - CanTp
Connection - A connection identifies the sender and the receiver of this particular communication.
The
CanTp
module routes a Pdu through this connection. - CanTp
Ecu - A
CanTpEcu
represents an ECU that is using theCanTp
module - CanTp
Node - A
CanTpNode
provides the TP address and the connection to the topology description in aCanTpConfig
- ComTransformation
Technology Config - Configuration for a COM transformation
- Common
Service Discovery Config - A
CommonServiceDiscoveryConfig
contains common configuration settings forSystem::configure_service_discovery_for_ecu
. - Consumed
Event Group - A
ConsumedEventGroup
is a group of events in aConsumedServiceInstance
that are consumed by an ECU - Consumed
Event Group V1 - A
ConsumedEventGroupV1
is a SD event group of a service instance that is consumed by this ECU. - Consumed
Service Instance - A
ConsumedServiceInstance
is a service that is consumed by an ECU - Consumed
Service Instance V1 - A
ConsumedServiceInstanceV1
is a SD service instance that is consumed by this ECU. - ContainedI
PduProps - Properties for an
IPdu
that is transmitted in a containerIPdu
- ContainerI
Pdu - Several
IPdus
can be collected in oneContainerIPdu
based on the headerType - Cyclic
Timing - Cyclic timing parameters for an IPDU
- Data
Transformation - A
DataTransformation
is a chain ofTransformationTechnology
s that are used to transform data - Data
Transformation Set - A
DataTransformationSet
containsDataTransformation
s andTransformationTechnology
s used in communication - DcmIPdu
- Represents the
IPdus
handled by Dcm - DoIp
Config - This element defines the
DoIp
configuration for a specific Ecu - DoIp
Logic Address - This element defines the logical address of a
DoIp
connection - DoIp
TpConfig - Container for
DoIp
TP configuration - DoIp
TpConnection - The
DoIpTpConnection
defines aDoIp
transport protocol connection - E2ETransformation
Technology Config - Configuration for an E2E transformation
- EndTo
EndTransformationI Signal Props - Properties for the End to End transformation of an ISignal(Group)
- Ethernet
Cluster - An
EthernetCluster
contains all configuration items associated with an ethernet network. The cluster connects multiple ECUs. - Ethernet
Communication Connector - A connector between an
EthernetCommunicationController
in an ECU and anEthernetPhysicalChannel
- Ethernet
Communication Controller - An
EcuInstance
needs anEthernetCommunicationController
in order to connect to an ethernet cluster. - Ethernet
Physical Channel - The
EthernetPhysicalChannel
represents a VLAN or untagged traffic - Ethernet
Vlan Info - Provides information about the VLAN of an
EthernetPhysicalChannel
- Event
Controlled Timing - Event controlled timing parameters for an IPDU
- Event
Handler - An
EventHandler
describes the handling of a single event in aProvidedServiceInstance
- Event
Handler V1 - An
EventHandlerV1
is a SD event handler that is used to receive events from other ECUs. - Flexray
ArTp Channel - The
FlexrayArTpChannel
represents a channel in the Flexray Autosar Transport Protocol - Flexray
ArTp Config - The
FlexrayArTpConfig
represents the configuration of the Flexray Autosar Transport Protocol - Flexray
ArTp Connection FlexrayArTpConnection
represents a connection within aFlexrayArTpChannel
- Flexray
ArTp Node FlexrayArTpNode
represents a node in the Flexray Autosar Transport Protocol- Flexray
Cluster - A
FlexrayCluster
contains all configuration items associated with a Flexray network. The cluster connects multiple ECUs. - Flexray
Cluster Settings - Configuration settings of the Flexray cluster.
- Flexray
Communication Connector - A connector between a
FlexrayCommunicationController
in an ECU and aFlexrayPhysicalChannel
- Flexray
Communication Controller - An
EcuInstance
needs aFlexrayCommunicationController
in order to connect to a Flexray cluster. - Flexray
Frame - a Flexray frame
- Flexray
Frame Triggering - The frame triggering connects a frame to a physical channel
- Flexray
NmCluster - Flexray specific
NmCluster
- Flexray
NmCluster Coupling - A
FlexRayNmClusterCoupling
couples multipleFlexrayNmCluster
s. - Flexray
NmCluster Settings - Mandatory settings for a
FlexrayNmCluster
- Flexray
NmNode - A
FlexrayNmNode
represents aFlexRay
specificNmNode
. - Flexray
Physical Channel - the
FlexrayPhysicalChannel
represents either channel A or B of Flexray cluster - Flexray
Physical Channels Info - Information about the flexray physical channels present inside a cluster
- Flexray
TpConfig FlexrayTpConfig
defines exactly oneFlexRay
ISO TP Configuration- Flexray
TpConnection - A
FlexrayTpConnection
defines a connection betweenFlexrayTpNodes
- Flexray
TpConnection Control - A
FlexrayTpConnectionControl
defines the connection control parameters for aFlexrayTpConnection
- Flexray
TpEcu - A
FlexrayTpEcu
represents an ECU within theFlexrayTpConfig
- Flexray
TpNode - A
FlexrayTpNode
provides the TP address and the connection to the topology description in aFlexrayTpConfig
- Flexray
TpPdu Pool - A
FlexrayTpPduPool
contains a set ofNPdus
that can be used for sending and receiving - Frame
Port - The
FramePort
allows an ECU to send or receive a frame - General
PurposeI Pdu - This element is used for AUTOSAR Pdus without attributes that are routed by the
PduR
- General
Purpose Pdu - This element is used for AUTOSAR Pdus without additional attributes that are routed by a bus interface
- Generic
Transformation Technology Config - Configuration for a generic transformation technology For a generic trasformation, the mandatory values must be chosen by the user
- IPdu
Port - The
IPduPort
allows an ECU to send or receive a PDU - ISignal
- Signal of the Interaction Layer
- ISignal
Group - An
ISignalGroup
groups signals that should always be kept together - ISignalI
Pdu - Represents the
IPdus
handled by Com - ISignal
Port - The
ISignalPort
allows an ECU to send or receive a Signal - ISignal
ToIPdu Mapping ISignalToIPduMapping
connects anISignal
orISignalGroup
to anISignalToIPdu
- ISignal
Triggering - an
ISignalTriggering
triggers a signal in a PDU - Initial
SdDelay Config - A
InitialSdDelayConfig
contains the configuration for the initial delay of an SD client or server - Ipdu
Timing - Timing specification for an IPDU
- MultiplexedI
Pdu - The multiplexed pdu contains one of serveral signal pdus
- NPdu
- This is a Pdu of the transport layer. The main purpose of the TP layer is to segment and reassemble
IPdus
. - Network
Endpoint - A network endpoint contains address information for a connection
- NmConfig
- The
NmConfig
is the root element for the network management configuration. - NmEcu
- The
NmEcu
represents anEcuInstance
wich participates in network management. - NmPdu
- Network Management Pdu
- PduActivation
Routing Group - A group of Pdus that can be activated or deactivated for transmission over a socket connection.
It is used by
EventHandler
s inProvidedServiceInstance
s andConsumedServiceInstance
s. - PduTo
Frame Mapping PduToFrameMapping
connects a PDU to a frame- PduTriggering
- a
PduTriggering
triggers a PDU in a frame or ethernet connection - Provided
Service Instance - A
ProvidedServiceInstance
is a service that is provided by an ECU - Provided
Service Instance V1 - A
ProvidedServiceInstanceV1
is a SD service instance that is provided by this ECU. - Request
Response Delay - A
RequestResponseDelay
contains the minimum and maximum delay for a request-response cycle - SdConfig
- SD configuration for a service instance
- SdEvent
Config - Configuration for an SD event handler
- Secure
Communication Props - The properties of a
SecuredIPdu
- SecuredI
Pdu - Wraps an
IPdu
to protect it from unauthorized manipulation - Service
Instance Collection Set - A
ServiceInstanceCollectionSet
containsServiceInstance
s that are provided or consumed by an ECU - Signal
Mapping Validator - Helper struct to validate signal mappings
- SoAd
Routing Group - A
SoAdRoutingGroup
is used to linkSomeIp
settings in Consumed/ProvidedServiceInstances to theSocketConnectionBundles
used for transmission.SoAdRoutingGroups
are part of the old way of configuring Ethernet communication in AUTOSAR. - SoConI
PduIdentifier - A
SoConIPduIdentifier
describes a PDU that is transported over a static socket connection. - Socket
Address - A socket address establishes the link between one or more ECUs and a
NetworkEndpoint
. It contains all settings that are relevant for this combination. - Socket
Connection - A socketConnection inside a
SocketConnectionBundle
describes a single connection to a specific client port. - Socket
Connection Bundle - A
SocketConnectionBundle
describes a connection between a server port and multiple client ports. It contains multiple bundled connections, each transporting one or more PDUs. - Socket
Connection Ipdu Identifier - A
SocketConnectionIpduIdentifier
is used to trigger a PDU in aSocketConnection
. - Socket
Connection Ipdu Identifier Set - A
SocketConnectionIpduIdentifierSet
contains a set ofSoConIPduIdentifiers
, which are used in static socket connections and inSomeIp
events. - Some
IpTransformationI Signal Props - Properties for the SOMEIP transformation of an ISignal(Group)
- Some
IpTransformation Technology Config - Configuration for a SOMEIP transformation
- Someip
SdClient Event Group Timing Config - A
SomeipSdClientEventGroupTimingConfig
contains the configuration for the timing of aConsumedEventGroup
- Someip
SdClient Service Instance Config - A
SomeipSdClientServiceInstanceConfig
is a configuration for aConsumedServiceInstance
- Someip
SdServer Event Group Timing Config - A
SomeipSdServerEventGroupTimingConfig
contains the configuration for the timing of anEventHandler
- Someip
SdServer Service Instance Config - A
SomeipSdServerServiceInstanceConfig
is a configuration for aProvidedServiceInstance
- Someip
TpChannel - General settings for a
SomeIp
TP channel - Someip
TpConfig - A
SomipTpConfig
contains the configuration of individualSomeIp
TP connections - Someip
TpConnection - A
SomeipTpConnection
contains the configuration of a singleSomeIp
TP connection - Static
Socket Connection - A static socket connection is a connection between two sockets.
- System
Signal - The system signal represents the communication system’s view of data exchanged between SW components which reside on different ECUs
- System
Signal Group - A signal group refers to a set of signals that shall always be kept together. A signal group is used to guarantee the atomic transfer of AUTOSAR composite data types.
- TpAddress
- Represents an ECUs transport layer address on the referenced channel
- Transformation
Technology - A
TransformationTechnology
describes how to transform signal or PDU data - Transmission
Mode Timing - Cyclic and event controlled timing parameters for an IPDU
- UdpNm
Cluster - Udp / Ethernet specific
NmCluster
- UdpNm
Cluster Coupling - Udp / Ethernet specific
NmClusterCoupling
- UdpNm
Cluster Settings UdpNmClusterSettings
encapsulates the mandatory settings for aUdpNmCluster
- UdpNm
Node - Udp / Ethernet specific
NmNode
Enums§
- CanAddressing
Mode - The addressing mode for a CAN frame
- CanFrame
Type - The type of a CAN frame
- CanTp
Addressing Format - The addressing format of a
CanTpConnection
- CanTp
Channel Mode - The mode of a
CanTpChannel
- Cluster
- A
Cluster
is returned bySystem::clusters
. It can contain any supported communication cluster. - Communication
Connector - wraps all different kinds of communication connector
- Communication
Controller - wraps all different kinds of communication controller
- Communication
Direction - The
CommunicationDirection
is used by the communication ports for frames, PDUs and signals - ContainedI
PduCollection Semantics - collection semantics for the
ContainedIPdu
- ContainerI
PduHeader Type - The header type of a
ContainerIPdu
- ContainerI
PduTrigger - Defines when the transmission of the
ContainerIPdu
shall be requested - Cycle
Repetition - The cycle repetition of a Flexray frame, from the Flexray standard
- Data
IdMode - data ID modes for E2E profiles 01 and 11
- E2EProfile
- enumeration of the possible E2E profiles
- E2EProfile
Behavior - there are two standardized behaviors for E2E profiles, which can be selected for each E2E transformation
- Event
Group Control Type - control types used in routing groups for SOME/IP events
- Flexray
Channel Name - A flexray cluster may contain the channels A and/or B.
- Flexray
Communication Cycle - The timing settings of a Flexray frame
- Flexray
NmSchedule Variant - The
FlexrayNmScheduleVariant
defines the way the NM-Vote and NM-Data are transmitted within theFlexRay
network. - FrAr
TpAck Type - Types of Acknowledgement that can be used in an
FlexrayArTpChannel
- Frame
- A wrapper for CAN and
FlexRay
frames (Ethernet does not use frames) - Frame
Triggering - A wrapper for CAN and
FlexRay
frame triggerings - General
PurposeI PduCategory - The category of a
GeneralPurposeIPdu
- General
Purpose PduCategory - The category of a
GeneralPurposePdu
- IPdu
- Wrapper for all Pdu types. It is used as a return value for functions that can return any Pdu type
- IPv4
Address Source IPv4AddressSource
defines how the address of an IPv4NetworkEndpoint
is obtained- IPv6
Address Source IPv6AddressSource
defines how the address of an IPv6NetworkEndpoint
is obtained- Local
Unicast Address - A
LocalUnicastAddress
is a local address (TCP or UDP) that can be used for aProvidedServiceInstance
orConsumedServiceInstance
- Maximum
Message Length Type - Types of Maximum Message Length that can be used in an
FlexrayArTpChannel
- Network
Endpoint Address - address information for a network endpoint
- NmCluster
- The
NmCluster
encapsulates the bus specific NM clusters. - NmCluster
Coupling - Wrapper for the different types of
NmClusterCoupling
; this type is returned by the iterator overNmClusterCouplings
. - Pdu
- Wrapper for all Pdu types. It is used as a return value for functions that can return any Pdu type
- PduCollection
Trigger - The collction trigger defines whether a Pdu contributes to the triggering of the data transmission if Pdu collection is enabled
- Physical
Channel - A physical channel is a communication channel between two ECUs.
- RxAccept
ContainedI Pdu - The
RxAcceptContainedIPdu
enum defines whether a fixed set of containedIPdus
is accepted or all containedIPdus
- Service
Instance - A
ServiceInstance
is a service that is provided or consumed by an ECU - Socket
Address Type - Describes if a
SocketAddress
is used for unicast or multicast - Some
IpMessage Type - message types that can be used in a SOME/IP message header, depending on the type of communication
- TcpRole
- The role of a TCP connection in a static socket connection can either be
Connect
(=client) orListen
(=server). - TpConfig
- transport protocol settings of a
SocketAddress
- Transfer
Property - The
TransferProperty
defines if or how the signal influences the transfer of the PDU - TransformationI
Signal Props - Wrapper enum for the properties for the transformation of an ISignal(Group)
- Transformation
Technology Config - The configuration of any kind of
TransformationTechnology
Traits§
- Abstract
Cluster AbstractCluster
defines the common interface for all supported communication clusters.- Abstract
Communication Connector - A trait for all communication connectors
- Abstract
Communication Controller - A trait for all communication controllers
- Abstract
Frame - A trait for all frame types
- Abstract
Frame Triggering - A trait for all frame triggerings
- Abstract
Ipdu - for now this is a marker trait to identify
IPdus
- Abstract
NmCluster - An NM cluster is a set of NM nodes coordinated by the NM algorithm.
The
AbstractNmCluster
is a common interface for all bus specific NM clusters and provides common functionality. - Abstract
NmCluster Coupling - The
NmClusterCoupling
is used to couple twoNmClusters
together. - Abstract
NmNode AbstractNmNode
is a common interface for all bus specific NM nodes and provides common functionality.- Abstract
Pdu - This trait is implemented by all Pdus
- Abstract
Physical Channel - trait for physical channels