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
impl System
Sourcepub fn find(model: &AutosarModel) -> Option<Self>
pub fn find(model: &AutosarModel) -> Option<Self>
find an existing <SYSTEM> in the model, or return None
§Example
let model = AutosarModel::new();
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let sys_2 = System::find(&model).unwrap();
assert_eq!(system, sys_2);Sourcepub fn create_ecu_instance(
&self,
name: &str,
package: &ArPackage,
) -> Result<EcuInstance, AutosarAbstractionError>
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
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create the ECU-INSTANCE
Sourcepub fn ecu_instances(&self) -> impl Iterator<Item = EcuInstance>
pub fn ecu_instances(&self) -> impl Iterator<Item = EcuInstance>
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);Sourcepub fn create_can_cluster(
&self,
cluster_name: &str,
package: &ArPackage,
settings: &CanClusterSettings,
) -> Result<CanCluster, AutosarAbstractionError>
pub fn create_can_cluster( &self, cluster_name: &str, package: &ArPackage, settings: &CanClusterSettings, ) -> 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.
Use the CanClusterSettings to define the baudrates for Can, CanFD, and CanXL.
§Example
let system = package.create_system("System", SystemCategory::SystemExtract)?;
let cluster = system.create_can_cluster("can_cluster", &package, &CanClusterSettings::default())?;
cluster.create_physical_channel("can_channel");§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create the can cluster
Sourcepub fn create_ethernet_cluster(
&self,
cluster_name: &str,
package: &ArPackage,
) -> Result<EthernetCluster, AutosarAbstractionError>
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
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create the ethernet cluster
Sourcepub fn create_flexray_cluster(
&self,
cluster_name: &str,
package: &ArPackage,
settings: &FlexrayClusterSettings,
) -> Result<FlexrayCluster, AutosarAbstractionError>
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
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create the flexray cluster
Sourcepub fn create_can_frame(
&self,
name: &str,
package: &ArPackage,
byte_length: u64,
) -> Result<CanFrame, AutosarAbstractionError>
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
Sourcepub fn create_flexray_frame(
&self,
name: &str,
package: &ArPackage,
byte_length: u64,
) -> Result<FlexrayFrame, AutosarAbstractionError>
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
Sourcepub fn create_isignal(
&self,
name: &str,
package: &ArPackage,
bit_length: u64,
syssignal: &SystemSignal,
datatype: Option<&SwBaseType>,
) -> Result<ISignal, AutosarAbstractionError>
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 = ArPackage::get_or_create(&model, "/ISignals")?;
let sys_package = ArPackage::get_or_create(&model, "/SystemSignals")?;
let system_signal = sys_package.create_system_signal("signal1")?;
system.create_isignal("signal1", &sig_package, 32, &system_signal, None)?;§Errors
AutosarAbstractionError::InvalidParametersig_packageandsys_packagemay not be identicalAutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_i_signal_group(
&self,
name: &str,
package: &ArPackage,
system_signal_group: &SystemSignalGroup,
) -> Result<ISignalGroup, AutosarAbstractionError>
pub fn create_i_signal_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 = ArPackage::get_or_create(&model, "/ISignals")?;
let sys_package = ArPackage::get_or_create(&model, "/SystemSignals")?;
let system_signal_group = sys_package.create_system_signal_group("signalgroup")?;
system.create_i_signal_group("signal_group", &sig_package, &system_signal_group)?;§Errors
AutosarAbstractionError::InvalidParametersig_packageandsys_packagemay not be identicalAutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_isignal_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<ISignalIPdu, AutosarAbstractionError>
pub fn create_isignal_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<ISignalIPdu, AutosarAbstractionError>
create an ISignalIPdu in the System
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_isignal_ipdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_nm_pdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<NmPdu, AutosarAbstractionError>
pub fn create_nm_pdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<NmPdu, AutosarAbstractionError>
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_nm_pdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_n_pdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<NPdu, AutosarAbstractionError>
pub fn create_n_pdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<NPdu, AutosarAbstractionError>
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_n_pdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_dcm_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<DcmIPdu, AutosarAbstractionError>
pub fn create_dcm_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<DcmIPdu, AutosarAbstractionError>
create a DcmIPdu in the System
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_dcm_ipdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_general_purpose_pdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
category: GeneralPurposePduCategory,
) -> Result<GeneralPurposePdu, AutosarAbstractionError>
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 = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_general_purpose_pdu("pdu", &package, 42, GeneralPurposePduCategory::GlobalTime)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_general_purpose_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
category: GeneralPurposeIPduCategory,
) -> Result<GeneralPurposeIPdu, AutosarAbstractionError>
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 = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_general_purpose_ipdu("pdu", &package, 42, GeneralPurposeIPduCategory::Xcp)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_container_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<ContainerIPdu, AutosarAbstractionError>
pub fn create_container_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<ContainerIPdu, AutosarAbstractionError>
create a ContainerIPdu in the System
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_container_ipdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_secured_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<SecuredIPdu, AutosarAbstractionError>
pub fn create_secured_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<SecuredIPdu, AutosarAbstractionError>
create a SecuredIPdu in the System
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_secured_ipdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn create_multiplexed_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
) -> Result<MultiplexedIPdu, AutosarAbstractionError>
pub fn create_multiplexed_ipdu( &self, name: &str, package: &ArPackage, length: u32, ) -> Result<MultiplexedIPdu, AutosarAbstractionError>
create a MultiplexedIPdu in the System
§Example
let package = ArPackage::get_or_create(&model, "/Pdus")?;
system.create_multiplexed_ipdu("pdu", &package, 42)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model while trying to create elements
Sourcepub fn clusters(&self) -> impl Iterator<Item = Cluster>
pub fn clusters(&self) -> impl Iterator<Item = Cluster>
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, &CanClusterSettings::default())?;
system.create_flexray_cluster("flexray_cluster", &package, &FlexrayClusterSettings::default())?;
for cluster in system.clusters() {
// do something
}
assert_eq!(system.clusters().count(), 2);Sourcepub fn create_socket_connection_ipdu_identifier_set(
&self,
name: &str,
package: &ArPackage,
) -> Result<SocketConnectionIpduIdentifierSet, AutosarAbstractionError>
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)?;Sourcepub fn create_so_ad_routing_group(
&self,
name: &str,
package: &ArPackage,
control_type: Option<EventGroupControlType>,
) -> Result<SoAdRoutingGroup, AutosarAbstractionError>
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.
Sourcepub fn create_service_instance_collection_set(
&self,
name: &str,
package: &ArPackage,
) -> Result<ServiceInstanceCollectionSet, AutosarAbstractionError>
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).
Sourcepub fn create_somip_tp_config<T: Into<Cluster> + Clone>(
&self,
name: &str,
package: &ArPackage,
cluster: &T,
) -> Result<SomeipTpConfig, AutosarAbstractionError>
pub fn create_somip_tp_config<T: Into<Cluster> + Clone>( &self, name: &str, package: &ArPackage, cluster: &T, ) -> Result<SomeipTpConfig, AutosarAbstractionError>
Create a SomipTpConfig in the SYSTEM
SomeipTpConfigs contain the configuration how to segment or reassemble large SomipTp PDUs.
Sourcepub fn create_can_tp_config(
&self,
name: &str,
package: &ArPackage,
can_cluster: &CanCluster,
) -> Result<CanTpConfig, AutosarAbstractionError>
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.
Sourcepub fn create_doip_tp_config(
&self,
name: &str,
package: &ArPackage,
eth_cluster: &EthernetCluster,
) -> Result<DoIpTpConfig, AutosarAbstractionError>
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.
Sourcepub fn create_flexray_tp_config(
&self,
name: &str,
package: &ArPackage,
flexray_cluster: &FlexrayCluster,
) -> Result<FlexrayTpConfig, AutosarAbstractionError>
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.
Sourcepub fn create_flexray_ar_tp_config(
&self,
name: &str,
package: &ArPackage,
flexray_cluster: &FlexrayCluster,
) -> Result<FlexrayArTpConfig, AutosarAbstractionError>
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.
Sourcepub fn create_nm_config(
&self,
name: &str,
package: &ArPackage,
) -> Result<NmConfig, AutosarAbstractionError>
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.
Sourcepub fn create_fibex_element_ref(
&self,
elem: &Element,
) -> Result<(), AutosarDataError>
pub fn create_fibex_element_ref( &self, elem: &Element, ) -> Result<(), AutosarDataError>
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").unwrap();
system.create_fibex_element_ref(&can_cluster)?;§Errors
AutosarAbstractionError::ModelErrorAn error occurred in the Autosar model
Sourcepub fn set_root_sw_composition(
&self,
name: &str,
composition_type: &CompositionSwComponentType,
) -> Result<RootSwCompositionPrototype, AutosarAbstractionError>
pub fn set_root_sw_composition( &self, name: &str, composition_type: &CompositionSwComponentType, ) -> Result<RootSwCompositionPrototype, AutosarAbstractionError>
set the root software composition of the system
This function will remove any existing root software composition
Sourcepub fn root_composition(&self) -> Option<RootSwCompositionPrototype>
pub fn root_composition(&self) -> Option<RootSwCompositionPrototype>
get the root software composition of the system
Sourcepub fn get_or_create_mapping(
&self,
name: &str,
) -> Result<SystemMapping, AutosarAbstractionError>
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
impl AbstractionElement for System
impl Eq for System
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.