# Designing a Reliable UAV Architecture Operating in a Real Environment
## 1 Introduction
The article shows how to integrate the described algorithms with the platform management algorithms described in the form of State Machines. An exemplary method of managing the detected emergencies and UAV operations in the event of two situations co-occurring is also presented. In Section 2, reference was made to works on a similar subject. The concept of UAV architecture modeling and the formal description of requirements for selected algorithms used in systems of this class were presented. Reference was also made to verifying the correctness of the developed models, although the discussion of these methods is not the subject of this article. The types of mathematical methods that are used to implement collision avoidance algorithms are also described. Particular attention was paid to geometric methods. Other optimization-based methods, including heuristic methods, are also mentioned. Section 3 covers models for modeling the system architecture, from user requirements to modeling class diagrams. Particular attention was paid to modeling emergencies that may occur during the platform's flight. The principles of selecting emergencies in order to minimize their number are discussed. Methods of verifying the consistency of a set of states and the transitions between individual states in which the unmanned platform may be found are presented. Reference was also made to the very important but often overlooked topic of integrating formal optimization methods with UML or SysML models in unmanned systems. The methods of checking the completeness and adequacy of mathematical models for an exemplary emergency situation in flight are discussed. The following part of the article shows an example of the physical architecture of the UAV, based on which the described algorithms for handling emergencies were designed and tested. The deterministic algorithm for handling collision avoidance to ensure separation between air platforms is presented in detail in Section 4. The algorithms are presented in the form of formal descriptions, which are verified on the simulator. Section 5 presents sample tests of the presented algorithms included in the system test plan and the results of testing the algorithms on the simulator. In the last section, further directions of the development of the presented models are discussed. Our experiences related to the preparation of formal models and their verification were also presented. The innovative elements presented in the article are:  
1. The methodology of building advanced UAV flight algorithms that fly in an environment with a large number of obstacles, which has been adapted to designing algorithms for small and medium air platforms;
2. A complete and tested collision avoidance algorithm of an unmanned platform equipped with ADS-B, for which methods of detecting situations in which the algorithm shows erroneous results have been defined (detection of a potential collision in a situation where there is no such collision);
3. An example of a complete scenario that can be used as documentation in the certification process;
4. A simulator for the verifying the UAV collision avoidance algorithm, the results of which are presented.