Struct System

Source
pub struct System(/* private fields */);
Expand description

The System is the top level of a system template

It defines how ECUs communicate with each other over various networks. It also contains the mapping of software components to ECUs.

Implementations§

Source§

impl System

Source

pub fn set_category( &self, category: SystemCategory, ) -> Result<(), AutosarAbstractionError>

set the category of the system

Source

pub fn category(&self) -> Option<SystemCategory>

get the category of the system

Source

pub fn set_pnc_vector_length( &self, length: Option<u32>, ) -> Result<(), AutosarAbstractionError>

set the pncVectorLength of the system

Source

pub fn pnc_vector_length(&self) -> Option<u32>

get the pncVectorLength of the system

Source

pub fn set_pnc_vector_offset( &self, offset: Option<u32>, ) -> Result<(), AutosarAbstractionError>

set the pncVectorOffset of the system

Source

pub fn pnc_vector_offset(&self) -> Option<u32>

get the pncVectorOffset of the system

Source

pub fn create_ecu_instance( &self, name: &str, package: &ArPackage, ) -> Result<EcuInstance, AutosarAbstractionError>

create an EcuInstance that is connected to this System

§Example
let system = package1.create_system("System", SystemCategory::SystemExtract)?;
let ecu_instance = system.create_ecu_instance("ecu_name", &package2)?;
§Errors
Source

pub fn ecu_instances( &self, ) -> impl Iterator<Item = EcuInstance> + Send + 'static

get an iterator over all ECU-INSTANCEs in this SYSTEM

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
system.create_ecu_instance("ecu_name1", &package)?;
system.create_ecu_instance("ecu_name2", &package)?;
for ecu in system.ecu_instances() {
    // do something
}
assert_eq!(system.ecu_instances().count(), 2);
Source

pub fn create_can_cluster( &self, cluster_name: &str, package: &ArPackage, can_baudrate: Option<u32>, ) -> Result<CanCluster, AutosarAbstractionError>

create a new CAN-CLUSTER

The cluster must have a channel to be valid, but this channel is not created automatically. Call CanCluster::create_physical_channel to create it.

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let cluster = system.create_can_cluster("can_cluster", &package, None)?;
cluster.create_physical_channel("can_channel");
§Errors
Source

pub fn create_ethernet_cluster( &self, cluster_name: &str, package: &ArPackage, ) -> Result<EthernetCluster, AutosarAbstractionError>

create a new ETHERNET-CLUSTER and connect it to the SYSTEM

The cluster must have at least one channel to be valid. Call EthernetCluster::create_physical_channel to create it.

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let cluster = system.create_ethernet_cluster("ethernet_cluster", &package)?;
let vlan_info = EthernetVlanInfo { vlan_name: "VLAN_1".to_string(), vlan_id: 1};
cluster.create_physical_channel("ethernet_channel", Some(&vlan_info));
§Errors
Source

pub fn create_flexray_cluster( &self, cluster_name: &str, package: &ArPackage, settings: &FlexrayClusterSettings, ) -> Result<FlexrayCluster, AutosarAbstractionError>

create a new FLEXRAY-CLUSTER and connect it to the SYSTEM

A FlexrayClusterSettings structure containing the timings and parameters for the Flexray cluster must be provided.

The cluster must have at least one channel to be valid. Call FlexrayCluster::create_physical_channel to create it.

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let cluster = system.create_flexray_cluster("flexray_cluster", &package, &FlexrayClusterSettings::default())?;
cluster.create_physical_channel("flexray_channel", FlexrayChannelName::A);
§Errors
Source

pub fn clusters(&self) -> impl Iterator<Item = Cluster> + Send + 'static

Create an iterator over all clusters connected to the SYSTEM

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
system.create_can_cluster("can_cluster", &package, None)?;
system.create_flexray_cluster("flexray_cluster", &package, &FlexrayClusterSettings::default())?;
for cluster in system.clusters() {
    // do something
}
assert_eq!(system.clusters().count(), 2);
Source

pub fn create_can_frame( &self, name: &str, package: &ArPackage, byte_length: u64, ) -> Result<CanFrame, AutosarAbstractionError>

create a new CanFrame

This new frame needs to be linked to a CanPhysicalChannel

Source

pub fn create_flexray_frame( &self, name: &str, package: &ArPackage, byte_length: u64, ) -> Result<FlexrayFrame, AutosarAbstractionError>

create a new FlexrayFrame

This new frame needs to be linked to a FlexrayPhysicalChannel

Source

pub fn frames(&self) -> impl Iterator<Item = Frame> + Send + 'static

iterate over all Frames in the System

This iterator returns all CAN and Flexray frames that are connected to the System using a FibexElementRef.

Source

pub fn create_isignal( &self, name: &str, package: &ArPackage, bit_length: u64, syssignal: &SystemSignal, datatype: Option<&SwBaseType>, ) -> Result<ISignal, AutosarAbstractionError>

create a new isignal in the System

§Example
let sig_package = model.get_or_create_package("/ISignals")?;
let sys_package = model.get_or_create_package("/SystemSignals")?;
let system_signal = sys_package.create_system_signal("signal1")?;
system.create_isignal("signal1", &sig_package, 32, &system_signal, None)?;
§Errors
Source

pub fn isignals(&self) -> impl Iterator<Item = ISignal> + Send + 'static

iterate over all ISignals in the System

This iterator returns all ISignals that are connected to the System using a FibexElementRef.

Source

pub fn create_isignal_group( &self, name: &str, package: &ArPackage, system_signal_group: &SystemSignalGroup, ) -> Result<ISignalGroup, AutosarAbstractionError>

create a new signal group in the System

I-SIGNAL-GROUP and SYSTEM-SIGNAL-GROUP are created using the same name; therefore they must be placed in different packages: sig_package and sys_package may not be identical.

§Example
let sig_package = model.get_or_create_package("/ISignals")?;
let sys_package = model.get_or_create_package("/SystemSignals")?;
let system_signal_group = sys_package.create_system_signal_group("signalgroup")?;
system.create_isignal_group("signal_group", &sig_package, &system_signal_group)?;
§Errors
Source

pub fn isignal_groups( &self, ) -> impl Iterator<Item = ISignalGroup> + Send + 'static

iterate over all ISignalGroups in the System

This iterator returns all ISignalGroups that are connected to the System using a FibexElementRef.

Source

pub fn create_isignal_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<ISignalIPdu, AutosarAbstractionError>

create an ISignalIPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_isignal_ipdu("pdu", &package, 42)?;
§Errors
Source

pub fn create_nm_pdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<NmPdu, AutosarAbstractionError>

create an NmPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_nm_pdu("pdu", &package, 42)?;
§Errors
Source

pub fn create_n_pdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<NPdu, AutosarAbstractionError>

create an NPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_n_pdu("pdu", &package, 42)?;
§Errors
Source

pub fn create_dcm_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<DcmIPdu, AutosarAbstractionError>

create a DcmIPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_dcm_ipdu("pdu", &package, 42)?;
§Errors
Source

pub fn create_general_purpose_pdu( &self, name: &str, package: &ArPackage, length: u32, category: GeneralPurposePduCategory, ) -> Result<GeneralPurposePdu, AutosarAbstractionError>

create a GeneralPurposePdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_general_purpose_pdu("pdu", &package, 42, GeneralPurposePduCategory::GlobalTime)?;
§Errors
Source

pub fn create_general_purpose_ipdu( &self, name: &str, package: &ArPackage, length: u32, category: GeneralPurposeIPduCategory, ) -> Result<GeneralPurposeIPdu, AutosarAbstractionError>

create a GeneralPurposeIPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_general_purpose_ipdu("pdu", &package, 42, GeneralPurposeIPduCategory::Xcp)?;
§Errors
Source

pub fn create_container_ipdu( &self, name: &str, package: &ArPackage, length: u32, header_type: ContainerIPduHeaderType, rx_accept: RxAcceptContainedIPdu, ) -> Result<ContainerIPdu, AutosarAbstractionError>

create a ContainerIPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_container_ipdu("pdu", &package, 42, ContainerIPduHeaderType::ShortHeader, RxAcceptContainedIPdu::AcceptAll)?;
§Errors
Source

pub fn create_secured_ipdu( &self, name: &str, package: &ArPackage, length: u32, secure_props: &SecureCommunicationProps, ) -> Result<SecuredIPdu, AutosarAbstractionError>

create a SecuredIPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
let secure_communication_props = SecureCommunicationProps::default();
system.create_secured_ipdu("pdu", &package, 42, &secure_communication_props)?;
§Errors
Source

pub fn create_multiplexed_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<MultiplexedIPdu, AutosarAbstractionError>

create a MultiplexedIPdu in the System

§Example
let package = model.get_or_create_package("/Pdus")?;
system.create_multiplexed_ipdu("pdu", &package, 42)?;
§Errors
Source

pub fn pdus(&self) -> impl Iterator<Item = Pdu> + Send + 'static

iterate over all PDUs in the System

This iterator returns all PDUs that are connected to the System using a FibexElementRef.

Source

pub fn create_socket_connection_ipdu_identifier_set( &self, name: &str, package: &ArPackage, ) -> Result<SocketConnectionIpduIdentifierSet, AutosarAbstractionError>

Create a SocketConnectionIpduIdentifierSet in the SYSTEM

SocketConnectionIpduIdentifierSet are part of the new ethernet modeling that was introduced in Autosar 4.5.0 (AUTOSAR_00048).

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let set = system.create_socket_connection_ipdu_identifier_set("set", &package)?;
Source

pub fn create_so_ad_routing_group( &self, name: &str, package: &ArPackage, control_type: Option<EventGroupControlType>, ) -> Result<SoAdRoutingGroup, AutosarAbstractionError>

Create a SoAdRoutingGroup in the SYSTEM

SoAdRoutingGroup are part of the old ethernet modeling that was used prior to Autosar 4.5.0 (AUTOSAR_00048). The elements are still present (but obsolete) in newer versions of the standard. Old and new elements may not be mixed in the same model.

Source

pub fn create_service_instance_collection_set( &self, name: &str, package: &ArPackage, ) -> Result<ServiceInstanceCollectionSet, AutosarAbstractionError>

Create a ServiceInstanceCollectionSet in the SYSTEM

ServiceInstanceCollectionSets are part of the new ethernet modeling that was introduced in Autosar 4.5.0 (AUTOSAR_00048).

Source

pub fn create_someip_tp_config<T: Into<Cluster> + Clone>( &self, name: &str, package: &ArPackage, cluster: &T, ) -> Result<SomeipTpConfig, AutosarAbstractionError>

Create a SomeipTpConfig in the SYSTEM

SomeipTpConfigs contain the configuration how to segment or reassemble large SomeipTp PDUs.

Source

pub fn create_can_tp_config( &self, name: &str, package: &ArPackage, can_cluster: &CanCluster, ) -> Result<CanTpConfig, AutosarAbstractionError>

Create a CanTpConfig in the SYSTEM

CanTpConfigs contain the configuration how to segment or reassemble diagnostic messages on a CAN bus.

Source

pub fn create_doip_tp_config( &self, name: &str, package: &ArPackage, eth_cluster: &EthernetCluster, ) -> Result<DoIpTpConfig, AutosarAbstractionError>

Create a DoIpTpConfig in the SYSTEM

DoIpTpConfigs contain the configuration how to transmit diagnostic messages over IP networks.

Source

pub fn create_flexray_tp_config( &self, name: &str, package: &ArPackage, flexray_cluster: &FlexrayCluster, ) -> Result<FlexrayTpConfig, AutosarAbstractionError>

Create a FlexRayTpConfig in the SYSTEM

FlexRayTpConfigs describe how to segment or reassemble diagnostic messages on a FlexRay bus. This configuration type is used for Flexray ISO TP communication.

Source

pub fn create_flexray_ar_tp_config( &self, name: &str, package: &ArPackage, flexray_cluster: &FlexrayCluster, ) -> Result<FlexrayArTpConfig, AutosarAbstractionError>

Create a FlexrayArTpConfig in the SYSTEM

FlexrayArTpConfigs describe how to segment or reassemble diagnostic messages on a FlexRay bus. This configuration type is used for Flexray AUTOSAR TP communication.

Source

pub fn create_nm_config( &self, name: &str, package: &ArPackage, ) -> Result<NmConfig, AutosarAbstractionError>

Create a new NmConfig in the SYSTEM

NmConfigs contain the configuration for network management. The System may contain zero or one NmConfigs.

Source

pub fn nm_config(&self) -> Option<NmConfig>

Get the NmConfig of the SYSTEM, if any

The System may contain zero or one NmConfigs.

Source

pub fn create_fibex_element_ref( &self, elem: &Element, ) -> Result<(), AutosarAbstractionError>

connect an element to the SYSTEM by creating a FIBEX-ELEMENT-REF

If there is already a FIBEX-ELEMENT-REF, this function does nothing, successfully.

§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let can_cluster = pkg_elements.create_named_sub_element(ElementName::CanCluster, "Cluster")?;
system.create_fibex_element_ref(&can_cluster)?;
§Errors
Source

pub fn set_root_sw_composition( &self, name: &str, composition_type: &CompositionSwComponentType, ) -> Result<RootSwCompositionPrototype, AutosarAbstractionError>

set the root software composition of the system

When the root software composition is set, a root sw composition prototype is created for it. This function will remove any existing root sw composition prototype

Source

pub fn root_sw_composition(&self) -> Option<RootSwCompositionPrototype>

get the root software composition of the system

Source

pub fn get_or_create_mapping( &self, name: &str, ) -> Result<SystemMapping, AutosarAbstractionError>

get or create a mapping for this system

There does not seem to be any benefit to having multiple mappings for a single system, so this function will return the first mapping if it exists. Otherwise a new mapping will be created with the provided name.

Trait Implementations§

Source§

impl AbstractionElement for System

Source§

fn element(&self) -> &Element

Get the underlying Element from the abstraction element
Source§

impl Clone for System

Source§

fn clone(&self) -> System

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for System

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<System> for Element

Source§

fn from(val: System) -> Self

Converts to this type from the input type.
Source§

impl Hash for System

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IdentifiableAbstractionElement for System

Source§

fn name(&self) -> Option<String>

Get the item name of the element
Source§

fn set_name(&self, name: &str) -> Result<(), AutosarAbstractionError>

Set the item name of the element
Source§

impl PartialEq for System

Source§

fn eq(&self, other: &System) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<Element> for System

Source§

type Error = AutosarAbstractionError

The type returned in the event of a conversion error.
Source§

fn try_from(element: Element) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for System

Source§

impl StructuralPartialEq for System

Auto Trait Implementations§

§

impl Freeze for System

§

impl !RefUnwindSafe for System

§

impl Send for System

§

impl Sync for System

§

impl Unpin for System

§

impl !UnwindSafe for System

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.