Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / tests / cocospec / regulator_12B_Spec.lus @ ffe46d5f

History | View | Annotate | Download (4.44 KB)

1
--Historically
2
node H(X:bool) returns (Y:bool);
3
let
4
    Y = X -> (X and (pre Y));
5
tel
6

    
7
--Y since inclusive X
8
node SI(X,Y: bool) returns (Z:bool);
9
let
10
Z = Y and (X or (false -> pre Z));
11
tel
12

    
13
--Y since X
14
node S(X,Y: bool) returns (Z:bool);
15
let
16
Z = X or (Y and (false -> pre Z));
17
tel
18

    
19
--Once
20
node O(X:bool) returns (Y:bool);
21
let
22
 Y = X or (false -> pre Y);
23
tel
24

    
25
node First( X : bool ) returns ( Y : bool );
26
let
27
  Y = X -> pre Y;
28
tel
29

    
30
--Timed Once: less than or equal to N
31
node OTlore(const N: int; X: bool; ) returns (Y: bool);
32
    var C:int;
33
let
34
    C = if X then 0
35
        else (-1 -> pre C + (if pre C <0 then 0 else 1));
36

    
37
    Y = First(X)
38
        ->
39
        (if C < 0  then false
40
         else C <= N
41
        );
42
tel
43

    
44
-- Timed Historically: less than or equal to N
45
node HTlore(const N: int; X: bool) returns (Y: bool);
46
let
47
  Y = not OTlore(N, not X);
48
tel
49

    
50
-- Timed Since: less than or equal to N
51
node STlore(const N: int; X: bool; Y: bool; )  returns (Z: bool);
52
let
53
  Z = S(X, Y) and OTlore(N, X);
54
tel
55

    
56
-- Timed Since Inclusive: less than or equal to N
57
node SITlore(const N: int; X: bool; Y: bool; )  returns (Z: bool);
58
let
59
  Z = SI(X,Y) and OTlore(N, X);
60
tel
61

    
62

    
63

    
64
(*@ contract RegulatorSpec(pom:bool)
65
returns (lcvdt_cmd_fcs_dps2 : real;
66
	mcvdt_cmd_fcs_dps2 : real;
67
	ncvdt_cmd_fcs_dps2 : real;
68
	xcvdt_cmd_fcs_fps2: real;
69
	hcvdt_cmd_fcs_fps2: real;);
70

    
71
-- Block path: regs_12B_PP (why do we have _PP?)
72

    
73
let
74

    
75
var FTP:bool = true -> false;
76

    
77
var airspeed_command_acceleration: real = (xcvdt_cmd_fcs_fps2 - (0.0 -> pre xcvdt_cmd_fcs_fps2)) /0.01;
78
var count_airspeed_output_exceeding_32: int = 0 -> if (xcvdt_cmd_fcs_fps2 > 32.0) then pre count_airspeed_output_exceeding_32 + 1 else 0;
79
var count_height_output_exceeding_32: int = 0 -> if (hcvdt_cmd_fcs_fps2 > 32.0) then pre count_height_output_exceeding_32 + 1 else 0;
80
var count_pitch_output_exceeding_50: int = 0 -> if (mcvdt_cmd_fcs_dps2 > 50.0) then pre count_pitch_output_exceeding_50 + 1 else 0;
81
var count_roll_output_exceeding_50: int = 0 -> if (lcvdt_cmd_fcs_dps2 > 50.0) then pre count_roll_output_exceeding_50 + 1 else 0;
82
var count_yaw_output_exceeding_50: int = 0 -> if (ncvdt_cmd_fcs_dps2 > 50.0) then pre count_yaw_output_exceeding_50 + 1 else 0;
83
var height_command_acceleration: real = 0.0 ->  (hcvdt_cmd_fcs_fps2 - pre hcvdt_cmd_fcs_fps2) /0.01;
84
var pitch_command_acceleration: real = 0.0 ->  (mcvdt_cmd_fcs_dps2 - pre mcvdt_cmd_fcs_dps2) /0.01;
85
var roll_command_acceleration: real = 0.0 ->  (lcvdt_cmd_fcs_dps2 - pre lcvdt_cmd_fcs_dps2) /0.01;
86
var yaw_command_acceleration: real = 0.0 ->  (ncvdt_cmd_fcs_dps2 - pre ncvdt_cmd_fcs_dps2) /0.01;
87

    
88
-- Regulator shall always satisfy count_airspeed_output_exceeding_32 <= 100
89
    guarantee "REG004" S( ((count_airspeed_output_exceeding_32 <= 100) and FTP), (count_airspeed_output_exceeding_32 <= 100) );
90

    
91
-- Regulator shall always satisfy count_roll_output_exceeding_50 <= 100
92
    guarantee "REG001" S( ((count_roll_output_exceeding_50 <= 100) and FTP), (count_roll_output_exceeding_50 <= 100) );
93
    guarantee count_roll_output_exceeding_50 <= 100;
94

    
95
-- Regulator shall always satisfy roll_command_acceleration <= 50.0
96
	guarantee "REG006" S( ((roll_command_acceleration <= 50.0) and FTP), (roll_command_acceleration <= 50.0) );
97

    
98
-- Regulator shall always satisfy count_height_output_exceeding_32 <= 100
99
	guarantee "REG005" S( ((count_height_output_exceeding_32 <= 100) and FTP), (count_height_output_exceeding_32 <= 100) );
100

    
101
-- Regulator shall always satisfy pitch_command_acceleration <= 50.0
102
	guarantee "REG007" S( ((pitch_command_acceleration <= 50.0) and FTP), (pitch_command_acceleration <= 50.0) );
103

    
104
-- Regulator shall always satisfy yaw_command_acceleration <= 50.0
105
	guarantee "REG008" S( ((yaw_command_acceleration <= 50.0) and FTP), (yaw_command_acceleration <= 50.0) );
106

    
107
-- Regulator shall always satisfy airspeed_command_acceleration <=32.0
108
	guarantee "REG009" S( ((airspeed_command_acceleration <= 32.0) and FTP), (airspeed_command_acceleration <= 32.0) );
109

    
110
-- Regulator shall always satisfy height_command_acceleration <= 32.0
111
	guarantee "REG010" S( ((height_command_acceleration <= 32.0) and FTP), (height_command_acceleration <= 32.0) );
112

    
113
-- Regulator shall always satisfy count_pitch_output_exceeding_50 <= 100
114
	guarantee "REG002" S( ((count_pitch_output_exceeding_50 <= 100) and FTP), (count_pitch_output_exceeding_50 <= 100) );
115

    
116
    -- Regulator shall always satisfy count_yaw_output_exceeding_50 <= 100
117
	guarantee "REG003" S( ((count_yaw_output_exceeding_50 <= 100) and FTP), (count_yaw_output_exceeding_50 <= 100) );
118

    
119
tel
120
*)