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 set_category(
&self,
category: SystemCategory,
) -> Result<(), AutosarAbstractionError>
pub fn set_category( &self, category: SystemCategory, ) -> Result<(), AutosarAbstractionError>
set the category of the system
Sourcepub fn category(&self) -> Option<SystemCategory>
pub fn category(&self) -> Option<SystemCategory>
get the category of the system
Sourcepub fn set_pnc_vector_length(
&self,
length: Option<u32>,
) -> Result<(), AutosarAbstractionError>
pub fn set_pnc_vector_length( &self, length: Option<u32>, ) -> Result<(), AutosarAbstractionError>
set the pncVectorLength of the system
Sourcepub fn pnc_vector_length(&self) -> Option<u32>
pub fn pnc_vector_length(&self) -> Option<u32>
get the pncVectorLength of the system
Sourcepub fn set_pnc_vector_offset(
&self,
offset: Option<u32>,
) -> Result<(), AutosarAbstractionError>
pub fn set_pnc_vector_offset( &self, offset: Option<u32>, ) -> Result<(), AutosarAbstractionError>
set the pncVectorOffset of the system
Sourcepub fn pnc_vector_offset(&self) -> Option<u32>
pub fn pnc_vector_offset(&self) -> Option<u32>
get the pncVectorOffset of the system
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::ModelError
An error occurred in the Autosar model while trying to create the ECU-INSTANCE
Sourcepub fn ecu_instances(
&self,
) -> impl Iterator<Item = EcuInstance> + Send + 'static
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);
Sourcepub fn create_can_cluster(
&self,
cluster_name: &str,
package: &ArPackage,
can_baudrate: Option<u32>,
) -> Result<CanCluster, AutosarAbstractionError>
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
AutosarAbstractionError::ModelError
An 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::ModelError
An 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::ModelError
An error occurred in the Autosar model while trying to create the flexray cluster
Sourcepub fn clusters(&self) -> impl Iterator<Item = Cluster> + Send + 'static
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);
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 frames(&self) -> impl Iterator<Item = Frame> + Send + 'static
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
.
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 = 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
AutosarAbstractionError::InvalidParameter
sig_package
andsys_package
may not be identicalAutosarAbstractionError::ModelError
An error occurred in the Autosar model while trying to create elements
Sourcepub fn isignals(&self) -> impl Iterator<Item = ISignal> + Send + 'static
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
.
Sourcepub fn create_isignal_group(
&self,
name: &str,
package: &ArPackage,
system_signal_group: &SystemSignalGroup,
) -> Result<ISignalGroup, AutosarAbstractionError>
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
AutosarAbstractionError::InvalidParameter
sig_package
andsys_package
may not be identicalAutosarAbstractionError::ModelError
An error occurred in the Autosar model while trying to create elements
Sourcepub fn isignal_groups(
&self,
) -> impl Iterator<Item = ISignalGroup> + Send + 'static
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
.
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 = model.get_or_create_package("/Pdus")?;
system.create_isignal_ipdu("pdu", &package, 42)?;
§Errors
AutosarAbstractionError::ModelError
An 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 = model.get_or_create_package("/Pdus")?;
system.create_nm_pdu("pdu", &package, 42)?;
§Errors
AutosarAbstractionError::ModelError
An 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 = model.get_or_create_package("/Pdus")?;
system.create_n_pdu("pdu", &package, 42)?;
§Errors
AutosarAbstractionError::ModelError
An 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 = model.get_or_create_package("/Pdus")?;
system.create_dcm_ipdu("pdu", &package, 42)?;
§Errors
AutosarAbstractionError::ModelError
An 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 = model.get_or_create_package("/Pdus")?;
system.create_general_purpose_pdu("pdu", &package, 42, GeneralPurposePduCategory::GlobalTime)?;
§Errors
AutosarAbstractionError::ModelError
An 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 = model.get_or_create_package("/Pdus")?;
system.create_general_purpose_ipdu("pdu", &package, 42, GeneralPurposeIPduCategory::Xcp)?;
§Errors
AutosarAbstractionError::ModelError
An error occurred in the Autosar model while trying to create elements
Sourcepub fn create_container_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
header_type: ContainerIPduHeaderType,
rx_accept: RxAcceptContainedIPdu,
) -> Result<ContainerIPdu, AutosarAbstractionError>
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
AutosarAbstractionError::ModelError
An error occurred in the Autosar model while trying to create elements
Sourcepub fn create_secured_ipdu(
&self,
name: &str,
package: &ArPackage,
length: u32,
secure_props: &SecureCommunicationProps,
) -> Result<SecuredIPdu, AutosarAbstractionError>
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
AutosarAbstractionError::ModelError
An 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 = model.get_or_create_package("/Pdus")?;
system.create_multiplexed_ipdu("pdu", &package, 42)?;
§Errors
AutosarAbstractionError::ModelError
An error occurred in the Autosar model while trying to create elements
Sourcepub fn pdus(&self) -> impl Iterator<Item = Pdu> + Send + 'static
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
.
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
ServiceInstanceCollectionSet
s are part of the new ethernet modeling that was introduced in Autosar 4.5.0 (AUTOSAR_00048
).
Sourcepub fn create_someip_tp_config<T: Into<Cluster> + Clone>(
&self,
name: &str,
package: &ArPackage,
cluster: &T,
) -> Result<SomeipTpConfig, AutosarAbstractionError>
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
SomeipTpConfig
s contain the configuration how to segment or reassemble large SomeipTp
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
CanTpConfig
s 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
DoIpTpConfig
s 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
FlexRayTpConfig
s 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
FlexrayArTpConfig
s 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
NmConfig
s contain the configuration for network management.
The System may contain zero or one NmConfig
s.
Sourcepub fn nm_config(&self) -> Option<NmConfig>
pub fn nm_config(&self) -> Option<NmConfig>
Get the NmConfig
of the SYSTEM, if any
The System may contain zero or one NmConfig
s.
Sourcepub fn create_fibex_element_ref(
&self,
elem: &Element,
) -> Result<(), AutosarAbstractionError>
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
AutosarAbstractionError::ModelError
An 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
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
Sourcepub fn root_sw_composition(&self) -> Option<RootSwCompositionPrototype>
pub fn root_sw_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.