Formal Method Library for Propulsion System of FCS
Zhengpu Shi |
Draft V1.0 |
Oct 25, 2020
This is one part of the FML4FCS project. For detail information, please refer the introduction of the whole project in this website.
The modeling of Propulsion System (we called PS) is a basic condition for designing the flight control system.
We set up a module named Common Module which related to the general issues. Then we set up some modules named like Example* Module for several specific problems.
Constants refer to values that do not change after the aircraft is designed, such as propeller size. We have slightly simplified the aerodynamics, and set the flight altitude and ambient temperature to constants, so the air pressure and air density also become constants. The reason for this is that their changes during low-altitude flight are very small, almost negligible, and in order to highlight other more important variables, simplifying them to constants will make the entire model more concise.
Although the Coq system supports to using Unicode characters as identifier, we still use ASCII text represent an identify. Because other languages may not support this feature and we need to maintain naming consistency.
Symbol | Identifier | Meaning | Unit | Remark |
T 0 | T_0 | standard temperature | K | 273.15K |
p0 | p_0 | standard atmospheric pressur | Pa | 101.325 × 105 |
ρ0 | rho_0 | standard atmospheric density | kg∕m3 | 1.293 |
h | h | Altitude | m | |
T t | T_t | Environment temperature | ∘C | |
nr | n_r | Number of rotors | piece | |
G | G | Total weight | N | |
Iother | I_other | Other current | A | |
p | p | atmospheric pressure | Pa | |
ρ | rho | density | kg∕m3 | |
D p | D_p | Propeller diameter | m | |
Hp | H_p | Propeller geometric pitch | m | |
Bp | B_p | Number of blades | piece | |
Gp | G_p | Propeller weight | N | |
PPA | PP_A | Propeller parameter* | - | [1][p67] |
PPε | PP_epsilon | Propeller parameter* | - | [1][p67] |
PPλ | PP_lambda | Propeller parameter* | - | [1][p67] |
PPζ | PP_zeta | Propeller parameter* | - | [1][p67] |
PPe | PP_e | Propeller parameter* | - | [1][p67] |
PPK0 | PP_K0 | Propeller parameter* | - | [1][p67] |
PPα0 | PP_alpha0 | Propeller parameter* | - | [1][p67] |
Cfd | C_fd | Zero-lift drag coefficient | - | |
CT | C_T | Thrust coefficient | - | |
CM | C_M | Torque coefficient | - | |
Cd | C_d | Drag coefficient | - | |
KV 0 | K_V0 | Nominal no-load motor KV | r∕min∕V | |
Um0 | U_m0 | Nominal no-load motor voltage | V | |
Im0 | I_m0 | Nominal no-load motor current | A | |
ImMax | I_mMax | Maximum motor input current | A | |
Rm | R_m | Motor resistance | Ω | |
Gm | G_m | Motor weight | N | |
KE | K_E | Back-electromotive force constant | - | |
KT | K_T | Torque constant | - | |
I eMax | I_eMax | Maximum ESC output current | A | |
R e | R_e | ESC resistance | Ω | |
G e | G_e | ESC weight | N | |
R b | R_b | Battery resistance | Ω | |
U b | U_b | Battery voltage | V | |
C b | C_b | Battery capacity | mAh | |
C min | C_min | Battery minimum capacity | mAh | |
Kb | K_b | Maximum discharge rate | C | |
Gb | G_b | Battery weight | N | |
Notice that, some constants are composed by more basic constants. We give all the relationship of them.
Definition of p, see [1][p.66, 4.4]
| (2.1) |
Definition of ρ, see [1][p.66, 4.3]
| (2.2) |
Definition of CT, see [1][p.67, 4.6]
| (2.3) |
Definition of Cd, see [1][p.67, 4.7]
| (2.4) |
Definition of CM, see [1][p.67, 4.6]
| (2.5) |
Definition of KE, see [1][p.80, 4.64]
| (2.6) |
Definition of KT, see [1][p.80, 4.65]
| (2.7) |
Variable means that its value may changed at different or in different problems.
Symbol | Identifier | Meaning | Unit | Remark |
p | p | atmospheric pressure | Pa | |
ρ | rho | density | kg∕m3 | |
Tb | T_b | Time of endurance | min | |
V | V | Flight speed | m∕s | |
V max | V_max | Maximum flight speed | m∕s | |
Z | Z | Flight distance | m | |
Zmax | Z_max | Maximum flight distance | m | |
η | eta | System efficiency | m | 0˜1 |
Gmaxload | G_maxload | Maximum load | N | |
θmax | theta_max | Maximum pitch angle | rad | |
T | T | Propeller thrust | N | |
M | M | Propeller torque | N.m | |
N | N | Motor speed | r∕min | |
E a | E_a | Back-electromotive force | V | |
U m | U_m | Equivalent motor input voltage | V | |
Im | I_m | Equivalent motor input current | A | |
I e | I_e | ESC input current | A | |
Ue | U_e | ESC input voltage | V | |
Ueo | U_eo | Equivalent ESC output voltage | V | |
σe | sigma_e | ESC throttle | - | 0˜1 |
I b | I_b | Battery current | A | |
We study the engineering relationship between the various components of the PS, and give the VRG of the most important 14 variables in Fig 1, which can help us visually design function expressions between the variables.
Here is the dependency relationship between all variables. From this picture, you can intuitively see how to calculate between two variables or multiple variables. The double-headed arrow means that two variables can be freely converted. The dashed line represents the derived simple relationship. A one-way arrow refers to a situation where there are multiple inputs and a single output. Although the reverse solution cannot be obtained directly, because there are also relationships between the input variables, the solution process can still be constructed.
This picture can help us deal with the forward and reverse problems in the propulsion system. Forward solution refers to solving the aircraft’s performance indicators (longest hovering time, maximum load, maximum pitch angle, etc.) based on known hardware parameters (propeller, motor, ESC, battery, etc.). The reverse solution is to solve the hardware parameters according to the given aircraft performance index.
The graph is divided into four parts, namely the propeller, motor, ESC and battery. Each circle in the graph represents a variable, and the connection represents a function. It can be seen from the graph that there is a one-to-one function obtained by one or more steps between any nodes, although some function forms can be more complex.
Basic functions are given by engineering principles that describe the most basic conversion relationship between variables.
Calculate T by N, see [1][p.66, 4.1]
| (2.8) |
Calculate M by N, see[1][p.66, 4.2]
| (2.9) |
Calculate Ea by N, see[1][p.80, 4.61]
| (2.10) |
Calculate M by Im, see[1][p.80, 4.59]
| (2.11) |
Calculate Um by Ea and Im, see[1][p.72]
| (2.12) |
Calculate Ueo by Um and Im, see[1][p.69, 4.12]
| (2.13) |
Calculate Ueo by sigmae, see[1][p.69, 4.13]
| (2.14) |
Calculate Ie by sigmae and Im, see[1][p.69, 4.14]
| (2.15) |
Calculate Ib by Ie, see[1][p.70, 4.17]
| (2.16) |
Calculate Ue by Ib, see[1][p.70, 4.20]
| (2.17) |
Calculate Tb by Ib, see[1][p.70, 4.22]. Notice that, we simplify the battery model. First, we assume the battery voltage is a fixed value when it is discharging. Second, we assume the remain capacity of battery is linear changed when it is discharging.
| (2.18) |
Calculate Gmaxload by T, see[1][p.74, 4.35]
| (2.19) |
Calculate θmax by T, see[1][p.74, 4.36]
| (2.20) |
Calculate η by M and N and Ib, see[1][p.73, 4.32]
| (2.21) |
The basic inverse functions are some inverse functions of unary functions which belongs to basic function.
Calculate N by T, it is an inverse function of (2.8).
| (2.22) |
Calculate N by M, it is an inverse function of (2.9).
| (2.23) |
Calculate N by Ea, it is an inverse function of (2.10).
| (2.24) |
Calculate Im by M, it is an inverse function of (2.11).
| (2.25) |
Calculate sigmae by Ueo, it is an inverse function of (2.14).
| (2.26) |
Calculate Ie by Ib, it is an inverse function of (2.16).
| (2.27) |
Calculate Ib by Ue, it is an inverse function of (2.17).
| (2.28) |
Calculate Ib by Tb, it is an inverse function of (2.18).
| (2.29) |
Calculate T by Gmaxload, it is an inverse function of (2.19).
| (2.30) |
Calculate T by θmax, it is an inverse function of (2.20).
| (2.31) |
Extended function are some composited functions by basic functions and basic inverse functions, and the compositions are one or more steps.
Calculate T by M, it is composed by (2.23) and (2.8).
| (2.32) |
Calculate M by T, it is an inversion function of (2.32).
| (2.33) |
Calculate Im by T, it is composed by (2.33) and (2.25).
| (2.34) |
Calculate T by M, it is composed by (2.22) and (2.10).
| (2.35) |
Calculate Um by T, it is composed by (2.35) and (2.34) and (2.12).
| (2.36) |
Calculate Um by N and M, it is composed by (2.10) and (2.25) and (2.12).
| (2.37) |
Calculate Um by N, it is composed by (2.9) and (2.37).
| (2.38) |
Calculate Um by M, it is composed by (2.23) and (2.37).
| (2.39) |
Calculate Im by Ea, it is composed by (2.12) and (2.13).
| (2.40) |
Calculate Ueo by N, it is composed by (2.13), (2.12), (2.10), (2.25) and (2.9).
| (2.41) |
Calculate sigmae by Ea and Im, it is composed by (2.26) and (2.40).
| (2.42) |
Calculate Ie by Ea and Im, it is composed by (2.42) and (2.15).
| (2.43) |
Calculate Ie by T, it is composed by (2.43), (2.35) and (2.34).
| (2.44) |
Calculate Ue by Ie, it is composed by (2.17) and (2.16).
| (2.45) |
Calculate Tb by Ie, it is composed by (2.18) and (2.16).
| (2.46) |
Advanced extended function are some extended functions that would got several solutions. Usually, these functions are complex higher order equations. In actual situations, only one solution will be left based on the context constraint.
In fact, these definitions are too difficult so that we don’t like it. We will deform and simplify these formulas appropriately before using it.
Calculate M by Um, it is an inverse function of (2.38).
| (2.47) |
Calculate N by Ueo, it is an inverse function of (2.48).
| (2.48) |
SFF is the simplest function in mathematical form relative to the variables wer care about. This is done by rearranging the order of operations, separating the arguments and making the whole coffecient expression as a constant. Then the calculation cost will be reduced to minimize. It is very useful to improve calculation performance, especially when the function will be called frequently.
Another benefit to us is that we can see the type of the new function more clearly contrast to the old form.
For example, the new SFF for calculating motor input voltage Um by propeller speed N is (2.49), it is an equivelent transformation of (2.38).
| (2.49) |
We can analyze the difference between (2.38) and (2.49) in calculation.
As can be seen from Fig 2, the new SFF are calculated less and the number of intermediate variables are reduced too. At the same time, the type of the new SFF is more clearly than old form, it is an unary quadratic function form.
This comparison shows that SFF is a better approach and may greatly improve the efficiency of engineering computing.
We have done equivalent transformations to many original functions, and given the SFF table, see Fig 3.
The first column of the table is the input, and the first row is the output, the a, b, c in the table represent a constant expression in SFF, and the a, b, c in different functions is not the same value, just means they are constant expressions. We haven’t filled all blank grids because some functions only have mathematical meaning, haven’t engineering meaning, and the form is more complicated, so it is not the first priority to complete. Because we know from VRG that there are calculation paths between any nodes, there should be a function for each grid, and there must be an SFF. It should be pointed out that any pair of functions that are symmetrical on the main diagonal are mutually inverse.
There are now 14 important variables in total. After a rough estimate, the number of formulas that can be obtained is 13 + 12 + ... + 1 = 91, but in fact some of them are meaningless and there is no need to list them.
In the field of engineering control, the most common is the lengthy mathematical formula of the real number type. The real number type in the Coq system is constructed with axioms, and the related proofs require a lot of lemmas to rewrite and simplify. This is a manual proof example of correctness of a function which composited by two functions about thrust T and propeller speed N.
It can be seen that this script is cumbersome and poor readable. We found that many proofs are same pattern, first expand the definition, then use some lemmas to apply, try to use the Ring or Field strategy to auto prove the equality, and try to use the Fourier strategy to auto prove the general inequality.
We packaged these automatic proof technologies and provide a real number proof module named R_prove. This module consists of three parts: a table of commonly used lemmas, see Table 2.2.1; custom lemmas; custom strategies.
Lemma name | Lemma type |
Rlt_0_1 | 0 < 1 |
Rmult_le_pos | 0 ≤ r1 → 0 ≤ r2 → 0 ≤ r1 |
Rmult_lt_0_compat | 0 < r1 → 0 < r2 → 0 < r1 * r2 |
Rgt_not_eq | r1 > r2 → r1≠r2 |
Rlt_le | r1 < r2 → r1 ≤ r2 |
pow_lt | 0 < x → 0 < xn |
pow_nonzero | x≠0 → xn≠0 |
Rsqr_sqrt | 0 ≤ x → (sqrtx)2 = x |
sqrt_pow2 | 0 ≤ x → sqrt(x2) = x |
We use the proof strategy library management command Hint to add strategies to a specified strategy library. For example, “Hint Resolve Rlt_le : flyctrl.” adds the strategy “apply Rlt_le” to the flyctrl strategy library. Then you can enter “auto with flyctrl” to use this automatic proof strategy library.
Among the custom strategies, one of the most commonly used strategies is “simple_equation”, which can solve most of the proof problems in PS.
The example of manual proof just demonstrated can be done in one step with this strategy.
It is mainly to verify the definitions of basic inverse functions and derivative functions.
The first is the transformation of the paired basic function and the inverse function, named verify_trans_XX_and_YY, where XX and YY represent two variables respectively.
Then let’s verify the definition of the derived function, and named it verify_XXX, where XXX represents the name of the derived function.
Question: In the hover mode, according to the known parameters, estimate the time of endurance Tb, see [1] P75.
Principle: In the hovering state, the thrust generated by the PS is exactly equal to the total weight of the aircraft.
Calculation steps, see [1] p81-p82:
|
|
|
|
|
|
|
|
|
|
|
The formula of direct calculation is given here, which provides another way of calculation.
A direct formula, calculate N.
| (2.50) |
A direct formula, calculate M.
| (2.51) |
A direct formula, calculate Ea.
| (2.52) |
A direct formula, calculate Im.
| (2.53) |
A direct formula, calculate Um.
| (2.54) |
A direct formula, calculate Ueo.
| (2.55) |
A direct formula, calculate σe.
| (2.56) |
A direct formula, calculate Ie.
| (2.57) |
A direct formula, calculate Ib.
| (2.58) |
A direct formula, calculate Ue.
| (2.59) |
A direct formula, calculate Tb.
| (2.60) |
Note that these formulas are not so handsome but really correct. If we transform them using the SFF method, then we will get a more elegant form.
Verify that the results calculated by general method are equal to the new given direct fomulas, so we can ensure that the new formulas are reliable.
Question: Solve the motor voltage, motor current, propeller speed and system efficiency under the maximum throttle mode.
Principle: Under the maximum throttle, the electric throttle is equal to 1. At this time, multiple equations are combined to solve the result.
For the solution of the key variable ”propeller speed N”, literature [1][p71, 4.30] gives a system of equations, A numerical iteration method is proposed to solve the problem, but the final expression is not given. The author gives the formula of direct calculation.
| (2.61) |
| (2.62) |
| (2.63) |
| (2.64) |
| (2.65) |
| (2.66) |
| (2.67) |
| (2.68) |
Question: Calculate the maximum load weight and the maximum pitch Angle of multiple rotors with a certain safety margin (e.g., 20%) reserved for throttle commands.
Principle: Use the maximum throttle in safe mode, here 0.8, then combine multiple equations to solve the result.
For the solution of the key variable ”propeller speed N”, literature [1][p73, 4.33] gives a system of equations, A numerical iteration method is proposed to solve the problem, but the final expression is not given. This problem is similar to the ”maximum throttle mode” problem, and the direct calculation formula is given.
| (2.69) |
| (2.70) |
| (2.71) |
| (2.72) |
| (2.73) |
| (2.74) |
Question: Designers are concerned about two performance metrics: maximum flat flight speed and distance. The function relationship between pitch Angle and flight speed can be obtained after the model is established by force analysis. The solving method given by the author of the original book is numerical iteration method, but the author wants to try to find a better formula for direct calculation. The knowledge of derivative and extreme point is introduced to try to solve the extreme point. There is no conclusion and the issue is on hold.
Principle: The function relationship between flight speed and pitch Angle is established firstly, and then the pitch Angle when the maximum flight speed is obtained is solved. Then other parameters are easy to be solved. Similarly, the maximum flight distance can also be established as a function of pitch Angle, which can be solved in the same way.
In order ot realize control system as computer software, it is necessary to extract the exisiting engineering knowledge into the reference manual of software programming model required by computer programming. This process is traditionally completed by people manully, and its reliability cannot be guaranteed. We use the theorem prover COQ to gradually establish a reliable knowledge base for the control system from the bottom level in the way of mathematical reasoning. At the same time, we also get a reliable model that has been formally verified. We take the flight control system of small unmanned aerial vehicle as the research object, and analyze the control principle and algorithm of each subsystem. The research object of this chapter is propulsion system modeling.
In future work, we will use program generation technology to automatically generate high reliability control system software from this model.