Module communication

Module communication 

Source
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.
CanCommunicationConnector
A connector between a CanCommunicationController in an ECU and a CanPhysicalChannel
CanCommunicationController
An EcuInstance needs a CanCommunicationController in order to connect to a CAN cluster.
CanFrame
A frame on a CAN bus
CanFrameTriggering
The frame triggering connects a frame to a physical channel
CanNmCluster
Can specific NmCluster attributes
CanNmClusterCoupling
A CanNmClusterCoupling couples multiple CanNmClusters, and contains CAN specific settings.
CanNmClusterSettings
Mandatory settings for a CanNmCluster
CanNmNode
A CanNmNode represents a node in a CanNmCluster.
CanPhysicalChannel
The CanPhysicalChannel contains all of the communication on a CAN network
CanTpAddress
A CanTpAddress represents a logical address in the CanTp module
CanTpChannel
A CanTpChannel represents a channel in the CanTp module
CanTpConfig
Container for CanTp configuration
CanTpConnection
A connection identifies the sender and the receiver of this particular communication. The CanTp module routes a Pdu through this connection.
CanTpEcu
A CanTpEcu represents an ECU that is using the CanTp module
CanTpNode
A CanTpNode provides the TP address and the connection to the topology description in a CanTpConfig
ComTransformationTechnologyConfig
Configuration for a COM transformation
CommonServiceDiscoveryConfig
A CommonServiceDiscoveryConfig contains common configuration settings for System::configure_service_discovery_for_ecu.
ConsumedEventGroup
A ConsumedEventGroup is a group of events in a ConsumedServiceInstance that are consumed by an ECU
ConsumedEventGroupV1
A ConsumedEventGroupV1 is a SD event group of a service instance that is consumed by this ECU.
ConsumedServiceInstance
A ConsumedServiceInstance is a service that is consumed by an ECU
ConsumedServiceInstanceV1
A ConsumedServiceInstanceV1 is a SD service instance that is consumed by this ECU.
ContainedIPduProps
Properties for an IPdu that is transmitted in a container IPdu
ContainerIPdu
Several IPdus can be collected in one ContainerIPdu based on the headerType
CyclicTiming
Cyclic timing parameters for an IPDU
DataTransformation
A DataTransformation is a chain of TransformationTechnologys that are used to transform data
DataTransformationSet
A DataTransformationSet contains DataTransformations and TransformationTechnologys used in communication
DcmIPdu
Represents the IPdus handled by Dcm
DoIpConfig
This element defines the DoIp configuration for a specific Ecu
DoIpLogicAddress
This element defines the logical address of a DoIp connection
DoIpTpConfig
Container for DoIp TP configuration
DoIpTpConnection
The DoIpTpConnection defines a DoIp transport protocol connection
E2ETransformationTechnologyConfig
Configuration for an E2E transformation
EndToEndTransformationISignalProps
Properties for the End to End transformation of an ISignal(Group)
EthernetCluster
An EthernetCluster contains all configuration items associated with an ethernet network. The cluster connects multiple ECUs.
EthernetCommunicationConnector
A connector between an EthernetCommunicationController in an ECU and an EthernetPhysicalChannel
EthernetCommunicationController
An EcuInstance needs an EthernetCommunicationController in order to connect to an ethernet cluster.
EthernetPhysicalChannel
The EthernetPhysicalChannel represents a VLAN or untagged traffic
EthernetVlanInfo
Provides information about the VLAN of an EthernetPhysicalChannel
EventControlledTiming
Event controlled timing parameters for an IPDU
EventHandler
An EventHandler describes the handling of a single event in a ProvidedServiceInstance
EventHandlerV1
An EventHandlerV1 is a SD event handler that is used to receive events from other ECUs.
FlexrayArTpChannel
The FlexrayArTpChannel represents a channel in the Flexray Autosar Transport Protocol
FlexrayArTpConfig
The FlexrayArTpConfig represents the configuration of the Flexray Autosar Transport Protocol
FlexrayArTpConnection
FlexrayArTpConnection represents a connection within a FlexrayArTpChannel
FlexrayArTpNode
FlexrayArTpNode represents a node in the Flexray Autosar Transport Protocol
FlexrayCluster
A FlexrayCluster contains all configuration items associated with a Flexray network. The cluster connects multiple ECUs.
FlexrayClusterSettings
Configuration settings of the Flexray cluster.
FlexrayCommunicationConnector
A connector between a FlexrayCommunicationController in an ECU and a FlexrayPhysicalChannel
FlexrayCommunicationController
An EcuInstance needs a FlexrayCommunicationController in order to connect to a Flexray cluster.
FlexrayFrame
a Flexray frame
FlexrayFrameTriggering
The frame triggering connects a frame to a physical channel
FlexrayNmCluster
Flexray specific NmCluster
FlexrayNmClusterCoupling
A FlexRayNmClusterCoupling couples multiple FlexrayNmClusters.
FlexrayNmClusterSettings
Mandatory settings for a FlexrayNmCluster
FlexrayNmNode
A FlexrayNmNode represents a FlexRay specific NmNode.
FlexrayPhysicalChannel
the FlexrayPhysicalChannel represents either channel A or B of Flexray cluster
FlexrayPhysicalChannelsInfo
Information about the flexray physical channels present inside a cluster
FlexrayTpConfig
FlexrayTpConfig defines exactly one FlexRay ISO TP Configuration
FlexrayTpConnection
A FlexrayTpConnection defines a connection between FlexrayTpNodes
FlexrayTpConnectionControl
A FlexrayTpConnectionControl defines the connection control parameters for a FlexrayTpConnection
FlexrayTpEcu
A FlexrayTpEcu represents an ECU within the FlexrayTpConfig
FlexrayTpNode
A FlexrayTpNode provides the TP address and the connection to the topology description in a FlexrayTpConfig
FlexrayTpPduPool
A FlexrayTpPduPool contains a set of NPdus that can be used for sending and receiving
FramePort
The FramePort allows an ECU to send or receive a frame
GeneralPurposeIPdu
This element is used for AUTOSAR Pdus without attributes that are routed by the PduR
GeneralPurposePdu
This element is used for AUTOSAR Pdus without additional attributes that are routed by a bus interface
GenericTransformationTechnologyConfig
Configuration for a generic transformation technology For a generic trasformation, the mandatory values must be chosen by the user
IPduPort
The IPduPort allows an ECU to send or receive a PDU
ISignal
Signal of the Interaction Layer
ISignalGroup
An ISignalGroup groups signals that should always be kept together
ISignalIPdu
Represents the IPdus handled by Com
ISignalPort
The ISignalPort allows an ECU to send or receive a Signal
ISignalToIPduMapping
ISignalToIPduMapping connects an ISignal or ISignalGroup to an ISignalToIPdu
ISignalTriggering
an ISignalTriggering triggers a signal in a PDU
InitialSdDelayConfig
A InitialSdDelayConfig contains the configuration for the initial delay of an SD client or server
IpduTiming
Timing specification for an IPDU
MultiplexedIPdu
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.
NetworkEndpoint
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 an EcuInstance wich participates in network management.
NmPdu
Network Management Pdu
PduActivationRoutingGroup
A group of Pdus that can be activated or deactivated for transmission over a socket connection. It is used by EventHandlers in ProvidedServiceInstances and ConsumedServiceInstances.
PduToFrameMapping
PduToFrameMapping connects a PDU to a frame
PduTriggering
a PduTriggering triggers a PDU in a frame or ethernet connection
ProvidedServiceInstance
A ProvidedServiceInstance is a service that is provided by an ECU
ProvidedServiceInstanceV1
A ProvidedServiceInstanceV1 is a SD service instance that is provided by this ECU.
RequestResponseDelay
A RequestResponseDelay contains the minimum and maximum delay for a request-response cycle
SdConfig
SD configuration for a service instance
SdEventConfig
Configuration for an SD event handler
SecureCommunicationProps
The properties of a SecuredIPdu
SecuredIPdu
Wraps an IPdu to protect it from unauthorized manipulation
ServiceInstanceCollectionSet
A ServiceInstanceCollectionSet contains ServiceInstances that are provided or consumed by an ECU
SignalMappingValidator
Helper struct to validate signal mappings
SoAdRoutingGroup
A SoAdRoutingGroup is used to link SomeIp settings in Consumed/ProvidedServiceInstances to the SocketConnectionBundles used for transmission. SoAdRoutingGroups are part of the old way of configuring Ethernet communication in AUTOSAR.
SoConIPduIdentifier
A SoConIPduIdentifier describes a PDU that is transported over a static socket connection.
SocketAddress
A socket address establishes the link between one or more ECUs and a NetworkEndpoint. It contains all settings that are relevant for this combination.
SocketConnection
A socketConnection inside a SocketConnectionBundle describes a single connection to a specific client port.
SocketConnectionBundle
A SocketConnectionBundle describes a connection between a server port and multiple client ports. It contains multiple bundled connections, each transporting one or more PDUs.
SocketConnectionIpduIdentifier
A SocketConnectionIpduIdentifier is used to trigger a PDU in a SocketConnection.
SocketConnectionIpduIdentifierSet
A SocketConnectionIpduIdentifierSet contains a set of SoConIPduIdentifiers, which are used in static socket connections and in SomeIp events.
SomeIpTransformationISignalProps
Properties for the SOMEIP transformation of an ISignal(Group)
SomeIpTransformationTechnologyConfig
Configuration for a SOMEIP transformation
SomeipSdClientEventGroupTimingConfig
A SomeipSdClientEventGroupTimingConfig contains the configuration for the timing of a ConsumedEventGroup
SomeipSdClientServiceInstanceConfig
A SomeipSdClientServiceInstanceConfig is a configuration for a ConsumedServiceInstance
SomeipSdServerEventGroupTimingConfig
A SomeipSdServerEventGroupTimingConfig contains the configuration for the timing of an EventHandler
SomeipSdServerServiceInstanceConfig
A SomeipSdServerServiceInstanceConfig is a configuration for a ProvidedServiceInstance
SomeipTpChannel
General settings for a SomeIp TP channel
SomeipTpConfig
A SomipTpConfig contains the configuration of individual SomeIp TP connections
SomeipTpConnection
A SomeipTpConnection contains the configuration of a single SomeIp TP connection
StaticSocketConnection
A static socket connection is a connection between two sockets.
SystemSignal
The system signal represents the communication system’s view of data exchanged between SW components which reside on different ECUs
SystemSignalGroup
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
TransformationTechnology
A TransformationTechnology describes how to transform signal or PDU data
TransmissionModeTiming
Cyclic and event controlled timing parameters for an IPDU
UdpNmCluster
Udp / Ethernet specific NmCluster
UdpNmClusterCoupling
Udp / Ethernet specific NmClusterCoupling
UdpNmClusterSettings
UdpNmClusterSettings encapsulates the mandatory settings for a UdpNmCluster
UdpNmNode
Udp / Ethernet specific NmNode

Enums§

CanAddressingMode
The addressing mode for a CAN frame
CanFrameType
The type of a CAN frame
CanTpAddressingFormat
The addressing format of a CanTpConnection
CanTpChannelMode
The mode of a CanTpChannel
Cluster
A Cluster is returned by System::clusters. It can contain any supported communication cluster.
CommunicationConnector
wraps all different kinds of communication connector
CommunicationController
wraps all different kinds of communication controller
CommunicationDirection
The CommunicationDirection is used by the communication ports for frames, PDUs and signals
ContainedIPduCollectionSemantics
collection semantics for the ContainedIPdu
ContainerIPduHeaderType
The header type of a ContainerIPdu
ContainerIPduTrigger
Defines when the transmission of the ContainerIPdu shall be requested
CycleRepetition
The cycle repetition of a Flexray frame, from the Flexray standard
DataIdMode
data ID modes for E2E profiles 01 and 11
E2EProfile
enumeration of the possible E2E profiles
E2EProfileBehavior
there are two standardized behaviors for E2E profiles, which can be selected for each E2E transformation
EventGroupControlType
control types used in routing groups for SOME/IP events
FlexrayChannelName
A flexray cluster may contain the channels A and/or B.
FlexrayCommunicationCycle
The timing settings of a Flexray frame
FlexrayNmScheduleVariant
The FlexrayNmScheduleVariant defines the way the NM-Vote and NM-Data are transmitted within the FlexRay network.
FrArTpAckType
Types of Acknowledgement that can be used in an FlexrayArTpChannel
Frame
A wrapper for CAN and FlexRay frames (Ethernet does not use frames)
FrameTriggering
A wrapper for CAN and FlexRay frame triggerings
GeneralPurposeIPduCategory
The category of a GeneralPurposeIPdu
GeneralPurposePduCategory
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
IPv4AddressSource
IPv4AddressSource defines how the address of an IPv4 NetworkEndpoint is obtained
IPv6AddressSource
IPv6AddressSource defines how the address of an IPv6 NetworkEndpoint is obtained
LocalUnicastAddress
A LocalUnicastAddress is a local address (TCP or UDP) that can be used for a ProvidedServiceInstance or ConsumedServiceInstance
MaximumMessageLengthType
Types of Maximum Message Length that can be used in an FlexrayArTpChannel
NetworkEndpointAddress
address information for a network endpoint
NmCluster
The NmCluster encapsulates the bus specific NM clusters.
NmClusterCoupling
Wrapper for the different types of NmClusterCoupling; this type is returned by the iterator over NmClusterCouplings.
Pdu
Wrapper for all Pdu types. It is used as a return value for functions that can return any Pdu type
PduCollectionTrigger
The collction trigger defines whether a Pdu contributes to the triggering of the data transmission if Pdu collection is enabled
PhysicalChannel
A physical channel is a communication channel between two ECUs.
RxAcceptContainedIPdu
The RxAcceptContainedIPdu enum defines whether a fixed set of contained IPdus is accepted or all contained IPdus
ServiceInstance
A ServiceInstance is a service that is provided or consumed by an ECU
SocketAddressType
Describes if a SocketAddress is used for unicast or multicast
SomeIpMessageType
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) or Listen (=server).
TpConfig
transport protocol settings of a SocketAddress
TransferProperty
The TransferProperty defines if or how the signal influences the transfer of the PDU
TransformationISignalProps
Wrapper enum for the properties for the transformation of an ISignal(Group)
TransformationTechnologyConfig
The configuration of any kind of TransformationTechnology

Traits§

AbstractCluster
AbstractCluster defines the common interface for all supported communication clusters.
AbstractCommunicationConnector
A trait for all communication connectors
AbstractCommunicationController
A trait for all communication controllers
AbstractFrame
A trait for all frame types
AbstractFrameTriggering
A trait for all frame triggerings
AbstractIpdu
for now this is a marker trait to identify IPdus
AbstractNmCluster
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.
AbstractNmClusterCoupling
The NmClusterCoupling is used to couple two NmClusters together.
AbstractNmNode
AbstractNmNode is a common interface for all bus specific NM nodes and provides common functionality.
AbstractPdu
This trait is implemented by all Pdus
AbstractPhysicalChannel
trait for physical channels