Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / regression_tests / lustre_files / success / Simulink / src_many_files / SwitchCase_PP.LUSTREC.lus @ b58cc410

History | View | Annotate | Download (5.61 KB)

1 4748b215 hbourbou
-- This file has been generated by CoCoSim2.
2
3 b58cc410 hbourbou
-- Compiler: Lustre compiler 2 (nasa_toLustre.ToLustre.m)
4
-- Time: 20-Mar-2019 11:52:36
5 4748b215 hbourbou
node  abs_int(x : int;)
6
returns(y : int;);
7
let
8
	y = if (x >= 0) then
9
		x
10
	    else (- x);
11
tel
12
13
node  mod_int_int(x : int;
14
	y : int;)
15
returns(z : int;);
16
let
17
	z = if ((y = 0) or (x = 0)) then
18
		x
19
	    else ((x mod y) - (if (((x mod y) <> 0) and (y <= 0)) then abs_int(y) else 0));
20
tel
21
22
(*
23
Original block name: SwitchCase_PP/IfActionSubsystem
24
*)
25 b58cc410 hbourbou
node  IfActionSubsystem_14_054_condExecSS(In3_1 : bool;
26 4748b215 hbourbou
	_isEnabled : bool;
27
	__time_step : real;
28
	__nb_step : int;)
29
returns(Out4_1 : bool;);
30
var pre_Out4_1 : bool;
31 b58cc410 hbourbou
	_isEnabled_clock : bool clock;
32 4748b215 hbourbou
let
33
	pre_Out4_1 = if (__nb_step > 0) then
34
		(pre Out4_1)
35
	    else false;
36 b58cc410 hbourbou
	_isEnabled_clock = _isEnabled;
37
	Out4_1 = (merge _isEnabled_clock 
38
		(true -> IfActionSubsystem_14_054((In3_1 when _isEnabled_clock), (__time_step when _isEnabled_clock), (__nb_step when _isEnabled_clock))) 
39
		(false -> (pre_Out4_1) when false(_isEnabled_clock)));
40 4748b215 hbourbou
tel
41
42
(*
43
Original block name: SwitchCase_PP/IfActionSubsystem
44
*)
45 b58cc410 hbourbou
node  IfActionSubsystem_14_054(In3_1 : bool;
46 4748b215 hbourbou
	__time_step : real;
47
	__nb_step : int;)
48
returns(Out4_1 : bool;);
49
let
50
	Out4_1 = In3_1;
51
tel
52
53
(*
54
Original block name: SwitchCase_PP/IfActionSubsystem1
55
*)
56 b58cc410 hbourbou
node  IfActionSubsystem1_19_527_condExecSS(In1_1 : real;
57 4748b215 hbourbou
	_isEnabled : bool;
58
	__time_step : real;
59
	__nb_step : int;)
60
returns(Out1_1 : real;);
61
var pre_Out1_1 : real;
62 b58cc410 hbourbou
	_isEnabled_clock : bool clock;
63 4748b215 hbourbou
let
64
	pre_Out1_1 = if (__nb_step > 0) then
65
		(pre Out1_1)
66 b58cc410 hbourbou
	    else 0.0;
67
	_isEnabled_clock = _isEnabled;
68
	Out1_1 = (merge _isEnabled_clock 
69
		(true -> IfActionSubsystem1_19_527((In1_1 when _isEnabled_clock), (__time_step when _isEnabled_clock), (__nb_step when _isEnabled_clock))) 
70
		(false -> (pre_Out1_1) when false(_isEnabled_clock)));
71 4748b215 hbourbou
tel
72
73
(*
74
Original block name: SwitchCase_PP/IfActionSubsystem1
75
*)
76 b58cc410 hbourbou
node  IfActionSubsystem1_19_527(In1_1 : real;
77 4748b215 hbourbou
	__time_step : real;
78
	__nb_step : int;)
79
returns(Out1_1 : real;);
80
let
81
	Out1_1 = In1_1;
82
tel
83
84
(*
85
Original block name: SwitchCase_PP/IfActionSubsystem2
86
*)
87 b58cc410 hbourbou
node  IfActionSubsystem2_24_284_condExecSS(In1_1 : bool;
88 4748b215 hbourbou
	_isEnabled : bool;
89
	__time_step : real;
90
	__nb_step : int;)
91
returns(Out1_1 : bool;);
92
var pre_Out1_1 : bool;
93 b58cc410 hbourbou
	_isEnabled_clock : bool clock;
94 4748b215 hbourbou
let
95
	pre_Out1_1 = if (__nb_step > 0) then
96
		(pre Out1_1)
97
	    else false;
98 b58cc410 hbourbou
	_isEnabled_clock = _isEnabled;
99
	Out1_1 = (merge _isEnabled_clock 
100
		(true -> IfActionSubsystem2_24_284((In1_1 when _isEnabled_clock), (__time_step when _isEnabled_clock), (__nb_step when _isEnabled_clock))) 
101
		(false -> (pre_Out1_1) when false(_isEnabled_clock)));
102 4748b215 hbourbou
tel
103
104
(*
105
Original block name: SwitchCase_PP/IfActionSubsystem2
106
*)
107 b58cc410 hbourbou
node  IfActionSubsystem2_24_284(In1_1 : bool;
108 4748b215 hbourbou
	__time_step : real;
109
	__nb_step : int;)
110
returns(Out1_1 : bool;);
111
let
112
	Out1_1 = In1_1;
113
tel
114
115
(*
116
Original block name: SwitchCase_PP/IfActionSubsystem3
117
*)
118 b58cc410 hbourbou
node  IfActionSubsystem3_29_278_condExecSS(In1_1 : real;
119 4748b215 hbourbou
	_isEnabled : bool;
120
	__time_step : real;
121
	__nb_step : int;)
122
returns(Out1_1 : real;);
123
var pre_Out1_1 : real;
124 b58cc410 hbourbou
	_isEnabled_clock : bool clock;
125 4748b215 hbourbou
let
126
	pre_Out1_1 = if (__nb_step > 0) then
127
		(pre Out1_1)
128 b58cc410 hbourbou
	    else 0.0;
129
	_isEnabled_clock = _isEnabled;
130
	Out1_1 = (merge _isEnabled_clock 
131
		(true -> IfActionSubsystem3_29_278((In1_1 when _isEnabled_clock), (__time_step when _isEnabled_clock), (__nb_step when _isEnabled_clock))) 
132
		(false -> (pre_Out1_1) when false(_isEnabled_clock)));
133 4748b215 hbourbou
tel
134
135
(*
136
Original block name: SwitchCase_PP/IfActionSubsystem3
137
*)
138 b58cc410 hbourbou
node  IfActionSubsystem3_29_278(In1_1 : real;
139 4748b215 hbourbou
	__time_step : real;
140
	__nb_step : int;)
141
returns(Out1_1 : real;);
142
let
143
	Out1_1 = In1_1;
144
tel
145
146
(*
147
Original block name: SwitchCase_PP
148
*)
149
node  SwitchCase_PP(In1_1 : int;
150
	In7_1 : bool;
151
	In2_1 : real;)
152
returns(Out2_1 : real;
153
	Out15_1 : bool;
154
	Out3_1 : bool;
155
	Out4_1 : real;);
156
var Constant_1 : int;
157 b58cc410 hbourbou
	ExecutionCond_of_IfActionSubsystem_14_054 : bool;
158 4748b215 hbourbou
	IfActionSubsystem_1 : bool;
159 b58cc410 hbourbou
	ExecutionCond_of_IfActionSubsystem1_19_527 : bool;
160 4748b215 hbourbou
	IfActionSubsystem1_1 : real;
161 b58cc410 hbourbou
	ExecutionCond_of_IfActionSubsystem2_24_284 : bool;
162 4748b215 hbourbou
	IfActionSubsystem2_1 : bool;
163 b58cc410 hbourbou
	ExecutionCond_of_IfActionSubsystem3_29_278 : bool;
164 4748b215 hbourbou
	IfActionSubsystem3_1 : real;
165
	MathFunction_1 : int;
166
	SwitchCase_1 : bool;
167
	SwitchCase_2 : bool;
168
	SwitchCase_3 : bool;
169
	SwitchCase_4 : bool;
170
	__time_step : real;
171
	__nb_step : int;
172
let
173
	Constant_1 = 6;
174 b58cc410 hbourbou
	ExecutionCond_of_IfActionSubsystem_14_054 = SwitchCase_1;
175
	IfActionSubsystem_1 = IfActionSubsystem_14_054_condExecSS(In7_1, ExecutionCond_of_IfActionSubsystem_14_054, __time_step, __nb_step);
176
	ExecutionCond_of_IfActionSubsystem1_19_527 = SwitchCase_4;
177
	IfActionSubsystem1_1 = IfActionSubsystem1_19_527_condExecSS(In2_1, ExecutionCond_of_IfActionSubsystem1_19_527, __time_step, __nb_step);
178
	ExecutionCond_of_IfActionSubsystem2_24_284 = SwitchCase_2;
179
	IfActionSubsystem2_1 = IfActionSubsystem2_24_284_condExecSS(In7_1, ExecutionCond_of_IfActionSubsystem2_24_284, __time_step, __nb_step);
180
	ExecutionCond_of_IfActionSubsystem3_29_278 = SwitchCase_3;
181
	IfActionSubsystem3_1 = IfActionSubsystem3_29_278_condExecSS(In2_1, ExecutionCond_of_IfActionSubsystem3_29_278, __time_step, __nb_step);
182 4748b215 hbourbou
	MathFunction_1 = mod_int_int(In1_1, Constant_1);
183
	(SwitchCase_1, SwitchCase_2, SwitchCase_3, SwitchCase_4) = if MathFunction_1 = 1 then
184
		(true, false, false, false)
185
	    else if MathFunction_1 = 2 then
186
		(false, true, false, false)
187
	    else if MathFunction_1 = 3 or MathFunction_1 = 6 then
188
		(false, false, true, false)
189
	    else if MathFunction_1 = 4 then
190
		(false, false, false, true)
191
	    else (false, false, false, false);
192
	Out2_1 = IfActionSubsystem1_1;
193
	Out15_1 = IfActionSubsystem_1;
194
	Out3_1 = IfActionSubsystem2_1;
195
	Out4_1 = IfActionSubsystem3_1;
196 b58cc410 hbourbou
	__time_step = (0.0 -> ((pre __time_step) + 0.020));
197 4748b215 hbourbou
	__nb_step = (0 -> ((pre __nb_step) + 1));
198
tel