@ -24,186 +24,191 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
function Power_On return Boolean ;
function Power_On return Boolean ;
function Payload_Bay_Closed return Boolean with
function Payload_Bay_Closed return Boolean with
Pre => Power_State = ON
Pre => Power_On ;
and then On_State = INIT ;
function Payload_Mass_Given return Boolean with
function Payload_Mass_Given return Boolean with
Pre => Power_State = ON ;
Pre => Power_On ;
- - ? ? ? Should we assume that Payload_Mass is always given after takeoff ?
- - ? ? ? Should we assume that Payload_Mass is always given after takeoff ?
- - same question for usb key
- - same question for usb key
function Payload_Mass return Payload_Mass_Type with
function Payload_Mass return Payload_Mass_Type with
Pre => Power_State = ON ;
Pre => Power_On ;
function Navigation_Mode_From_CP return Navigation_Mode_Type ;
function Navigation_Mode_From_CP return Navigation_Mode_Type with
Pre => Power_On ;
function Navigation_Mode_From_GS_Received return Boolean ;
function Navigation_Mode_From_GS_Received return Boolean with
Pre => Power_On ;
function Navigation_Mode_From_GS return Navigation_Mode_Type with
function Navigation_Mode_From_GS return Navigation_Mode_Type with
Pre => Navigation_Mode_From_GS_Received ;
Pre => Power_On and then Navigation_Mode_From_GS_Received ;
function Operating_Mode_From_CP return Navigation_Option_Type ;
function Operating_Mode_From_CP return Navigation_Option_Type with
Pre => Power_On ;
function Operating_Mode_From_GS_Received return Boolean ;
function Operating_Mode_From_GS_Received return Boolean with
Pre => Power_On ;
function Operating_Mode_From_GS return Navigation_Option_Type with
function Operating_Mode_From_GS return Navigation_Option_Type with
Pre => Operating_Mode_From_GS_Received ;
Pre => Power_On and then Operating_Mode_From_GS_Received ;
function Navigation_Parameters_From_GS_Received return Boolean ;
function Navigation_Parameters_From_GS_Received return Boolean with
Pre => Power_On ;
function Navigation_Parameters_From_GS return Navigation_Parameters_Type with
function Navigation_Parameters_From_GS return Navigation_Parameters_Type with
Pre => Navigation_Parameters_From_GS_Received ;
Pre => Power_On and then Navigation_Parameters_From_GS_Received ;
function USB_Key_Present return Boolean ;
function USB_Key_Present return Boolean with
Pre => Power_On ;
function Navigation_Parameters_From_USB_Key return Navigation_Parameters_Type
function Navigation_Parameters_From_USB_Key return Navigation_Parameters_Type
with
with
Pre => USB_Key_Present ;
Pre => Power_On and then USB_Key_Present ;
function Mission_Abort_Received return Boolean with
function Mission_Abort_Received return Boolean with
Pre => Power_State = ON ;
Pre => Power_On ;
function Start_Or_Go_Received return Boolean with
function Start_Or_Go_Received return Boolean with
Pre => Power_State = ON
Pre => Power_On ;
and then On_State = INIT ;
function Current_Range return Current_Range_Type ;
function Current_Range return Current_Range_Type with
Pre => Power_On ;
function Current_Speed return Current_Speed_Type ;
function Current_Speed return Current_Speed_Type with
Pre => Power_On ;
function Current_Altitude return Current_Altitude_Type ;
function Current_Altitude return Current_Altitude_Type with
Pre => Power_On ;
function Current_Flight_Phase return Flight_Phase_Type with
function Current_Flight_Phase return Flight_Phase_Type with
Pre => Power_State = ON
Pre => Power_On ;
and then On_State = RUNNING
and then Running_State = FLIGHT ;
function Energy_Level return Energy_Level_Type with
function Energy_Level return Energy_Level_Type with
Pre => Power_State = ON ;
Pre => Power_On ;
function Mission_Parameters_Defined return Boolean is
function Mission_Parameters_Defined return Boolean is
( USB_Key_Present
( USB_Key_Present
or else ( Navigation_Mode_From_CP = RP
or else ( Navigation_Mode_From_CP = RP
and then Navigation_Parameters_From_GS_Received ) ) ;
and then Navigation_Parameters_From_GS_Received ) )
with
Pre => Power_On ;
function Init_Completed return Boolean is
function Init_Completed return Boolean is
( Payload_Bay_Closed
( Payload_Bay_Closed
and then Payload_Mass_Given
and then Payload_Mass_Given
and then Mission_Parameters_Defined )
and then Mission_Parameters_Defined )
with
with
Pre => Power_State = ON
Pre => Power_On ;
and then On_State = INIT ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - States of the automaton in Figure 3 - -
- - States of the automaton in Figure 3 - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
type Power_State_Type is ( ON , OFF ) ;
function Power_State return Power_State_Type ;
function Power_State return Power_State_Type with
Global => Private _ State ;
type On_State_Type is ( INIT , RUNNING , COMPLETE , ABORTED ) ;
function On_State return On_State_Type with
function On_State return On_State_Type with
Global => Private _ State ,
Pre => Power_State = ON ;
Pre => Power_State = ON ;
type Running_State_Type is ( TAKE_OFF , FLIGHT , LANDING ) ;
function Running_State return Running_State_Type with
function Running_State return Running_State_Type with
Global => Private _ State ,
Pre => Power_State = ON
Pre => Power_State = ON
and then On_State = RUNNING ;
and then On_State = RUNNING ;
type Init_State_Type is ( PREPARATION , READY , CANCELLED ) ;
function Init_State return Init_State_Type with
function Init_State return Init_State_Type with
Global => Private _ State ,
Pre => Power_State = ON
Pre => Power_State = ON
and then On_State = INIT ;
and then On_State = INIT ;
function Aborted_For_Energy_Reasons return Boolean with
Pre => Power_State = ON
and then On_State = ABORTED ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Properties and Entities - -
- - Properties and Entities - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Power_Off return Boolean is ( not Power_On ) ;
function Navigation_Mode return Navigation_Mode_Type with
Pre => Power_On ;
function Take_Off_Over return Boolean with
Global => Private _ State ,
Pre => Power_State = ON
and then On_State = RUNNING
and then Running_State = TAKE_OFF ;
function Descent_Over return Boolean with
function Operating_Mode return Navigation_Option_Type with
Global => Private _ State ,
Pre => Power_On ;
Pre => Power_State = ON
and then On_State = RUNNING
and then Running_State = FLIGHT ;
function Landed return Boolean is
function Navigation_Parameters return Navigation_Parameters_Type
( Current_Speed = 0 and Current_Altitude = 0 )
with Pre => Power_On
with
and then Mission_Parameters_Defined ;
Pre => Power_State = ON
and then On_State = RUNNING
and then Running_State = LANDING ;
function Mission_Range_From_Navigation_Parameters
function Mission_Range_From_Navigation_Parameters
return Current_Range_Type
return Current_Range_Type
with Pre => Mission_Parameters_Defined ;
with Global =>
- - Fetch distance from State . Navigation_Parameters and do the appropriate
( Input => Operating_Point_State , Proof_In => Input_State ) ,
Pre => Power_On
and then Mission_Parameters_Defined ;
- - Fetch distance from Navigation_Parameters and do the appropriate
- - conversion .
- - conversion .
function Operating_Point_From_Navigation_Parameters
function Operating_Point_From_Navigation_Parameters
return Operating_Point_Type
return Operating_Point_Type
with Pre => Mission_Parameters_Defined ;
with Global =>
- - Fetch altitude and speed from State . Navigation_Parameters and do the
( Input => Operating_Point_State , Proof_In => Input_State ) ,
Pre => Power_On
and then Mission_Parameters_Defined ;
- - Fetch altitude and speed from Navigation_Parameters and do the
- - appropriate conversions .
- - appropriate conversions .
function Navigation_Mode return Navigation_Mode_Type with
function Mission_Range return Current_Range_Type with
Global => Private _ State ,
Pre => Power_On
Pre => Power_State = ON
and then Power_State = On
and then On_State in INIT | RUNNING ;
and then On_State in INIT | RUNNING
and then Mission_Parameters_Defined ;
function Operating_Mode return Navigation_Option_Type with
function Operating_Point return Operating_Point_Type with
Global => Private _ State ,
Pre => Power_On
Pre => Power_State = ON
and then Power_State = On
and then On_State in INIT | RUNNING
and then Mission_Parameters_Defined ;
function Initial_Energy_Compatible_With_Mission return Boolean
with
Pre => Power_On
and then Power_State = ON
and then On_State = INIT
and then Init_Completed ;
function In_Flight_Energy_Compatible_With_Mission return Boolean
with
Pre => Power_On
and then Power_State = ON
and then On_State = RUNNING
and then On_State = RUNNING
and then Navigation_Mode = RP ;
and then Running_State = FLIGHT
and then Current_Flight_Phase = CRUISE ;
function Initial_Energy_Compatible_With_Mission return Boolean with
function Take_Off_Over return Boolean with
Global => Private _ State ;
Pre => Power_On
and then Power_State = ON
and then On_State = RUNNING
and then Running_State = TAKE_OFF ;
function In_Flight_Energy_Compatible_With_Mission return Boolean with
function Descent_Over return Boolean with
Global => Private _ State ;
Pre => Power_On
and then Power_State = ON
and then On_State = RUNNING
and then Running_State = FLIGHT
and then Current_Flight_Phase = DESCENT ;
function Emergency_Landing return Boolean is
function Landed return Boolean is
( On_State = ABORTED )
( Current_Speed = 0 and Current_Altitude = 0 )
with
with
Global => Private _ State ,
Pre => Power_On
Pre => Power_State = ON ;
and then Power_State = ON
and then On_State = RUNNING
function Mission_Range return Current_Range_Type with
and then Running_State = LANDING ;
Global => ( Input => Private _ State , Proof_In => Input_State ) ,
Pre => Mission_Parameters_Defined ;
function Operating_Point return Operating_Point_Type with
function Emergency_Landing return Boolean with
Global => ( Input => Private _ State , Proof_In => Input_State ) ,
Global => Output_State ;
Pre => Mission_Parameters_Defined ;
function Mission_Aborted_Signaled return Boolean with
function Mission_Aborted_Signaled return Boolean with
Global => Private _ State ,
Global => Output_State ;
Pre => Power_State = ON ;
function Mission_Cancelled_Signaled return Boolean with
function Mission_Cancelled_Signaled return Boolean with
Global => Private _ State ,
Global => Output_State ;
Pre => Power_State = ON
and then On_State = INIT ;
function Aborted_For_Energy_Reasons return Boolean with
Global => Private _ State ,
Pre => Power_State = ON
and then On_State = ABORTED ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Behavioural Specification of F_MM - -
- - Behavioural Specification of F_MM - -
@ -217,44 +222,305 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
procedure Write_Outputs with
procedure Write_Outputs with
- - Compute values of outputs from the current state
- - Compute values of outputs from the current state
Global => ( Input => Private _ State ,
Global => ( Input => Private _ State ,
Output => Output_State ) ;
Output => Output_State ) ,
Post =>
( if Power_State = ON and then On_State = ABORTED then
Emergency_Landing
and then Mission_Aborted_Signaled )
and then
( if Power_State = ON
and then On_State = INIT
and then Init_State = CANCELLED
then Mission_Cancelled_Signaled ) ;
procedure Run with
- - - - - - - - - - - - - - - - - - -
- - Do :
- - Task s of F_MM - -
- - - Compute the new state of the automaton
- - - - - - - - - - - - - - - - - - -
Global => ( In_Out => Private _ State , Input => Input_State ) ,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Post =>
- - Management of Navigation Modes / Options / Parameters - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - RP mode enables modification of range parameter before take - off .
procedure Management_Of_Navigation_Modes_Options_Parameters with
- - Compute the value of Navigation_Mode / Options / Parameters ( see 6.9 . 4 )
( if not ( Power_State ' Old = ON
Global => ( Input => ( Input_State , Private _ State ) ,
and then On_State ' Old = INIT
Output => Navigation_Parameter_State ) ,
and then Navigation_Mode ' Old = RP )
Pre => Power_On ,
then Mission_Range = Mission_Range ' Old
Post => Navigation_Mode =
elsif Mission_Parameters_Defined
then Mission_Range = Mission_Range_From_Navigation_Parameters )
- - RP mode enables modification of altitude and speed parameters at any
- - In case of conflict on the navigation mode , CP prevails over GS .
- - time ( but not at landing , it is frozen . . . ) .
and then
( if Navigation_Mode_From_CP = A
( if ( Power_State ' Old = ON
or else not Navigation_Mode_From_GS_Received
and then On_State ' Old in INIT | RUNNING
then Navigation_Mode_From_CP
and then Navigation_Mode ' Old = A )
then Operating_Point = Operating_Point ' Old )
- - The operating point is frozen once landing is activated .
- - If CP states the mode to RC then GS can choose the navigation mode .
else Navigation_Mode_From_GS )
and then Operating_Mode =
( if Navigation_Mode = A
or else not Operating_Mode_From_GS_Received
then Operating_Mode_From_CP
else Operating_Mode_From_GS )
and then
and then
( if Power_State ' Old = ON
( if Mission_Parameters_Defined then
and then On_State ' Old = RUNNING
Navigation_Parameters =
and then Running_State = LANDING
( if Navigation_Mode_From_CP = A
then Operating_Point = Operating_Point ' Old ) ,
or else not Navigation_Parameters_From_GS_Received
then Navigation_Parameters_From_USB_Key
else Navigation_Parameters_From_GS ) ) ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Operating Point Update Management - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
procedure Operating_Point_Update_Management with
- - Compute the value of Operating_Point and Mission_Range
Global => ( Input =>
( Input_State , Private _ State , Navigation_Parameter_State ) ,
In_Out => Operating_Point_State ) ,
Pre => Power_On
and then Mission_Parameters_Defined
and then Power_State = ON
and then On_State in INIT | RUNNING ,
- - F_MM ensures freeze of the operating point once landing is activated .
Post =>
( 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_Navigation_Parameters )
- - RP mode enables modification of range parameter before take - off .
and then
( if Navigation_Mode = RP
then Mission_Range = Mission_Range ' Old
else Mission_Range = Mission_Range_From_Navigation_Parameters ) ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Mission_Viability_Logic - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Mission_Profile return Mission_Profile_Type with
Global => Viability_Logic_State ;
function Appropriate_Tabulating_Function return Viability_Domain_Mesh_Type
with
Global => Viability_Logic_State ;
function Distance_With_Neighbour
( Neighbour : Mission_Profile_Type ) return Mission_Profile_Distance_Type
with
Global => Viability_Logic_State ;
- - Compute the distance between Mission_Profile and its Neighbour .
function Nearest_Neighbours return Neighbour_Mission_Profiles with
Global => Viability_Logic_State ;
function Extract_Energy_Level_For_Neighbours return Energy_Levels
with
Global => Viability_Logic_State ;
function Interpolated_Energy_Level return Energy_Level_Type with
Global => Viability_Logic_State ;
- - Compute the interpolation of the energy levels of the neighbours of
- - Mission_Profile by distance - based averaging .
procedure Mission_Viability_Logic with
Global => ( Input =>
( Input_State ,
Private _ State ,
Navigation_Parameter_State ,
Operating_Point_State ) ,
In_Out => Viability_Logic_State ) ,
Pre => Power_State = ON ,
Post =>
- - 1. Assembling mission profile .
Mission_Profile =
( Mass => Payload_Mass ,
Distance => Current_Range ,
Altitude => Current_Altitude ,
Speed => Current_Speed )
- - 2. Selecting tabulating function that corresponds to navigation mode .
and then Appropriate_Tabulating_Function =
( if On_State = INIT and then Navigation_Mode = A
then Data . Amode_Initial_Domain_Mesh
elsif On_State = INIT and then Navigation_Mode = RP
then Data . RPmode_Initial_Domain_Mesh
elsif Navigation_Mode = A
then Data . Amode_Cruise_Domain_Mesh
else Data . RPmode_Cruise_Domain_Mesh )
- - 3. Computing the nearest neighbours of Mission_Profile in
- - Appropriate_Tabulating_Function , and the distance of Mission_Profile to
- - its nearest neignbours .
and then
( for all Neighbour_Center of Nearest_Neighbours . Neighbours =>
Neighbour_Center . Mission_Profile . M in
MMS . F_PT . Data . Payload_Mass_Grid ' Range
and then Neighbour_Center . Mission_Profile . D in
Appropriate_Tabulating_Function ' Range ( 1 )
and then Neighbour_Center . Mission_Profile . A in
Appropriate_Tabulating_Function ' Range ( 2 )
and then Neighbour_Center . Mission_Profile . S in
Appropriate_Tabulating_Function ' Range ( 3 )
and then Neighbour_Center . Distance =
Distance_With_Neighbour
( Mission_Profile_Type '
( Mass =>
MMS . F_PT . Data . Payload_Mass_Grid
( Neighbour_Center . Mission_Profile . M ) ,
Distance =>
Appropriate_Tabulating_Function
( Neighbour_Center . Mission_Profile . D ,
Neighbour_Center . Mission_Profile . A ,
Neighbour_Center . Mission_Profile . S ) . Distance ,
Altitude =>
Appropriate_Tabulating_Function
( Neighbour_Center . Mission_Profile . D ,
Neighbour_Center . Mission_Profile . A ,
Neighbour_Center . Mission_Profile . S ) . Altitude ,
Speed =>
Appropriate_Tabulating_Function
( Neighbour_Center . Mission_Profile . D ,
Neighbour_Center . Mission_Profile . A ,
Neighbour_Center . Mission_Profile . S ) . Speed ) ) )
- - 4. Extracting energy level for the neighbours .
and then Extract_Energy_Level_For_Neighbours . Size =
Nearest_Neighbours . Size
and then
( for all I in 1 . . Extract_Energy_Level_For_Neighbours . Size =>
Extract_Energy_Level_For_Neighbours . Neighbours ( I ) =
( if On_State = INIT and then Navigation_Mode = A
then Data . Viability_Amode_Initial
( M => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . M ,
D => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . D ,
A => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . A ,
S => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . S )
elsif On_State = INIT and then Navigation_Mode = RP
then Data . Viability_RPmode_Initial
( M => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . M ,
D => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . D ,
A => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . A ,
S => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . S )
elsif Navigation_Mode = A
then Data . Viability_Amode_Cruise
( M => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . M ,
D => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . D ,
A => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . A ,
S => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . S )
else Data . Viability_RPmode_Cruise
( M => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . M ,
D => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . D ,
A => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . A ,
S => Nearest_Neighbours . Neighbours ( I ) . Mission_Profile . S ) ) )
- - 5. Compute MP ' s enery level by interpolation of its neighbours
- - Set appropriate value to Interpolated_Energy_Level
;
procedure Initial_Mission_Viability_Logic with
- - Compute the value of Initial_Energy_Compatible_With_Mission . It should
- - be computed when Init_Completed is True .
Global => ( Input =>
( Input_State ,
Private _ State ,
Navigation_Parameter_State ,
Operating_Point_State ) ,
In_Out => Viability_Logic_State ) ,
Pre => Power_On
and then Power_State = ON
and then On_State = INIT
and then Init_Completed ,
Post => Initial_Energy_Compatible_With_Mission =
- - In A mode , use a 30 % energy margin .
( ( if Navigation_Mode = A then Interpolated_Energy_Level * 13 / 10
- - In RP mode , use a 10 % energy margin .
else Interpolated_Energy_Level * 11 / 10 ) > = Energy_Level ) ;
procedure In_Flight_Mission_Viability_Logic with
- - Compute the value of In_Flight_Energy_Compatible_With_Mission . It should
- - be repeated at a periodic rate of F_Viability .
- - Set In_Flight_Energy_Compatible_With_Mission to True if Energy_Level is
- - at least the Interpolated_Energy_Level plus an enery margin . When
- - EstimatedTotalMass increases , and even more so if it increases quickly ,
- - F_MM applies greater safety margins ( see # 17 ) .
Global => ( Input =>
( Input_State ,
Private _ State ,
Navigation_Parameter_State ,
Operating_Point_State ) ,
In_Out => Viability_Logic_State ) ,
Pre => Power_On
and then Power_State = ON
and then On_State = RUNNING
and then Running_State = FLIGHT
and then Current_Flight_Phase = CRUISE ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Mission Termination Control - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Current_Glide_Distance return Current_Range_Type with
Global => Mission_Termination_State ;
- - Compute the glide distance associated with Current_Altitude using the
- - Glide_Distance_Domain_Mesh table and the Glide_Distance tabulated
- - function .
procedure Mission_Termination_Control with
- - Monitor Current_Range and activate landing .
Global => ( Input =>
( Input_State ,
Private _ State ,
Navigation_Parameter_State ,
Operating_Point_State ) ,
In_Out => Mission_Termination_State ) ,
Pre => Power_On
and then Power_State = ON
and then On_State = RUNNING
and then Running_State = FLIGHT
and then Current_Flight_Phase = DESCENT ,
Post => Descent_Over =
( Mission_Range - Current_Range < Current_Glide_Distance ) ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Update the State Automaton - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
procedure Update_States with
Global => ( Input =>
( Input_State ,
Navigation_Parameter_State ,
Operating_Point_State ,
Viability_Logic_State ,
Mission_Termination_State ) ,
In_Out => Private _ State ) ,
Contract_Cases =>
Contract_Cases =>
( Power_State = OFF
( not Power_On
and then Power_Off
=>
=>
Power_State = OFF ,
Power_State = OFF ,
@ -265,11 +531,6 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
and then On_State = INIT
and then On_State = INIT
and then Init_State = PREPARATION ,
and then Init_State = PREPARATION ,
Power_State = ON
and then Power_Off
=>
Power_State = OFF ,
Power_State = ON
Power_State = ON
and then Power_On
and then Power_On
and then ( On_State in INIT | RUNNING )
and then ( On_State in INIT | RUNNING )
@ -277,8 +538,7 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
=>
=>
Power_State = ON
Power_State = ON
and then On_State = ABORTED
and then On_State = ABORTED
and then Aborted_For_Energy_Reasons = False
and then Aborted_For_Energy_Reasons = False ,
and then Mission_Aborted_Signaled ,
Power_State = ON
Power_State = ON
and then Power_On
and then Power_On
@ -296,15 +556,11 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
and then not Mission_Abort_Received
and then not Mission_Abort_Received
and then Init_Completed
and then Init_Completed
and then not Start_Or_Go_Received
and then not Start_Or_Go_Received
and then Initial_Energy_Compatible_With_Mission
=>
=>
Power_State = ON
Power_State = ON
and then On_State = INIT
and then On_State = INIT
and then
and then Init_State = READY ,
( if Initial_Energy_Compatible_With_Mission then
Init_State = READY
else
Init_State = CANCELLED
and then Mission_Cancelled_Signaled ) ,
Power_State = ON
Power_State = ON
and then Power_On
and then Power_On
@ -312,16 +568,22 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
and then not Mission_Abort_Received
and then not Mission_Abort_Received
and then Init_Completed
and then Init_Completed
and then Start_Or_Go_Received
and then Start_Or_Go_Received
and then Initial_Energy_Compatible_With_Mission
=>
Power_State = ON
and then On_State = RUNNING
and then Running_State = TAKE_OFF ,
Power_State = ON
and then Power_On
and then On_State = INIT
and then not Mission_Abort_Received
and then Init_Completed
and then not Initial_Energy_Compatible_With_Mission
=>
=>
( if Initial_Energy_Compatible_With_Mission then
Power_State = ON
Power_State = ON
and then On_State = INIT
and then On_State = RUNNING
and then Init_State = CANCELLED ,
and then Running_State = TAKE_OFF
else
Power_State = ON
and then On_State = INIT
and then Init_State = CANCELLED
and then Mission_Cancelled_Signaled ) ,
Power_State = ON
Power_State = ON
and then On_State = RUNNING
and then On_State = RUNNING
@ -350,25 +612,40 @@ package MMS.F_PT.F_MM.Behavior with SPARK_Mode is
and then Running_State = FLIGHT
and then Running_State = FLIGHT
and then Power_On
and then Power_On
and then not Mission_Abort_Received
and then not Mission_Abort_Received
and then Current_Flight_Phase = CRUISE
and then not In_Flight_Energy_Compatible_With_Mission
=>
=>
( if Current_Flight_Phase = CRUISE
Power_State = ON
and then not In_Flight_Energy_Compatible_With_Mission
and then On_State = ABORTED
then
and then Aborted_For_Energy_Reasons = True
Power_State = ON
and then Mission_Aborted_Signaled
and then On_State = ABORTED
and then Emergency_Landing ,
and then Aborted_For_Energy_Reasons = True
and then Mission_Aborted_Signaled
Power_State = ON
and then Emergency_Landing
and then On_State = RUNNING
elsif Current_Flight_Phase = DESCENT
and then Running_State = FLIGHT
and then Descent_Over
and then Power_On
then
and then not Mission_Abort_Received
Power_State = ON
and then Current_Flight_Phase = DESCENT
and then On_State = RUNNING
and then Descent_Over
and then Running_State = LANDING
=>
else
Power_State = ON
Power_State = ON
and then On_State = RUNNING
and then On_State = RUNNING
and then Running_State = LANDING ,
and then Running_State = FLIGHT ) ,
Power_State = ON
and then On_State = RUNNING
and then Running_State = FLIGHT
and then Power_On
and then not Mission_Abort_Received
and then
( if Current_Flight_Phase = CRUISE then
In_Flight_Energy_Compatible_With_Mission
elsif Current_Flight_Phase = DESCENT then not Descent_Over )
=>
Power_State = ON
and then On_State = RUNNING
and then Running_State = FLIGHT ,
Power_State = ON
Power_State = ON
and then On_State = RUNNING
and then On_State = RUNNING
@ -467,195 +744,50 @@ private
function Energy_Level return Energy_Level_Type is
function Energy_Level return Energy_Level_Type is
( State . Input_Energy_Level ) ;
( State . Input_Energy_Level ) ;
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Task s of F_MM - -
- - Definitions of Internal State - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Navigation_Parameters return Navigation_Parameters_Type is
( State . Navigation_Parameters )
with Pre => Mission_Parameters_Defined ;
procedure Management_Of_Navigation_Mode with
- - Compute the value of Navigation_Mode / Options / Parameters ( see 6.9 . 4 )
Post => Navigation_Mode =
- - In case of conflict on the navigation mode , CP prevails over GS .
( if Navigation_Mode_From_CP = A
or else not Navigation_Mode_From_GS_Received
then Navigation_Mode_From_CP
- - If CP states the mode to RC then GS can choose the navigation mode .
else Navigation_Mode_From_GS )
and then Operating_Mode =
( if Navigation_Mode = A
or else not Operating_Mode_From_GS_Received
then Operating_Mode_From_CP
else Operating_Mode_From_GS )
and then
( if Mission_Parameters_Defined then
Navigation_Parameters =
( if Navigation_Mode = A
or else not Navigation_Parameters_From_GS_Received
then Navigation_Parameters_From_USB_Key
else Navigation_Parameters_From_GS ) ) ;
procedure Operating_Point_Update_Management with
- - Compute the value of Operating_Point
Pre =>
function Power_State return Power_State_Type is
Mission_Parameters_Defined
( State . Power_State ) ;
and then Power_State = ON
and then On_State in INIT | RUNNING ,
- - F_MM ensures freeze of the operating point once landing is activated .
function On_State return On_State_Type is
( State . On_State ) ;
Post =>
function Running_State return Running_State_Type is
( if Power_State = ON
( State . Running_State ) ;
and then On_State = RUNNING
and then Running_State = LANDING
then Operating_Point = Operating_Point ' Old
else Operating_Point = Operating_Point_From_Navigation_Parameters ) ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Init_State return Init_State_Type is
- - Mission_Viability_Logic - -
( State . Init_State ) ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Mission_Profile return Mission_Profile_Type with
function Aborted_For_Energy_Reasons return Boolean is
- - Assemble the mission profile
( State . Aborted_For_Energy_Reasons ) ;
Pre => Power_State = ON ,
function Take_Off_Over return Boolean is ( True ) ;
Post => Mission_Profile ' Result =
- - ? ? ? When is take off over ?
( Mass => Payload_Mass ,
Distance => Current_Range ,
Altitude => Current_Altitude ,
Speed => Current_Speed ) ;
function Appropriate_Tabulating_Function return Viability_Domain_Mesh_Type
function Descent_Over return Boolean is
- - Select the tabulated function corresponding to the navigation mode
( State . Descent_Over ) ;
with
function Navigation_Parameters return Navigation_Parameters_Type is
Pre => Power_State = ON
( State . Navigation_Parameters ) ;
and then On_State in INIT | RUNNING ,
Post => Appropriate_Tabulating_Function ' Result =
( if On_State = INIT and then Navigation_Mode = A
then Data . Amode_Initial_Domain_Mesh
elsif On_State = INIT and then Navigation_Mode = RP
then Data . RPmode_Initial_Domain_Mesh
elsif Navigation_Mode = A
then Data . Amode_Cruise_Domain_Mesh
else Data . RPmode_Cruise_Domain_Mesh ) ;
function Distance_With_Neighbour
( Neighbour : Mission_Profile_Type ) return Mission_Profile_Distance_Type
with
Pre => Power_State = ON
and then On_State in INIT | RUNNING ;
- - Compute the distance between Mission_Profile and its Neighbour .
function Nearest_Neighbours return Neighbour_Mission_Profile_Array_Type with
- - Compute the nearest neighbous of Mission_Profile in
- - Appropriate_Tabulating_Function , and the distance of Mission_Profile to
- - its nearest neignbours .
Pre => Power_State = ON
and then On_State in INIT | RUNNING ,
Post =>
( for all Neighbour_Center of Nearest_Neighbours ' Result =>
Neighbour_Center . Mission_Profile . M in
MMS . F_PT . Data . Payload_Mass_Grid ' Range
and then Neighbour_Center . Mission_Profile . D in
Appropriate_Tabulating_Function ' Range ( 1 )
and then Neighbour_Center . Mission_Profile . A in
Appropriate_Tabulating_Function ' Range ( 2 )
and then Neighbour_Center . Mission_Profile . S in
Appropriate_Tabulating_Function ' Range ( 3 )
and then Neighbour_Center . Distance =
Distance_With_Neighbour
( Mission_Profile_Type '
( Mass =>
MMS . F_PT . Data . Payload_Mass_Grid
( Neighbour_Center . Mission_Profile . M ) ,
Distance =>
Appropriate_Tabulating_Function
( Neighbour_Center . Mission_Profile . D ,
Neighbour_Center . Mission_Profile . A ,
Neighbour_Center . Mission_Profile . S ) . Distance ,
Altitude =>
Appropriate_Tabulating_Function
( Neighbour_Center . Mission_Profile . D ,
Neighbour_Center . Mission_Profile . A ,
Neighbour_Center . Mission_Profile . S ) . Altitude ,
Speed =>
Appropriate_Tabulating_Function
( Neighbour_Center . Mission_Profile . D ,
Neighbour_Center . Mission_Profile . A ,
Neighbour_Center . Mission_Profile . S ) . Speed ) ) ) ;
function Extract_Energy_Level_For_Neighbour
( Neighbour : Center_Mission_Profile_Type ) return Energy_Level_Type
- - Extract energy level for the neighbour .
with
Pre => Power_State = ON
and then On_State in INIT | RUNNING ,
Post => Extract_Energy_Level_For_Neighbour ' Result =
( if On_State = INIT and then Navigation_Mode = A
then Data . Viability_Amode_Initial ( M => Neighbour . M ,
D => Neighbour . D ,
A => Neighbour . A ,
S => Neighbour . S )
elsif On_State = INIT and then Navigation_Mode = RP
then Data . Viability_RPmode_Initial ( M => Neighbour . M ,
D => Neighbour . D ,
A => Neighbour . A ,
S => Neighbour . S )
elsif Navigation_Mode = A
then Data . Viability_Amode_Cruise ( M => Neighbour . M ,
D => Neighbour . D ,
A => Neighbour . A ,
S => Neighbour . S )
else Data . Viability_RPmode_Cruise ( M => Neighbour . M ,
D => Neighbour . D ,
A => Neighbour . A ,
S => Neighbour . S ) ) ;
function Interpolated_Energy_Level return Energy_Level_Type ;
- - Compute the interpolation of the energy levels of the neighbours of
- - Mission_Profile by distance - based averaging .
procedure Initial_Mission_Viability_Logic with
- - Compute the value of Initial_Energy_Compatible_With_Mission . It should
- - be computed when Init_Completed is True .
Pre => Power_State = ON
and then On_State = INIT
and then Init_Completed ,
Post => Initial_Energy_Compatible_With_Mission =
- - In A mode , use a 30 % energy margin .
function Navigation_Mode return Navigation_Mode_Type is
( State . Navigation_Mode ) ;
( ( if Navigation_Mode = A then Interpolated_Energy_Level * 13 / 10
function Operating_Mode return Navigation_Option_Type is
( State . Operating_Mode ) ;
- - In RP mode , use a 10 % energy margin .
function Initial_Energy_Compatible_With_Mission return Boolean is
( State . Initial_Energy_Compatible_With_Mission ) ;
else Interpolated_Energy_Level * 11 / 10 ) > = Energy_Level ) ;
function In_Flight_Energy_Compatible_With_Mission return Boolean is
( State . In_Flight_Energy_Compatible_With_Mission ) ;
procedure In_Flight_Mission_Viability_Logic with
function Mission_Range return Current_Range_Type is
- - Compute the value of In_Flight_Energy_Compatible_With_Mission . It should
( State . Mission_Range ) ;
- - be repeated at a periodic rate of F_Viability .
- - Set In_Flight_Energy_Compatible_With_Mission to True if Energy_Level is
- - at least the Interpolated_Energy_Level plus an enery margin . When
- - EstimatedTotalMass increases , and even more so if it increases quickly ,
- - F_MM applies greater safety margins ( see # 17 ) .
Pre => Power_State = ON
function Operating_Point return Operating_Point_Type is
and then On_State = RUNNING
( State . Operating_Point ) ;
and then Running_State = FLIGHT
and then Current_Flight_Phase = CRUISE ;
end MMS.F_PT.F_MM.Behavior ;
end MMS.F_PT.F_MM.Behavior ;