Commit 67c41184 authored by Claire Dross's avatar Claire Dross

Layer2_MMS_SW_SPARK: continue the specification of F_MM

parent 813e5522
...@@ -6,15 +6,15 @@ package External with Abstract_State => (State with External => Async_Writers) i ...@@ -6,15 +6,15 @@ package External with Abstract_State => (State with External => Async_Writers) i
-- Ground-based Mission Preparation and Supervision -- -- Ground-based Mission Preparation and Supervision --
------------------------------------------------------ ------------------------------------------------------
function Navigation_Parameters return Navigation_Parameters_Type with function Navigation_Parameters return Navigation_Parameters_Type_Option with
Volatile_Function, Volatile_Function,
Global => State; Global => State;
function Navigation_Mode return Navigation_Mode_Type with function Navigation_Mode return Navigation_Mode_Type_Option with
Volatile_Function, Volatile_Function,
Global => State; Global => State;
function Navigation_Option return Navigation_Option_Type with function Navigation_Option return Navigation_Option_Type_Option with
Volatile_Function, Volatile_Function,
Global => State; Global => State;
...@@ -50,7 +50,7 @@ package External with Abstract_State => (State with External => Async_Writers) i ...@@ -50,7 +50,7 @@ package External with Abstract_State => (State with External => Async_Writers) i
Volatile_Function, Volatile_Function,
Global => State; Global => State;
function USB_Key return Navigation_Parameters_Type with function USB_Key return Navigation_Parameters_Type_Option with
Volatile_Function, Volatile_Function,
Global => State; Global => State;
......
...@@ -11,13 +11,13 @@ package MMS.F_PT.F_CM.Input is ...@@ -11,13 +11,13 @@ package MMS.F_PT.F_CM.Input is
-- From F_PT -- -- From F_PT --
--------------- ---------------
function Navigation_Parameters return Navigation_Parameters_Type function Navigation_Parameters return Navigation_Parameters_Type_Option
renames MMS.F_PT.Input.Navigation_Parameters; renames MMS.F_PT.Input.Navigation_Parameters;
function Navigation_Mode return Navigation_Mode_Type function Navigation_Mode return Navigation_Mode_Type_Option
renames MMS.F_PT.Input.Navigation_Mode; renames MMS.F_PT.Input.Navigation_Mode;
function Navigation_Option return Navigation_Option_Type function Navigation_Option return Navigation_Option_Type_Option
renames MMS.F_PT.Input.Navigation_Option; renames MMS.F_PT.Input.Navigation_Option;
function Go return Boolean function Go return Boolean
...@@ -41,7 +41,7 @@ package MMS.F_PT.F_CM.Input is ...@@ -41,7 +41,7 @@ package MMS.F_PT.F_CM.Input is
function Payload_Mass return Payload_Mass_Type function Payload_Mass return Payload_Mass_Type
renames MMS.F_PT.Input.Payload_Mass; renames MMS.F_PT.Input.Payload_Mass;
function USB_Key return Navigation_Parameters_Type function USB_Key return Navigation_Parameters_Type_Option
renames MMS.F_PT.Input.USB_Key; renames MMS.F_PT.Input.USB_Key;
function P return Distance_Type function P return Distance_Type
......
...@@ -59,13 +59,13 @@ package MMS.F_PT.F_CM.Output is ...@@ -59,13 +59,13 @@ package MMS.F_PT.F_CM.Output is
-- To F_MM -- -- To F_MM --
------------- -------------
function Navigation_Parameters return Navigation_Parameters_Type function Navigation_Parameters return Navigation_Parameters_Type_Option
renames MMS.F_PT.F_CM.Input.Navigation_Parameters; renames MMS.F_PT.F_CM.Input.Navigation_Parameters;
function Navigation_Mode return Navigation_Mode_Type function Navigation_Mode return Navigation_Mode_Type_Option
renames MMS.F_PT.F_CM.Input.Navigation_Mode; renames MMS.F_PT.F_CM.Input.Navigation_Mode;
function Navigation_Option return Navigation_Option_Type function Navigation_Option return Navigation_Option_Type_Option
renames MMS.F_PT.F_CM.Input.Navigation_Option; renames MMS.F_PT.F_CM.Input.Navigation_Option;
function Go return Boolean function Go return Boolean
...@@ -86,7 +86,7 @@ package MMS.F_PT.F_CM.Output is ...@@ -86,7 +86,7 @@ package MMS.F_PT.F_CM.Output is
function Bay_Switch return Bay_Switch_Type function Bay_Switch return Bay_Switch_Type
renames MMS.F_PT.F_CM.Input.Bay_Switch; renames MMS.F_PT.F_CM.Input.Bay_Switch;
function USB_Key return Navigation_Parameters_Type function USB_Key return Navigation_Parameters_Type_Option
renames MMS.F_PT.F_CM.Input.USB_Key; renames MMS.F_PT.F_CM.Input.USB_Key;
---------------------- ----------------------
......
...@@ -35,7 +35,7 @@ package MMS.F_PT.F_FC.Behavior with SPARK_Mode is ...@@ -35,7 +35,7 @@ package MMS.F_PT.F_FC.Behavior with SPARK_Mode is
-- Estimated Values -- -- Estimated Values --
---------------------- ----------------------
function Q_Dot return Angular_Speed_Type with Global => Private_State; function Q_Dot return Speed_Type with Global => Private_State;
------------ ------------
-- States -- -- States --
......
...@@ -47,15 +47,15 @@ package MMS.F_PT.F_FC.Data with SPARK_Mode is ...@@ -47,15 +47,15 @@ package MMS.F_PT.F_FC.Data with SPARK_Mode is
-- From 6.7.3.2 -- From 6.7.3.2
Qdot_MinCl : constant Angular_Speed_Type; -- in angle.s-1 Qdot_MinCl : constant Speed_Type; -- in angle.s-1
Qdot_MaxCl : constant Angular_Speed_Type; -- in angle.s-1 Qdot_MaxCl : constant Speed_Type; -- in angle.s-1
Q_MaxCl : constant Angle_Type; -- in angle Q_MaxCl : constant Angle_Type; -- in angle
Qdot_MinCr : constant Angular_Speed_Type; -- in angle.s-1 Qdot_MinCr : constant Speed_Type; -- in angle.s-1
Qdot_MaxCr : constant Angular_Speed_Type; -- in angle.s-1 Qdot_MaxCr : constant Speed_Type; -- in angle.s-1
Q_MinCr : constant Angle_Type; -- in angle Q_MinCr : constant Angle_Type; -- in angle
Pdot_MaxCr : constant Speed_Type; -- in km/h Pdot_MaxCr : constant Speed_Type; -- in angle.s-1
Qdot_MinDs : constant Angular_Speed_Type; -- in angle.s-1 Qdot_MinDs : constant Speed_Type; -- in angle.s-1
Qdot_MaxDs : constant Angular_Speed_Type; -- in angle.s-1 Qdot_MaxDs : constant Speed_Type; -- in angle.s-1
Q_MaxDs : constant Angle_Type; -- in angle Q_MaxDs : constant Angle_Type; -- in angle
Escape_Time : constant Time_Type; -- in s Escape_Time : constant Time_Type; -- in s
...@@ -77,28 +77,28 @@ private ...@@ -77,28 +77,28 @@ private
Flight_Domain_Mesh : constant Flight_Domain_Mesh_Type (1 .. 100, 1 .. 100) := Flight_Domain_Mesh : constant Flight_Domain_Mesh_Type (1 .. 100, 1 .. 100) :=
(others => (others => <>)); (others => (others => <>));
Qdot_MinCl : constant Angular_Speed_Type := 0.0; -- in angle.s-1 Qdot_MinCl : constant Speed_Type := 0.0;
Qdot_MaxCl : constant Angular_Speed_Type := 0.0; -- in angle.s-1 Qdot_MaxCl : constant Speed_Type := 0.0;
Q_MaxCl : constant Angle_Type := 0.0; -- in angle Q_MaxCl : constant Angle_Type := 0.0;
Qdot_MinCr : constant Angular_Speed_Type := 0.0; -- in angle.s-1 Qdot_MinCr : constant Speed_Type := 0.0;
Qdot_MaxCr : constant Angular_Speed_Type := 0.0; -- in angle.s-1 Qdot_MaxCr : constant Speed_Type := 0.0;
Q_MinCr : constant Angle_Type := 0.0; -- in angle Q_MinCr : constant Angle_Type := 0.0;
Pdot_MaxCr : constant Speed_Type := 0.0; -- in km/h Pdot_MaxCr : constant Speed_Type := 0.0;
Qdot_MinDs : constant Angular_Speed_Type := 0.0; -- in angle.s-1 Qdot_MinDs : constant Speed_Type := 0.0;
Qdot_MaxDs : constant Angular_Speed_Type := 0.0; -- in angle.s-1 Qdot_MaxDs : constant Speed_Type := 0.0;
Q_MaxDs : constant Angle_Type := 0.0; -- in angle Q_MaxDs : constant Angle_Type := 0.0;
Escape_Time : constant Time_Type := 0; -- in s Escape_Time : constant Time_Type := 0;
-- From 6.7.4 -- From 6.7.4
Commutation_Duration : constant Time_Type := 0; -- in s Commutation_Duration : constant Time_Type := 0;
Hazard_Duration : constant Time_Type := 0; -- in s Hazard_Duration : constant Time_Type := 0;
Recovery_Speed : constant Integer := 0; -- in m.s Recovery_Speed : constant Integer := 0;
J0 : constant Integer := 0; -- in kg.m2 J0 : constant Integer := 0;
L : constant Integer := 0; -- in m L : constant Integer := 0;
M0 : constant Integer := 0; -- in kg M0 : constant Integer := 0;
end MMS.F_PT.F_FC.Data; end MMS.F_PT.F_FC.Data;
...@@ -19,14 +19,14 @@ package MMS.F_PT.F_MM.Behavior.Guarantees with SPARK_Mode is ...@@ -19,14 +19,14 @@ package MMS.F_PT.F_MM.Behavior.Guarantees with SPARK_Mode is
function Initial_Energy_Check_Succeeded return Boolean is function Initial_Energy_Check_Succeeded return Boolean is
(Power_State = ON (Power_State = ON
and then On_State = INIT and then On_State = INIT
and then Energy_Compatible_With_Mission); and then Initial_Energy_Compatible_With_Mission);
function In_Flight_Energy_Check_Failed return Boolean is function In_Flight_Energy_Check_Failed return Boolean is
(Power_State = ON (Power_State = ON
and then On_State = RUNNING and then On_State = RUNNING
and then Running_State = FLIGHT and then Running_State = FLIGHT
and then Current_Flight_Phase = CRUISE and then Current_Flight_Phase = CRUISE
and then not Energy_Compatible_With_Mission); and then not In_Flight_Energy_Compatible_With_Mission);
function Mission_Cancelled return Boolean is function Mission_Cancelled return Boolean is
(Power_State = On (Power_State = On
......
...@@ -11,13 +11,13 @@ package MMS.F_PT.F_MM.Input is ...@@ -11,13 +11,13 @@ package MMS.F_PT.F_MM.Input is
-- From F_CM -- -- From F_CM --
--------------- ---------------
function Navigation_Parameters return Navigation_Parameters_Type function Navigation_Parameters return Navigation_Parameters_Type_Option
renames MMS.F_PT.F_CM.Output.Navigation_Parameters; renames MMS.F_PT.F_CM.Output.Navigation_Parameters;
function Navigation_Mode return Navigation_Mode_Type function Navigation_Mode return Navigation_Mode_Type_Option
renames MMS.F_PT.F_CM.Output.Navigation_Mode; renames MMS.F_PT.F_CM.Output.Navigation_Mode;
function Navigation_Option return Navigation_Option_Type function Navigation_Option return Navigation_Option_Type_Option
renames MMS.F_PT.F_CM.Output.Navigation_Option; renames MMS.F_PT.F_CM.Output.Navigation_Option;
function Go return Boolean function Go return Boolean
...@@ -38,7 +38,7 @@ package MMS.F_PT.F_MM.Input is ...@@ -38,7 +38,7 @@ package MMS.F_PT.F_MM.Input is
function Payload_Mass return Payload_Mass_Type function Payload_Mass return Payload_Mass_Type
renames MMS.F_PT.F_CM.Output.Payload_Mass; renames MMS.F_PT.F_CM.Output.Payload_Mass;
function USB_Key return Navigation_Parameters_Type function USB_Key return Navigation_Parameters_Type_Option
renames MMS.F_PT.F_CM.Output.USB_Key; renames MMS.F_PT.F_CM.Output.USB_Key;
----------------------- -----------------------
......
private private
package MMS.F_PT.F_MM.State is package MMS.F_PT.F_MM.State is
V : Integer with Part_Of => Private_State;
-----------------
-- Input_State --
-----------------
Input_Navigation_Parameters : Navigation_Parameters_Type_Option with
Part_Of => Input_State;
Input_Navigation_Mode : Navigation_Mode_Type_Option with
Part_Of => Input_State;
Input_Navigation_Option : Navigation_Option_Type_Option with
Part_Of => Input_State;
Input_Go : Boolean with Part_Of => Input_State;
Input_On_OFF_Push_Button : Boolean with Part_Of => Input_State;
Input_Start_Push_Button : Boolean with Part_Of => Input_State;
Input_Mode_Switch : Navigation_Mode_Type with Part_Of => Input_State;
Input_Bay_Switch : Bay_Switch_Type with Part_Of => Input_State;
Input_Payload_Mass : Payload_Mass_Type with Part_Of => Input_State;
Input_USB_Key : Navigation_Parameters_Type_Option with
Part_Of => Input_State;
Input_Mission_Abort : Boolean with Part_Of => Input_State;
Input_Estimated_Total_Mass : Estimated_Total_Mass_Type with
Part_Of => Input_State;
Input_Current_Range : Current_Range_Type with Part_Of => Input_State;
Input_Current_Speed : Current_Speed_Type with Part_Of => Input_State;
Input_Current_Altitude : Current_Altitude_Type with Part_Of => Input_State;
Input_Current_Flight_Phase : Flight_Phase_Type with Part_Of => Input_State;
Input_Energy_Level : Energy_Level_Type with Part_Of => Input_State;
-------------------
-- Private_State --
-------------------
Navigation_Mode : Navigation_Mode_Type with Part_Of => Private_State;
Operating_Mode : Navigation_Option_Type with Part_Of => Private_State;
Navigation_Parameters : Navigation_Parameters_Type with
Part_Of => Private_State;
Operating_Point : Operating_Point_Type with Part_Of => Private_State;
Initial_Energy_Compatible_With_Mission : Boolean with
Part_Of => Private_State;
In_Flight_Energy_Compatible_With_Mission : Boolean with
Part_Of => Private_State;
Descent_Over : Boolean with Part_Of => Private_State;
------------------
-- Output_State --
------------------
Output_Mission_Cancelled : Boolean with Part_Of => Output_State;
Output_Mission_Complete : Boolean with Part_Of => Output_State;
Output_Mission_Aborted : Boolean with Part_Of => Output_State;
Output_Emergency_Landing : Boolean with Part_Of => Output_State;
Output_Start_Take_Off : Boolean with Part_Of => Output_State;
Output_Start_Landing : Boolean with Part_Of => Output_State;
Output_Operating_Point : Operating_Point_Type with Part_Of => Output_State;
Output_Operating_Mode : Navigation_Option_Type with Part_Of => Output_State;
Output_Mission_Range : Current_Range_Type with Part_Of => Output_State;
end MMS.F_PT.F_MM.State; end MMS.F_PT.F_MM.State;
with MMS.F_PT.F_MM.State; use MMS.F_PT.F_MM.State;
package body MMS.F_PT.F_MM with
SPARK_Mode,
Refined_State => (Input_State => (Input_Navigation_Parameters,
Input_Navigation_Mode,
Input_Navigation_Option,
Input_Go,
Input_On_OFF_Push_Button,
Input_Start_Push_Button,
Input_Mode_Switch,
Input_Bay_Switch,
Input_Payload_Mass,
Input_USB_Key,
Input_Mission_Abort,
Input_Estimated_Total_Mass,
Input_Current_Range,
Input_Current_Speed,
Input_Current_Altitude,
Input_Current_Flight_Phase,
Input_Energy_Level),
Output_State => (Output_Mission_Cancelled,
Output_Mission_Complete,
Output_Mission_Aborted,
Output_Emergency_Landing,
Output_Start_Take_Off,
Output_Start_Landing,
Output_Operating_Point,
Output_Operating_Mode,
Output_Mission_Range),
Private_State => (Navigation_Mode,
Operating_Mode,
Navigation_Parameters,
Operating_Point,
Initial_Energy_Compatible_With_Mission,
In_Flight_Energy_Compatible_With_Mission,
Descent_Over))
is
end MMS.F_PT.F_MM;
with Types; use Types; with Types; use Types;
package MMS.F_PT.F_MM with Abstract_State => (Private_State, Output_State) is package MMS.F_PT.F_MM with
SPARK_Mode,
Abstract_State => (Private_State, Output_State, Input_State)
is
pragma Elaborate_Body (MMS.F_PT.F_MM); pragma Elaborate_Body (MMS.F_PT.F_MM);
type Viability_Cell_Center_Type is record type Viability_Cell_Center_Type is record
...@@ -24,4 +27,28 @@ package MMS.F_PT.F_MM with Abstract_State => (Private_State, Output_State) is ...@@ -24,4 +27,28 @@ package MMS.F_PT.F_MM with Abstract_State => (Private_State, Output_State) is
type Glide_Domain_Mesh_Type is array type Glide_Domain_Mesh_Type is array
(Glide_Altitude_Center range <>) of Current_Altitude_Type; (Glide_Altitude_Center range <>) of Current_Altitude_Type;
type Mission_Profile_Type is record
Mass : Payload_Mass_Type;
Distance : Current_Range_Type;
Altitude : Current_Altitude_Type;
Speed : Current_Speed_Type;
end record;
type Center_Mission_Profile_Type is record
M : Payload_Mass_Center;
D : Viability_Distance_Center;
A : Viability_Altitude_Center;
S : Viability_Speed_Center;
end record;
type Mission_Profile_Distance_Type is new Natural;
type Neighbour_Mission_Profile_Type is record
Mission_Profile : Center_Mission_Profile_Type;
Distance : Mission_Profile_Distance_Type;
end record;
type Neighbour_Mission_Profile_Array_Type is array (Positive range 1 .. 16)
of Neighbour_Mission_Profile_Type;
end MMS.F_PT.F_MM; end MMS.F_PT.F_MM;
...@@ -9,13 +9,13 @@ package MMS.F_PT.Input is ...@@ -9,13 +9,13 @@ package MMS.F_PT.Input is
-- From MMS -- -- From MMS --
-------------- --------------
function Navigation_Parameters return Navigation_Parameters_Type function Navigation_Parameters return Navigation_Parameters_Type_Option
renames MMS.Input.Navigation_Parameters; renames MMS.Input.Navigation_Parameters;
function Navigation_Mode return Navigation_Mode_Type function Navigation_Mode return Navigation_Mode_Type_Option
renames MMS.Input.Navigation_Mode; renames MMS.Input.Navigation_Mode;
function Navigation_Option return Navigation_Option_Type function Navigation_Option return Navigation_Option_Type_Option
renames MMS.Input.Navigation_Option; renames MMS.Input.Navigation_Option;
function Go return Boolean function Go return Boolean
...@@ -39,7 +39,7 @@ package MMS.F_PT.Input is ...@@ -39,7 +39,7 @@ package MMS.F_PT.Input is
function Payload_Mass return Payload_Mass_Type function Payload_Mass return Payload_Mass_Type
renames MMS.Input.Payload_Mass; renames MMS.Input.Payload_Mass;
function USB_Key return Navigation_Parameters_Type function USB_Key return Navigation_Parameters_Type_Option
renames MMS.Input.USB_Key; renames MMS.Input.USB_Key;
function P return Distance_Type function P return Distance_Type
......
...@@ -7,13 +7,13 @@ package MMS.Input is ...@@ -7,13 +7,13 @@ package MMS.Input is
-- Ground-based Mission Preparation and Supervision -- -- Ground-based Mission Preparation and Supervision --
------------------------------------------------------ ------------------------------------------------------
function Navigation_Parameters return Navigation_Parameters_Type function Navigation_Parameters return Navigation_Parameters_Type_Option
renames External.Navigation_Parameters; renames External.Navigation_Parameters;
function Navigation_Mode return Navigation_Mode_Type function Navigation_Mode return Navigation_Mode_Type_Option
renames External.Navigation_Mode; renames External.Navigation_Mode;
function Navigation_Option return Navigation_Option_Type function Navigation_Option return Navigation_Option_Type_Option
renames External.Navigation_Option; renames External.Navigation_Option;
function Go return Boolean renames External.Go; function Go return Boolean renames External.Go;
...@@ -39,7 +39,7 @@ package MMS.Input is ...@@ -39,7 +39,7 @@ package MMS.Input is
function Payload_Mass return Payload_Mass_Type function Payload_Mass return Payload_Mass_Type
renames External.Payload_Mass; renames External.Payload_Mass;
function USB_Key return Navigation_Parameters_Type function USB_Key return Navigation_Parameters_Type_Option
renames External.USB_Key; renames External.USB_Key;
------------------------- -------------------------
......
...@@ -16,22 +16,47 @@ package Types is ...@@ -16,22 +16,47 @@ package Types is
Altitude : Altitude_Input_Type; Altitude : Altitude_Input_Type;
end record; end record;
type Navigation_Parameters_Type_Option (Present : Boolean := False) is record
case Present is
when True =>
Content : Navigation_Parameters_Type;
when False =>
null;
end case;
end record;
type Navigation_Mode_Type is (RP, A); type Navigation_Mode_Type is (RP, A);
type Navigation_Mode_Type_Option (Present : Boolean := False) is record
case Present is
when True =>
Content : Navigation_Mode_Type;
when False =>
null;
end case;
end record;
type Navigation_Option_Type is (SPEED, ALTITUDE, ENERGY); type Navigation_Option_Type is (SPEED, ALTITUDE, ENERGY);
type Navigation_Option_Type_Option (Present : Boolean := False) is record
case Present is
when True =>
Content : Navigation_Option_Type;
when False =>
null;
end case;
end record;
type Bay_Switch_Type is (OPEN, CLOSED); type Bay_Switch_Type is (OPEN, CLOSED);
type Payload_Mass_Type is new Integer range 0 .. 98; -- in kg type Payload_Mass_Type is new Integer range 0 .. 98; -- in kg
type Distance_Type is new Float; -- type of P, unit and bounds ??? type Distance_Type is new Float; -- type of P, unit and bounds ???
type Speed_Type is new Float; -- type of P_Dot, unit and bounds ??? type Speed_Type is new Float; -- type of P_Dot and Q_Dot, in angle.s-1, bounds ???
type Angle_Type is new Float; -- type of Q, unit and bounds ??? type Angle_Type is new Float; -- type of Q, unit and bounds ???
type Angular_Speed_Type is new Float; -- type of Q_Dot, unit and bounds ???
type Rotactor_Type is range 0 .. 9; type Rotactor_Type is range 0 .. 9;
type CP_Switches_Type is record type CP_Switches_Type is record
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment