# Threat Analysis and Risk Assessment (TARA) Analysis of an Autonomous Emergency Braking (AEB) System
## 4 Feature Description
### Data Flow Diagram  
Figure 3 represents a high level of our architecture and we can see how the AEB system works and how its components are connected through the CAN.  
The diagram illustrates the flow of data and decision-making within an AEB system. It consists of various sensors, data fusion processes, and decision logic that collectively determine the appropriate braking response based on the vehicle's environment and conditions.  
1. **Ego Vehicle** * This is the central entity, representing the vehicle equipped with the AEB system. It processes inputs from various sensors to determine the required action.
* **Radar**: this measures the relative distance and relative velocity of objects in front of the vehicle.
- **Camera**: this provides target range (X, Y) information.
- **Yaw Rate**: this monitors the rotation rate of the vehicle around its vertical axis.
- **Velocity**: this indicates the speed of the vehicle.
- **MRR (Mid-Range Radar)**: similarly to the radar, this provides relative distance and relative velocity data but performs so for a different range.
2. **Sensor Fusion**- The left path involves the radar and camera, which merge their data to calculate the relative velocity.
- The right path involves the MRR and camera, similarly fusing their data to compute the relative velocity.
3. **Relative Velocity** * After sensor fusion, the relative velocity is calculated for both paths. This velocity indicates how quickly the distance between the ego vehicle and an object ahead is changing. * The calculated relative velocities are then passed to the AEB testing data module.
4. **AEB Testing Data** * The AEB testing data module receives the relative velocity data from both paths. * This module uses the data to simulate or analyze potential collision scenarios.
5. **Yaw Rate Decision Block** * The yaw rate is compared against a threshold of 1 (likely representing a significant yaw indicating a sharp turn or lane change). * Two paths are determined based on the yaw rate: - **True**: if the yaw rate is greater than 1, the vehicle is considered on a **bent road segment**. - **False**: if the yaw rate is less than or equal to 1, the vehicle is considered on a **straight road segment**.
6. **Road Segment Analysis** * Based on the road segment (bent or straight), the AEB system adapts its testing data: - **Bent Road Segment**: the system likely adjusts the AEB testing to account for the dynamics of turning. - **Straight Road Segment**: the system processes the data assuming a straightforward path, focusing on linear deceleration.
7. **Time to Collision (TTC) Comparison** * After processing the road segment data, the system performs a **TTC comparison**, determining how much time remains before a potential collision. * Based on the TTC result, the system flags one of three states: - **FCW (Forward Collision Warning) Flag**: this indicates that a warning should be issued to the driver, typically when the collision is imminent but avoidable with driver intervention. - **Partial Flag**: this indicates that partial braking should be applied, usually in cases where a collision is likely but not imminent. - **Full Flag**: this indicates that full braking should be applied immediately, often in cases where a collision is unavoidable without intervention.
8. **Action Modules** * Based on the flag set by the TTC comparison: - **FCW**: the system issues a forward collision warning to alert the driver of an impending collision. - **Partial Brake**: the system applies partial braking to reduce speed and avoid collision.  
* **Full Brake**: the system applies full braking force to prevent or mitigate a collision.