# Embedded Bayesian Network Contribution for a Safe Mission Planning of Autonomous Vehicles
## 5 Study Cases
### Experiment on FPGA-SoC Based on FMEA_HM Pattern  
To give an idea of potential interest of an FPGA implementation of the BN diagnosis, we propose to explore different implementations of different variants of HM using the \(FMEA\_HM\) pattern. We take a basic HM incorporating 3 error types and we vary the number of HM varies from 2 HMs to 10 HMs. The complexity of an HM with 3 error types corresponds to BN with 27 nodes. The number of nodes of each HM corresponds to the BN generated with the \(FMEA\_HM\) pattern with 3 error types and two appearance contexts for each error type and two appearance contexts for each sensor that monitors the error type. Then the complexity of one HM is equal to 27 nodes. The implementation of 10 HMs has a complexity of 270 nodes. The Figures 22 and 23 summarize the results. For these experiments, we propose two strategies. The first one is that all the HMs are computed separately and in parallel (with resource limitation when necessary), and the second one is that one HM is used for all the computations which are in pipeline. Figure 21: Resource-aware Health Management (HM). Figure 22: Results of the HW implementation for the scalable BN monitors in terms of FPGA resources (BRAM, DSP, LUT, FF) and in terms of performance with pipeline and parallel directives. Figure 22 shows the used area and the latency for the different cases, and Figure 23 gives for the same cases the HW and SW runtime, the speed-up and the energy consumption. From Figure 22 we can deduce that the area grows with the number of HMs, in the case of parallel strategy because each HM operates independently and there is no resource sharing. Note that it is necessary to limit the resources in case of 6 and 10 HMs, otherwise it exceeds the capacity of the device (in this case study, we use a Zynq xc7z020 from ZedBoard [37]). In the case of pipeline strategy, the resources used grow slowly, which amounts to use the same resources. In the case of parallel strategy, the latency grows, too, with the number of HMs, which is due to the data reading, but the latency gap between 2 HMs, 4 HMs and 6 HMs is small. However, the 10 HM latency is more important, because of a big limitation of resources. In the case of pipeline strategy, the latency grows, too, with the number of HMs, since the interval of computation grows with the number of HMs. From Figure 23, we confirm that we can have a good speed-up with the HW implementation. In the case of parallel strategy, we observe that the speed-up is less important for 10 HMs because of the big limitation of resources. The speed-up and the energy consumed are better in the case of parallel strategy due to the interval of computation between two HMs in the pipeline strategy. These results firstly show the impact on performance, resources and energy consumption of a generic Bayesian network based on FMEA_HM pattern by varying the number of error types. We can conclude that HW accelerations and resources increase with the number of error types, because each type of error represents an independent Bayesian subnet. We achieve a speed-up greater than 14 with an FPGA implementation for 10 HM (270 nodes) and with a very low energy cost. The strategy to adopt (parallel or pipeline strategy) for generating an efficient HW implementation onto FPGA depends on the complexity of the BN monitors and on the resource capacity. In a general case, the parallel strategy offers better speed-up but the needs of resource is bigger. Depending on the resource capacity and on the timing constraint, pipeline strategy can offer a good trade-off. We see in this example that BN monitors are good candidate for HW implementations. We obtain a significative speed-up comparing to the SW version. This means that we can easily consider these HW implementations for an embedded version of autonomous vehicle. In the next section, we study how to incorporate them into a decision-making mechanism of the mission manager.