|
|
@ -10,12 +10,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
with Types; use Types; |
|
|
|
with Types; use Types; |
|
|
|
with External; |
|
|
|
with External; |
|
|
|
with MMS.F_PT.F_MM.Output; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package MMS.F_PT.F_MM.Behavior with |
|
|
|
package MMS.F_PT.F_MM.Behavior with SPARK_Mode is |
|
|
|
SPARK_Mode, |
|
|
|
|
|
|
|
Abstract_State => State |
|
|
|
|
|
|
|
is |
|
|
|
|
|
|
|
pragma Unevaluated_Use_Of_Old (Allow); |
|
|
|
pragma Unevaluated_Use_Of_Old (Allow); |
|
|
|
|
|
|
|
|
|
|
|
------------ |
|
|
|
------------ |
|
|
@ -23,22 +19,31 @@ is |
|
|
|
------------ |
|
|
|
------------ |
|
|
|
|
|
|
|
|
|
|
|
function Navigation_Mode_From_CP return Navigation_Mode_Type with |
|
|
|
function Navigation_Mode_From_CP return Navigation_Mode_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function Navigation_Mode_From_GS return Navigation_Mode_Type with |
|
|
|
function Navigation_Mode_From_GS return Navigation_Mode_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function Operating_Point_From_GS_Received return Boolean with |
|
|
|
function Operating_Point_From_GS_Received return Boolean with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function Operating_Point_From_GS return Operating_Point_Type with |
|
|
|
function Operating_Point_From_GS return Operating_Point_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function USB_Key_Present return Boolean with |
|
|
|
function USB_Key_Present return Boolean with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function Operating_Point_From_USB_Key return Operating_Point_Type with |
|
|
|
function Operating_Point_From_USB_Key return Operating_Point_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Current_Range return Current_Range_Type with |
|
|
|
|
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Current_Speed return Current_Speed_Type with |
|
|
|
|
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Current_Altitude return Current_Altitude_Type with |
|
|
|
|
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
----------------------------------------- |
|
|
|
----------------------------------------- |
|
|
|
-- States of the automaton in Figure 3 -- |
|
|
|
-- States of the automaton in Figure 3 -- |
|
|
@ -47,18 +52,18 @@ is |
|
|
|
type Power_State_Type is (ON, OFF); |
|
|
|
type Power_State_Type is (ON, OFF); |
|
|
|
|
|
|
|
|
|
|
|
function Power_State return Power_State_Type with |
|
|
|
function Power_State return Power_State_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
type On_State_Type is (INIT, RUNNING, CANCELLED, COMPLETE, ABORTED); |
|
|
|
type On_State_Type is (INIT, RUNNING, CANCELLED, COMPLETE, ABORTED); |
|
|
|
|
|
|
|
|
|
|
|
function On_State return On_State_Type with |
|
|
|
function On_State return On_State_Type with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON; |
|
|
|
Pre => Power_State = ON; |
|
|
|
|
|
|
|
|
|
|
|
type Running_State_Type is (TAKE_OFF, CLIMB, CRUISE, DESCENT, LANDING); |
|
|
|
type Running_State_Type is (TAKE_OFF, CLIMB, CRUISE, DESCENT, LANDING); |
|
|
|
|
|
|
|
|
|
|
|
function Running_State return Running_State_Type with |
|
|
|
function Running_State return Running_State_Type with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING; |
|
|
|
and then On_State = RUNNING; |
|
|
|
|
|
|
|
|
|
|
@ -66,12 +71,12 @@ is |
|
|
|
is (if Navigation_Mode_From_CP = A then A |
|
|
|
is (if Navigation_Mode_From_CP = A then A |
|
|
|
else Navigation_Mode_From_GS) |
|
|
|
else Navigation_Mode_From_GS) |
|
|
|
with |
|
|
|
with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State in INIT | RUNNING; |
|
|
|
and then On_State in INIT | RUNNING; |
|
|
|
|
|
|
|
|
|
|
|
function Operating_Mode return Navigation_Option_Type with |
|
|
|
function Operating_Mode return Navigation_Option_Type with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING |
|
|
|
and then On_State = RUNNING |
|
|
|
and then Navigation_Mode = RP; |
|
|
|
and then Navigation_Mode = RP; |
|
|
@ -80,59 +85,51 @@ is |
|
|
|
-- Guards of the automaton in Figure 3 -- |
|
|
|
-- Guards of the automaton in Figure 3 -- |
|
|
|
----------------------------------------- |
|
|
|
----------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
function Boarding_Completed return Boolean with |
|
|
|
|
|
|
|
Global => State, |
|
|
|
|
|
|
|
Pre => Power_State = ON |
|
|
|
|
|
|
|
and then On_State = INIT, |
|
|
|
|
|
|
|
Post => |
|
|
|
|
|
|
|
(if Boarding_Completed'Result then |
|
|
|
|
|
|
|
Payload_Bay_Closed |
|
|
|
|
|
|
|
and then Mission_Parameters_Defined |
|
|
|
|
|
|
|
and then Energy_Compatible_With_Mission); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Power_On return Boolean with |
|
|
|
function Power_On return Boolean with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function Power_Off return Boolean with |
|
|
|
function Power_Off return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Post => Power_Off'Result = not Power_On; |
|
|
|
Post => Power_Off'Result = not Power_On; |
|
|
|
|
|
|
|
|
|
|
|
function Mission_Abort_Received return Boolean with |
|
|
|
function Mission_Abort_Received return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON; |
|
|
|
Pre => Power_State = ON; |
|
|
|
|
|
|
|
|
|
|
|
function Start_Or_Go_Received return Boolean with |
|
|
|
function Start_Or_Go_Received return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = INIT; |
|
|
|
and then On_State = INIT; |
|
|
|
|
|
|
|
|
|
|
|
function Take_Off_Over return Boolean with |
|
|
|
function Take_Off_Over return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING |
|
|
|
and then On_State = RUNNING |
|
|
|
and then Running_State = TAKE_OFF; |
|
|
|
and then Running_State = TAKE_OFF; |
|
|
|
|
|
|
|
|
|
|
|
function Descent_Over return Boolean with |
|
|
|
function Descent_Over return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING |
|
|
|
and then On_State = RUNNING |
|
|
|
and then Running_State = DESCENT; |
|
|
|
and then Running_State = DESCENT; |
|
|
|
|
|
|
|
|
|
|
|
function Landed return Boolean with |
|
|
|
function Landed return Boolean is |
|
|
|
Global => State, |
|
|
|
(Current_Speed = 0 and Current_Altitude = 0) |
|
|
|
|
|
|
|
with |
|
|
|
|
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING |
|
|
|
and then On_State = RUNNING |
|
|
|
and then Running_State = LANDING; |
|
|
|
and then Running_State = LANDING; |
|
|
|
|
|
|
|
|
|
|
|
function Operating_Point_Changed return Boolean with |
|
|
|
function Operating_Point_Changed return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING |
|
|
|
and then On_State = RUNNING |
|
|
|
and then (Running_State in CLIMB | CRUISE | DESCENT) |
|
|
|
and then (Running_State in CLIMB | CRUISE | DESCENT) |
|
|
|
and then Navigation_Mode = RP; |
|
|
|
and then Navigation_Mode = RP; |
|
|
|
|
|
|
|
|
|
|
|
function Cruise_Altitude_Reached return Boolean with |
|
|
|
function Cruise_Altitude_Reached return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = RUNNING |
|
|
|
and then On_State = RUNNING |
|
|
|
and then (Running_State in CLIMB | DESCENT); |
|
|
|
and then (Running_State in CLIMB | DESCENT); |
|
|
@ -142,7 +139,7 @@ is |
|
|
|
---------------- |
|
|
|
---------------- |
|
|
|
|
|
|
|
|
|
|
|
function Energy_Compatible_With_Mission return Boolean with |
|
|
|
function Energy_Compatible_With_Mission return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State in INIT | RUNNING |
|
|
|
and then On_State in INIT | RUNNING |
|
|
|
and then (if On_State = RUNNING then Running_State = CRUISE); |
|
|
|
and then (if On_State = RUNNING then Running_State = CRUISE); |
|
|
@ -152,64 +149,82 @@ is |
|
|
|
or else (Navigation_Mode_From_CP = RP |
|
|
|
or else (Navigation_Mode_From_CP = RP |
|
|
|
and then Operating_Point_From_GS_Received)) |
|
|
|
and then Operating_Point_From_GS_Received)) |
|
|
|
with |
|
|
|
with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = INIT; |
|
|
|
and then On_State = INIT; |
|
|
|
|
|
|
|
|
|
|
|
function Payload_Bay_Closed return Boolean with |
|
|
|
function Payload_Bay_Closed return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State, |
|
|
|
Pre => Power_State = ON |
|
|
|
Pre => Power_State = ON |
|
|
|
and then On_State = INIT; |
|
|
|
and then On_State = INIT; |
|
|
|
|
|
|
|
|
|
|
|
function Emergency_Landing return Boolean with |
|
|
|
function Mission_Cancellation_Signaled return Boolean with |
|
|
|
Global => State, |
|
|
|
Global => Private_State; |
|
|
|
Pre => Power_State = ON |
|
|
|
|
|
|
|
and then On_State = CANCELLED; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
------------- |
|
|
|
------------- |
|
|
|
-- Outputs -- |
|
|
|
-- Outputs -- |
|
|
|
------------- |
|
|
|
------------- |
|
|
|
|
|
|
|
|
|
|
|
function Mission_Cancellation_Signaled return Boolean with |
|
|
|
function Ready_For_Takeoff return Boolean is |
|
|
|
Global => State; |
|
|
|
(Payload_Bay_Closed |
|
|
|
|
|
|
|
and then Mission_Parameters_Defined |
|
|
|
|
|
|
|
and then Energy_Compatible_With_Mission) |
|
|
|
|
|
|
|
with |
|
|
|
|
|
|
|
Global => Private_State, |
|
|
|
|
|
|
|
Pre => Power_State = ON |
|
|
|
|
|
|
|
and then On_State = INIT; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Emergency_Landing return Boolean with |
|
|
|
|
|
|
|
Global => Private_State, |
|
|
|
|
|
|
|
Pre => Power_State = ON |
|
|
|
|
|
|
|
and then On_State = CANCELLED; |
|
|
|
|
|
|
|
|
|
|
|
function Mission_Range return Current_Range_Type with |
|
|
|
function Mission_Range return Current_Range_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
function Operating_Point return Operating_Point_Type with |
|
|
|
function Operating_Point return Operating_Point_Type with |
|
|
|
Global => State; |
|
|
|
Global => Private_State; |
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------- |
|
|
|
--------------------------------------- |
|
|
|
-- Behavioural Specification of F_MM -- |
|
|
|
-- Behavioural Specification of F_MM -- |
|
|
|
--------------------------------------- |
|
|
|
--------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
procedure Read_Inputs with |
|
|
|
procedure Read_Inputs with |
|
|
|
Global => (In_Out => State, |
|
|
|
-- Read values of inputs once and for all and update the current state |
|
|
|
Input => (External.From_GS, External.From_CP)); |
|
|
|
Global => (In_Out => Private_State, |
|
|
|
|
|
|
|
Input => External.State); |
|
|
|
|
|
|
|
|
|
|
|
procedure Write_Outputs with |
|
|
|
procedure Write_Outputs with |
|
|
|
Global => (Input => State, |
|
|
|
-- Compute values of outputs from the current state |
|
|
|
Output => (Output.To_F_CM, Output.To_F_FC, Output.To_F_EL)); |
|
|
|
Global => (Input => Private_State, |
|
|
|
|
|
|
|
Output => Output_State); |
|
|
|
|
|
|
|
|
|
|
|
procedure Run with |
|
|
|
procedure Run with |
|
|
|
Global => (In_Out => State), |
|
|
|
-- Do: |
|
|
|
|
|
|
|
-- - Compute the new state of the automaton |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Global => (In_Out => Private_State), |
|
|
|
Post => |
|
|
|
Post => |
|
|
|
|
|
|
|
Operating_Point_Changed = (Operating_Point /= Operating_Point'Old) |
|
|
|
|
|
|
|
|
|
|
|
-- RP mode enables modification of range parameter before take-off. |
|
|
|
-- RP mode enables modification of range parameter before take-off. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
and then |
|
|
|
(if not (Power_State'Old = ON |
|
|
|
(if not (Power_State'Old = ON |
|
|
|
and then On_State'Old = INIT |
|
|
|
and then On_State'Old = INIT |
|
|
|
and then Navigation_Mode'Old = RP) |
|
|
|
and then Navigation_Mode'Old = RP) |
|
|
|
then Mission_Range = Mission_Range'Old) |
|
|
|
then Mission_Range = Mission_Range'Old) |
|
|
|
|
|
|
|
|
|
|
|
-- RP mode enables modification of altitude and speed parameters at any |
|
|
|
-- RP mode enables modification of altitude and speed parameters at any |
|
|
|
-- time. |
|
|
|
-- time (but not at landing, it is frozen...). |
|
|
|
|
|
|
|
|
|
|
|
and then |
|
|
|
and then |
|
|
|
(if Navigation_Mode'Old = A |
|
|
|
(if (Power_State'Old = ON |
|
|
|
|
|
|
|
and then On_State'Old in INIT | RUNNING |
|
|
|
|
|
|
|
and then Navigation_Mode'Old = A) |
|
|
|
then Operating_Point = Operating_Point'Old) |
|
|
|
then Operating_Point = Operating_Point'Old) |
|
|
|
|
|
|
|
|
|
|
|
-- Freeze the operating mode once landing is activated. |
|
|
|
-- The operating point is frozen once landing is activated. |
|
|
|
|
|
|
|
|
|
|
|
and then |
|
|
|
and then |
|
|
|
(if Power_State'Old = ON |
|
|
|
(if Power_State'Old = ON |
|
|
@ -246,7 +261,7 @@ is |
|
|
|
and then Power_On |
|
|
|
and then Power_On |
|
|
|
and then On_State = INIT |
|
|
|
and then On_State = INIT |
|
|
|
and then not Mission_Abort_Received |
|
|
|
and then not Mission_Abort_Received |
|
|
|
and then not Boarding_Completed |
|
|
|
and then not Ready_For_Takeoff |
|
|
|
=> |
|
|
|
=> |
|
|
|
Power_State = ON |
|
|
|
Power_State = ON |
|
|
|
and then On_State = INIT, |
|
|
|
and then On_State = INIT, |
|
|
@ -255,7 +270,7 @@ is |
|
|
|
and then Power_On |
|
|
|
and then Power_On |
|
|
|
and then On_State = INIT |
|
|
|
and then On_State = INIT |
|
|
|
and then not Mission_Abort_Received |
|
|
|
and then not Mission_Abort_Received |
|
|
|
and then Boarding_Completed |
|
|
|
and then Ready_For_Takeoff |
|
|
|
and then not Start_Or_Go_Received |
|
|
|
and then not Start_Or_Go_Received |
|
|
|
=> |
|
|
|
=> |
|
|
|
Power_State = ON |
|
|
|
Power_State = ON |
|
|
@ -265,7 +280,7 @@ is |
|
|
|
and then Power_On |
|
|
|
and then Power_On |
|
|
|
and then On_State = INIT |
|
|
|
and then On_State = INIT |
|
|
|
and then not Mission_Abort_Received |
|
|
|
and then not Mission_Abort_Received |
|
|
|
and then Boarding_Completed |
|
|
|
and then Ready_For_Takeoff |
|
|
|
and then Start_Or_Go_Received |
|
|
|
and then Start_Or_Go_Received |
|
|
|
=> |
|
|
|
=> |
|
|
|
Power_State = ON |
|
|
|
Power_State = ON |
|
|
@ -393,15 +408,10 @@ is |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
procedure Mission_Setup_Management with |
|
|
|
|
|
|
|
Global => (In_Out => State), |
|
|
|
|
|
|
|
Post => (if Payload_Bay_Closed |
|
|
|
|
|
|
|
and then Mission_Parameters_Defined |
|
|
|
|
|
|
|
and then Energy_Compatible_With_Mission |
|
|
|
|
|
|
|
then Boarding_Completed); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure Operating_Point_Update_Management with |
|
|
|
procedure Operating_Point_Update_Management with |
|
|
|
Global => (In_Out => State), |
|
|
|
-- Compute the value of Operating_Point |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Global => (In_Out => Private_State), |
|
|
|
Contract_Cases => |
|
|
|
Contract_Cases => |
|
|
|
(Navigation_Mode_From_CP = A |
|
|
|
(Navigation_Mode_From_CP = A |
|
|
|
or else not Operating_Point_From_GS_Received |
|
|
|
or else not Operating_Point_From_GS_Received |
|
|
@ -410,18 +420,11 @@ private |
|
|
|
|
|
|
|
|
|
|
|
Navigation_Mode_From_CP = RP |
|
|
|
Navigation_Mode_From_CP = RP |
|
|
|
and then Operating_Point_From_GS_Received |
|
|
|
and then Operating_Point_From_GS_Received |
|
|
|
and then Power_State = ON |
|
|
|
|
|
|
|
and then On_State = RUNNING |
|
|
|
|
|
|
|
and then Running_State = LANDING |
|
|
|
|
|
|
|
=> |
|
|
|
|
|
|
|
Operating_Point = Operating_Point'Old, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Navigation_Mode_From_CP = RP |
|
|
|
|
|
|
|
and then Operating_Point_From_GS_Received |
|
|
|
|
|
|
|
and then not (Power_State = ON |
|
|
|
|
|
|
|
and then On_State = RUNNING |
|
|
|
|
|
|
|
and then Running_State = LANDING) |
|
|
|
|
|
|
|
=> |
|
|
|
=> |
|
|
|
Operating_Point = Operating_Point_From_GS); |
|
|
|
(if Power_State = ON |
|
|
|
|
|
|
|
and then On_State = RUNNING |
|
|
|
|
|
|
|
and then Running_State = LANDING |
|
|
|
|
|
|
|
then Operating_Point = Operating_Point'Old |
|
|
|
|
|
|
|
else Operating_Point = Operating_Point_From_GS)); |
|
|
|
|
|
|
|
|
|
|
|
end MMS.F_PT.F_MM.Behavior; |
|
|
|
end MMS.F_PT.F_MM.Behavior; |
|
|
|