0% found this document useful (0 votes)
2 views16 pages

CPS Module 3

The document outlines the transformation of user-level vehicle features into software components for automotive systems, detailing the process from feature definition to ECU mapping and integration. It emphasizes the importance of real-time performance, scheduling, and fault tolerance in Cyber-Physical Systems (CPS), particularly in automotive applications. Additionally, it discusses network congestion issues and the need for real-time networks, as well as the integration of Safe Reinforcement Learning to ensure safety in intelligent CPS.

Uploaded by

akash.2211005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views16 pages

CPS Module 3

The document outlines the transformation of user-level vehicle features into software components for automotive systems, detailing the process from feature definition to ECU mapping and integration. It emphasizes the importance of real-time performance, scheduling, and fault tolerance in Cyber-Physical Systems (CPS), particularly in automotive applications. Additionally, it discusses network congestion issues and the need for real-time networks, as well as the integration of Safe Reinforcement Learning to ensure safety in intelligent CPS.

Uploaded by

akash.2211005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

FROM FEATURES TO AUTOMOTIVE SOFTWARE COMPONENTS

It refers to the process of turning user-level vehicle features (like Adaptive Cruise Control or Lane
Keeping Assist) into software-implemented components that run on embedded Electronic Control Units
(ECUs) in a vehicle. This process is crucial in modern automotive development, especially with the rise of
AUTOSAR (AUTomotive Open System ARchitecture), Model-Based Design, and increasing system
complexity.

TRANSFORMATION PROCESS
1. Feature Definition (User-Level)
At this level, features are defined based on customer requirements or OEM functional goals.
 Example: “The vehicle shall maintain a safe distance from the vehicle in front.”
 These are functional and non-functional requirements (e.g., response time, reliability).

2. Functional Decomposition
The feature is broken down into functions that can be implemented by one or more ECUs.
 Adaptive Cruise Control (ACC) → Object Detection, Speed Control, Distance Estimation
 Tools: SysML diagrams, Functional Architectures, Use Case Modeling

3. Logical Architecture
Defines how these functions are logically organized and communicate. Often includes:
 Software Functions (e.g., DistanceCalculator)
 Communication Interfaces (e.g., CAN messages, LIN signals)
 Sensor/Actuator interactions

4. Software Architecture / Component Design


Here the system transitions from functions to software components. If AUTOSAR is used, this step
involves:
 Software Components (SWCs): Independent, reusable units of software
 Ports & Interfaces: Define how SWCs interact (sender/receiver, client/server)
 Runnables: Functions within SWCs triggered periodically or by events
For example, DistanceControlSWC may:
 Receive sensor input (VehicleSpeed, ObjectDistance)
 Calculate desired throttle
 Send actuator commands
5. Allocation to ECUs (Hardware Mapping)
Once SWCs are defined, they are mapped to physical ECUs:
 Based on real-time constraints, memory, computation power
 Consider communication (CAN/FlexRay/Ethernet) requirements

6. Integration & Configuration


Software components are integrated with middleware like:
 AUTOSAR RTE (Runtime Environment): Handles communication between SWCs and BSW
 BSW (Basic Software): Contains services like OS, diagnostics, communication drivers
 Tools like DaVinci Developer, EB tresos, or Vector GENy are used for this

7. Implementation and Testing


Code is generated (often auto-generated from models) and tested through:
 MIL/SIL/HIL testing
 Unit tests for SWCs
 End-to-end integration testing

Diagram:
[User Feature]

[Functional Decomposition]

[Logical Functions]

[Software Components (SWCs)]

[Mapped to ECUs via RTE]

[Integrated with BSW & Drivers]

[Runs on Vehicle]
Example: Lane Keeping Assist

Stage Description
Feature Lane Keeping Assist System
Function Decomposition Lane Detection, Vehicle Positioning, Steering Control
Logical Functions LaneTracker, SteeringAngleController
Software Components LaneDetectionSWC, SteeringControlSWC
ECU Mapping Camera ECU → LaneDetectionSWC; Chassis ECU → SteeringControlSWC
Integration RTE manages communication; BSW handles sensor drivers

MAPPING SOFTWARE COMPONENTS TO ECU IN AUTOMOTIVE SYSTEMS


Mapping software components (SWCs) to Electronic Control Units (ECUs) is a critical phase in
automotive software development. This ensures that each software function is executed on the appropriate
hardware, based on system requirements, constraints, and performance targets.

Software-to-ECU Mapping
Software-to-ECU mapping is the process of assigning AUTOSAR Software Components (SWCs)
to specific ECUs in the vehicle. Each ECU is a physical computing unit that can run one or more SWCs
depending on memory, processing power, communication needs, and timing constraints.

Key Elements of the Mapping Process

Element Description
SWC (Software Logical unit of software that performs a specific function (e.g., Brake
Component) Control)
ECU Physical hardware unit with a microcontroller or processor
RTE (Runtime Middleware that enables communication between SWCs and between
Environment) SWCs and BSW
AUTOSAR tools (e.g., DaVinci Configurator, EB tresos) used for
Mapping Tool
configuration

MAPPING PROCESS
1. Define the Software Architecture
 Identify SWCs and their interfaces
 Define runnables and triggering conditions
 Define communication between SWCs

2. Determine Hardware Capabilities


 CPU load
 Available RAM/ROM
 I/O interfaces (CAN, LIN, FlexRay, Ethernet)
 Sensor/Actuator availability

3. Analyze Constraints
 Real-time constraints (latency, periodicity)
 Communication latency and bandwidth
 Safety integrity levels (ASIL from ISO 26262)
 Functional partitioning (e.g., separate safety-critical and non-critical components)

4. Perform the Mapping


Use configuration tools to map SWCs to ECUs. This results in:
 System Description File (.arxml): Contains mappings, scheduling info, communication matrix
Example:
<ECU-INSTANCE ID="EngineControlECU">
<SWC-MAPPING>
<SWC>ThrottleControlSWC</SWC>
<SWC>FuelInjectionSWC</SWC>
</SWC-MAPPING>
</ECU-INSTANCE>

5. Generate RTE and Integrate


 AUTOSAR toolchain generates RTE for each ECU based on its SWCs
 Each ECU is now a deployable unit with its assigned SWCs

Example Scenario
Feature: Adaptive Cruise Control (ACC)

SWC Name Function Mapped ECU


ObjectDetectionSWC Detects vehicles ahead Camera ECU
SpeedControlSWC Adjusts throttle/brake Powertrain ECU
DistanceCalcSWC Computes safe following distance Central Gateway ECU
This mapping ensures:
 Low-latency detection via camera ECU
 Real-time speed control in Powertrain ECU
 Central coordination from Gateway ECU

Considerations for Optimal Mapping


 Latency-Sensitive Functions: Map close to sensor or actuator ECUs
 Safety-Critical SWCs: Place on ECUs certified for high ASIL levels
 Communication Overhead: Avoid excessive cross-ECU communication
 Scalability: Ensure architecture supports addition/removal of SWCs

Tools Supporting SWC-to-ECU Mapping

Tool Functionality
Vector DaVinci Developer Design and map AUTOSAR SWCs
EB tresos Studio ECU configuration and code generation
SystemDesk (dSPACE) Architecture modeling and system description
MATLAB Simulink Model-based design with AUTOSAR support

Flowchart
A[Features]
B[SWCs (e.g. ACC, Brake Control)]
C[Logical Architecture]
D[ECU1 - Camera]
E[ECU2 - Powertrain]
F[ECU3 - Gateway]

A --> B --> C
C --> D
C --> E
C --> F

CYBER-PHYSICAL SYSTEM (CPS) PERFORMANCE ANALYSIS

Effects of Scheduling, Bus Latency, and Sense/Actuation Faults on Control Performance


Cyber-Physical Systems (CPS) like automotive systems, industrial control systems, and robotics
tightly integrate computation, communication, and control. For these systems, timing, faults, and
resource constraints significantly impact control performance and stability.
Cyber-Physical System performance is highly dependent on real-time execution and robust design.
Control performance degrades under poor scheduling, delays, and faults unless mitigated using fault-
tolerant design, real-time scheduling, and robust control techniques.

1. Scheduling Effects
🔹 Definition
Task scheduling determines when sensing, computation, and actuation occur in real-time control
loops.
🔹 Key Scheduling Types

Type Description Impact


Predictable latency, better control
Time-Triggered (TT) Predefined periodic tasks
performance
Tasks triggered by events or Efficient CPU use, but may lead to
Event-Triggered (ET)
thresholds jitter
Simple, but can lead to priority
Fixed-Priority (FP) Tasks with static priorities
inversion
EDF (Earliest Deadline
Dynamic priority scheduling Optimal in theory, complex in practice
First)

🔹 Impact on Control
 Missed Deadlines → Delayed control → Instability
 Jitter (Timing Variability) → Variable control periods → Performance degradation
 Non-determinism → Hard to verify system behavior

2. Bus Latency (Communication Delay)


🔹 Definition
Time taken for data to travel over communication channels like CAN, FlexRay, or Ethernet.
🔹 Sources of Delay
 Message contention (on shared buses)
 Bus arbitration delays
 Serialization/deserialization

🔹 Effect on Control
 Increased latency → Reduced feedback quality → Slower or incorrect control response
 Variable delay (jitter) → Hard to predict system response
 Multi-hop networks (e.g., in V2X) → Cumulative delay
🔹 Mitigation Techniques
 Use Time-Triggered Protocols (e.g., TTP, Time-Sensitive Networking)
 Implement message prioritization (e.g., CAN-ID prioritization)
 Predictive or delay-compensated control algorithms

3. Sensing Faults
🔹 Types

Fault Type Example Impact


Sensor Noise Random variation in readings Reduced control accuracy
Bias/Drift Slow shift in measured values Systematic error in control
Missing Data Sensor failure or dropout Loss of observability
Stuck-at Fault Constant output value Misleading controller input

🔹 Effect on Control
 Incorrect state estimation
 False alarms or missed events
 Instability due to wrong feedback
🔹 Coping Strategies
 Sensor fusion for redundancy
 Kalman Filters, Moving Averages for noise
 Fault detection and isolation (FDI)

4. Actuation Faults
🔹 Types

Fault Type Description


Dead actuators No output despite command
Stuck actuators Fixed output regardless of command
Delayed actuation Command is executed late
Reduced performance Weak motors, leaky valves
🔹 Impact
 Loss of control authority
 Degraded performance (e.g., longer braking time)
 Control instability in closed-loop systems
🔹 Solutions
 Fallback controllers (e.g., degrade to passive mode)
 Fault-tolerant control (FTC)
 Redundant actuators in critical systems

NETWORK CONGESTION IN CPS AND AUTOMOTIVE SYSTEMS


Network congestion occurs when the data rate into a network (or communication bus) exceeds
its transmission capacity, leading to delays, packet drops, or complete loss of service quality.
In Cyber-Physical Systems (CPS) like automobiles, industrial control, drones, etc., timely
communication between sensors, controllers, and actuators is critical. Congestion disrupts this flow.

Common Networks in CPS

Network Use Case Data Rate Congestion Risk


High (shared, arbitration-
CAN (Controller Area Network) Vehicle ECUs ~1 Mbps
based)
FlexRay Safety-critical tasks ~10 Mbps Medium
Infotainment, 100 Mbps – 10
Ethernet (Automotive Ethernet) Low to Medium
ADAS Gbps
ZigBee / Wireless Sensor Networks Industrial IoT <1 Mbps High
Vehicle-to- High (in dense
Wi-Fi / V2X Varies
everything environments)

Causes of Network Congestion


1. High Message Frequency: Too many periodic messages (e.g., radar, camera data).
2. Bursty Traffic: Sudden bursts of data (e.g., diagnostic logs, OTA updates).
3. Shared Medium Contention: Multiple nodes competing for access (e.g., CAN arbitration).
4. Low Bandwidth: Network speed is not enough for total load.
5. Faulty Nodes: Malfunctioning nodes may flood the network.
6. Packet Retransmissions: Due to wireless interference or dropped packets.

Effects on System Performance

Effect Description Impact


Increased Latency Longer wait to transmit data Slower control loops
Jitter Variability in transmission time Unpredictable control
Packet Drops Messages discarded Missing sensor/actuator updates
Deadline Misses Time-critical data arrives late Control instability or failure
Bus Lockup Saturated bus stops useful communication System crash (in worst case)
CONGESTION MITIGATION TECHNIQUES
Protocol-Level Techniques
 Prioritized Messaging (e.g., lower CAN IDs → higher priority).
 Time-Triggered Protocols (e.g., FlexRay, TTP) ensure determinism.
 Traffic Shaping (control burst size, average rate).
 Rate Limiting on nodes to avoid floods.
Architecture-Level Solutions
 Segment Networks: Use gateway ECUs to split traffic domains.
 Use Higher Bandwidth Buses (e.g., upgrade CAN → CAN FD or Ethernet).
 QoS Policies: Use TSN (Time-Sensitive Networking) in Ethernet for real-time flows.
System Design Approaches
 Static Scheduling: Preallocate slots to critical messages (e.g., FlexRay static segment).
 Load Analysis Tools: Evaluate worst-case bus load during design.
 Event Aggregation: Batch less-critical messages.

BUILDING REAL-TIME NETWORKS FOR CPS


A real-time network in CPS enables timely, deterministic, and reliable communication between
sensors, controllers, and actuators. Unlike best-effort networks, real-time networks must meet strict
latency and jitter constraints to ensure system stability, safety, and correctness.

BUILDING BLOCKS OF A REAL-TIME CPS NETWORK


1. Topology Design
 Star or Daisy Chain: Simpler but prone to bottlenecks.
 Mesh/Redundant Paths: Increases fault tolerance.
2. Protocol Stack Configuration
 Use real-time Ethernet protocols: Time-Triggered Ethernet, TSN, Profinet IRT, EtherCAT.
 Set message priorities, rate limits, and traffic classes.
3. Time Synchronization
 Use IEEE 1588 PTP (Precision Time Protocol) to synchronize clocks across nodes.
4. Scheduling
 Static: Pre-determined slots (FlexRay, TT-Ethernet) → high predictability.
 Dynamic: Priority or deadline-based (CAN, Ethernet + QoS).
5. Fault Tolerance
 Redundant paths (TSN Frame Replication & Elimination, FlexRay dual channel).
 Health monitoring, watchdogs, retransmission mechanisms.

Design Example
Autonomous Vehicle Real-Time Network

Component Connected Via Message Type Timing Requirement


Camera, LiDAR Ethernet + TSN Sensor data (video, point cloud) 5–100 ms
Brake Control Unit FlexRay (static segment) Emergency brake command ≤5 ms
Infotainment Ethernet/CAN Non-critical Best-effort
Radar CAN FD Distance measurements 10–20 ms
GPS, IMU UART/CAN Localization data 20–50 ms

INTELLIGENT CPS: SAFE REINFORCEMENT LEARNING (SAFE RL)


Cyber-Physical Systems (CPS) are increasingly integrating Reinforcement Learning (RL) to
make intelligent, adaptive decisions. However, using RL in safety-critical domains like autonomous driving,
robotics, or industrial automation requires strict guarantees of safety — this is where Safe RL becomes
essential.

What is Safe Reinforcement Learning?


Safe Reinforcement Learning aims to optimize performance while ensuring that the learning
agent does not violate safety constraints during exploration or deployment.
In CPS, this means:
 No collisions with humans or other robots
 No physical damage to equipment
 No violation of mission-critical timing constraints
 Stable control performance throughout learning

Why Standard RL Fails in CPS

Challenge Why it’s problematic for CPS


Exploration Risks Random exploration may cause system failures or unsafe behavior.
Delayed Feedback Delays between action and consequences can make safety harder to enforce.
Sparse Rewards Some safety-critical events are rare (e.g., collision), so unsafe policies may persist.
Hard Constraints Real-world physical systems can’t tolerate constraint violations.

Key Concepts in Safe RL for CPS


1. Constrained Markov Decision Processes (CMDPs)
 Extends MDPs with constraints on cost or risk.

2. Reward Shaping with Safety Signals


 Penalties are added for unsafe states or actions (e.g., near a wall or at high speeds).
3. Shielding / Safe Action Filtering
 A safety layer checks or modifies the agent’s action before applying it.
 Ensures all actions remain within safe bounds.
4. Lyapunov-Based Methods
 Use control-theoretic stability analysis (Lyapunov functions) to ensure safety.
 Guarantees that the system remains in a stable, bounded region.
5. Reachability Analysis
 Computes the set of safe states and prevents the policy from leaving this set.
6. Risk-Sensitive RL
 Uses CVaR (Conditional Value at Risk), variance constraints, or probabilistic safety to reduce
catastrophic outcomes.

Algorithms and Techniques

Technique Description
Safe DDPG / PPO / SAC Modifications of popular RL algorithms to handle constraints.
RL + Control Barrier Functions Enforces safety using mathematical constraints on system
(CBFs) trajectories.
RL with Model Predictive Control Combines learning with predictive models for constraint-aware
(MPC) planning.
Gaussian Processes for Safe RL Learn safe regions by estimating uncertainty.

INTELLIGENT CPS
Intelligent Cyber-Physical Systems (CPS) combine computation, networking, and physical
processes. In robotics and autonomous vehicles, the “intelligence” stems from advanced control
algorithms, often powered by AI, that interact with sensors and actuators in real-time to perform motion
planning and control tasks safely, reliably, and autonomously.

AUTONOMOUS VEHICLE CONTROL IN CPS


Autonomous vehicles (AVs) are complex CPS integrating multiple layers of intelligence:

Control Stack

Layer Description
Perception Detect lanes, vehicles, pedestrians via LiDAR, cameras, RADAR
Localization Estimate vehicle position using GPS, IMU, SLAM
Prediction Predict behavior of dynamic agents (cars, people)
Planning Plan path respecting constraints and environment
Control Track the path with low-latency real-time feedback

Control Techniques

Technique Features
Simple and widely used for low-level tasks (e.g., steering,
PID Control
speed control)
Model Predictive Control (MPC) Optimizes future control actions under constraints
Learns control strategies from data, useful in complex or
Reinforcement Learning-based Control
unknown dynamics
Hybrid Control (RL + MPC) Combines safety of MPC with adaptability of RL
Safe Control using Control Barrier
Enforces hard safety constraints like collision avoidance
Functions (CBFs)
Real-World CPS Challenges in AVs
 Actuation Delays: Controller must compensate for time delays in brake/steer/throttle.
 Bus Latency & Jitter: CAN, Ethernet time delays affect real-time response.
 Environment Uncertainty: Rain, fog, glare affect sensor accuracy.
 Edge Computing Constraints: Real-time decisions with limited compute.

ROBOT MOTION CONTROL IN CPS


Robots operate in dynamic, unstructured environments. Intelligent CPS enables them to adapt, plan,
and actuate under real-world constraints.

Key Modules in Robot Control CPS


Module Description
Motion Planning Generates collision-free trajectories (e.g., RRT, A*)
Kinematics/Dynamics Converts paths to joint commands using IK/torque control
Feedback Control Ensures precise execution via PID/MPC
Sensor Fusion Merges data from IMU, encoders, LiDAR, vision for state estimation
Adaptive/Intelligent Control Uses learning to adapt to changing payloads or terrain

Performance Metrics in CPS Motion Control


 Latency (ms): Sensor-to-actuator response time
 Throughput: Messages per second on CAN/Ethernet
 Stability Margin: How far system is from instability
 Tracking Error: Deviation from desired path
 Energy Efficiency: Especially for mobile robots
 Safety Violations: Number of unsafe actions avoided

GAUSSIAN PROCESS (GP) LEARNING


A Gaussian Process (GP) is a non-parametric Bayesian approach used to model distributions
over functions. Instead of learning fixed parameters, a GP defines a distribution over possible functions
that fit the data.
It gives both a mean prediction and uncertainty (variance) for any new input.
1. Function as a Distribution
 In GP, each point in the input space is associated with a normally distributed output.
 Any finite set of these points will follow a multivariate Gaussian distribution.
2. Kernel Function (Covariance Function)
 The kernel defines how similar any two input points are.
 It governs smoothness, complexity, and prior assumptions about the function.
 Common kernels:
o Radial Basis Function (RBF) / Squared Exponential
o Matérn kernel
o Linear, Periodic kernels
3. Prediction with Uncertainty
 For a new input point, GP predicts:
o Mean: the expected output value
o Variance: how uncertain it is about that prediction
 This makes GP very useful in exploration/exploitation settings (e.g., reinforcement learning, safe
control).

Why Use GP?

Feature Benefit
Non-parametric No fixed structure, adapts to data
Probabilistic Predicts both output and confidence
Feature Benefit
Interpretable Provides insights into uncertainty
Data-efficient Performs well even with small datasets

GP in Intelligent CPS
1. Safe Learning & Control
 Used in Safe Reinforcement Learning to model dynamics or safety constraints.
 Predicts unsafe actions by estimating uncertainty in state transitions.
2. Robot Motion Planning
 Models terrain or environment uncertainty.
 Helps in selecting paths with low risk or high information gain.
3. System Identification
 Learns unknown dynamics of physical systems (e.g., a robot arm’s behavior).
 Replaces or augments classical model-based controllers.

Advantages
 Handles noisy data naturally
 Gives confidence estimates with predictions
 Requires fewer data points compared to deep learning
Limitations
 Scales poorly with large datasets (cubic time complexity)
 Choice of kernel can significantly affect performance
 Needs careful hyperparameter tuning

SMART GRID DEMAND RESPONSE


Demand Response (DR) is a strategy used in smart grids where electricity consumers adjust their
usage in response to supply conditions, prices, or grid reliability signals.
Role of Intelligent CPS:
 CPS integrates sensors, communication networks, control algorithms, and actuators to monitor
and manage electricity consumption in real-time.
 Intelligent CPS can predict demand patterns, detect anomalies, and automatically adjust loads
(e.g., HVAC, lighting, appliances) based on grid signals.
 Enables dynamic pricing models where consumers shift usage to off-peak hours, reducing strain on
the grid.
 Enhances grid stability and efficiency by balancing supply and demand automatically.
Key Benefits:
 Reduces peak demand and avoids costly infrastructure expansion.
 Integrates renewable energy sources effectively.
 Improves consumer energy cost savings and comfort.

BUILDING AUTOMATION
Building automation uses CPS to control and monitor building systems such as heating, ventilation,
air conditioning (HVAC), lighting, security, and energy management.
Role of Intelligent CPS:
 Uses real-time sensing and adaptive control to optimize energy consumption while maintaining
occupant comfort and safety.
 Enables predictive control by learning occupants’ habits and environmental conditions
(temperature, humidity, occupancy).
 Integrates with the smart grid for demand response participation, reducing building energy costs.
 Facilitates fault detection and diagnostics to improve system reliability.
Key Benefits:
 Improves energy efficiency and reduces carbon footprint.
 Enhances occupant comfort through personalized environmental control.
 Provides scalable, flexible management for large building complexes.

You might also like