Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / regression_tests / lustre_files / success / Simulink / src_many_files / model2_PP.LUSTREC.lus @ cd1faebc

History | View | Annotate | Download (6.73 KB)

1
-- This file has been generated by CoCoSim2.
2

    
3
-- Compiler: Lustre compiler 2 (ToLustre.m)
4
-- Time: 03-Dec-2018 22:50:20
5
node  bool_to_real(x : bool;)
6
returns(y : real;);
7
let
8
	y = if x then
9
		1.0
10
	    else 0.0;
11
tel
12

    
13
node  _max_real(x : real;
14
	y : real;)
15
returns(z : real;);
16
let
17
	z = if (x > y) then
18
		x
19
	    else y;
20
tel
21

    
22
node  _min_real(x : real;
23
	y : real;)
24
returns(z : real;);
25
let
26
	z = if (x < y) then
27
		x
28
	    else y;
29
tel
30

    
31
(*
32
Original block name: model2_PP/Model/AltitudeControl/Saturation
33
*)
34
node  Saturation_27885_003(In_1 : real;
35
	__time_step : real;
36
	__nb_step : int;)
37
returns(Out_1 : real;);
38
var lower_1 : real;
39
	lower_limit_1 : real;
40
	upper_1 : real;
41
	upper_limit_1 : real;
42
let
43
	lower_1 = _max_real(upper_1, lower_limit_1);
44
	lower_limit_1 = 0.000100000000000;
45
	upper_1 = _min_real(upper_limit_1, In_1);
46
	upper_limit_1 = 1000.000000000000000;
47
	Out_1 = lower_1;
48
tel
49

    
50
(*
51
Original block name: model2_PP/Model/AltitudeControl/VariableLimitSaturation
52
*)
53
node  VariableLimitSaturation_27926_004(up_lim_1 : real;
54
	SigIn_1 : real;
55
	Lo_lim_1 : real;
56
	__time_step : real;
57
	__nb_step : int;)
58
returns(Out1_1 : real;);
59
var Enforcelowlim_1 : real;
60
	Enforceuplim_1 : real;
61
let
62
	Enforcelowlim_1 = _max_real(Lo_lim_1, SigIn_1);
63
	Enforceuplim_1 = _min_real(Enforcelowlim_1, up_lim_1);
64
	Out1_1 = Enforceuplim_1;
65
tel
66

    
67
(*
68
Original block name: model2_PP/Model/AltitudeControl/VariableRateLimit/Discrete_minus_TimeIntegrator
69
*)
70
node  Discrete_minus_TimeIntegrator_27894_003(f_lpar_x_rpar__1 : real;
71
	reset_level_1 : bool;
72
	x0_1 : real;
73
	__time_step : real;
74
	__nb_step : int;)
75
returns(F_lpar_x_rpar__1 : real;);
76
var Add_1 : real;
77
	Constant_1 : real;
78
	DataTypeConversion_1 : real;
79
	DataTypeConversion1_1 : real;
80
	DataTypeConversion2_1 : real;
81
	Product_1 : real;
82
	Product1_1 : real;
83
	Product2_1 : real;
84
	Sample_1 : real;
85
	Sum1_1 : real;
86
	Sum2_1 : real;
87
	Sum3_1 : real;
88
	Sum4_1 : real;
89
	Sum5_1 : real;
90
	Sum6_1 : real;
91
	UnitDelay_1 : real;
92
	UnitDelay1_1 : real;
93
	UnitDelay2_1 : bool;
94
	eq0_1 : bool;
95
	ne0_1 : bool;
96
	ne1_1 : bool;
97
	zero_1 : real;
98
let
99
	Add_1 = 0.0 + Product1_1 + Product2_1;
100
	Constant_1 = 0.000000000000000;
101
	DataTypeConversion_1 = bool_to_real(ne0_1);
102
	DataTypeConversion1_1 = bool_to_real(eq0_1);
103
	DataTypeConversion2_1 = bool_to_real(ne1_1);
104
	Product_1 = 1.0 * x0_1 * UnitDelay1_1;
105
	Product1_1 = 1.0 * Sum3_1 * DataTypeConversion_1;
106
	Product2_1 = 1.0 * Sum3_1 * DataTypeConversion1_1 * DataTypeConversion2_1;
107
	Sample_1 = (f_lpar_x_rpar__1 * 0.200000000000000);
108
	Sum1_1 = 0.0 + Sample_1 + Sum2_1;
109
	Sum2_1 = 0.0 + Sum4_1 + Product_1;
110
	Sum3_1 = 0.0 - UnitDelay_1 + x0_1;
111
	Sum4_1 = 0.0 + UnitDelay_1 + Add_1;
112
	Sum5_1 = 0.0 + UnitDelay_1 + Product_1;
113
	Sum6_1 = 0.0 + Sum5_1 + Add_1;
114
	UnitDelay_1 = (0.000000000000000 -> (pre Sum1_1));
115
	UnitDelay1_1 = (1.000000000000000 -> (pre Constant_1));
116
	UnitDelay2_1 = (false -> (pre reset_level_1));
117
	eq0_1 = (bool_to_real(reset_level_1) = zero_1);
118
	ne0_1 = (bool_to_real(reset_level_1) <> zero_1);
119
	ne1_1 = (bool_to_real(UnitDelay2_1) <> zero_1);
120
	zero_1 = 0.000000000000000;
121
	F_lpar_x_rpar__1 = Sum6_1;
122
tel
123

    
124
(*
125
Original block name: model2_PP/Model/AltitudeControl/VariableRateLimit/VariableLimitSaturation
126
*)
127
node  VariableLimitSaturation_27899_003(up_lim_1 : real;
128
	SigIn_1 : real;
129
	Lo_lim_1 : real;
130
	__time_step : real;
131
	__nb_step : int;)
132
returns(Out1_1 : real;);
133
var Enforcelowlim_1 : real;
134
	Enforceuplim_1 : real;
135
let
136
	Enforcelowlim_1 = _max_real(Lo_lim_1, SigIn_1);
137
	Enforceuplim_1 = _min_real(Enforcelowlim_1, up_lim_1);
138
	Out1_1 = Enforceuplim_1;
139
tel
140

    
141
(*
142
Original block name: model2_PP/Model/AltitudeControl/VariableRateLimit
143
*)
144
node  VariableRateLimit_27889_003(ratelim_1 : real;
145
	input_1 : real;
146
	ICtrig_1 : bool;
147
	IC_1 : real;
148
	__time_step : real;
149
	__nb_step : int;)
150
returns(output_1 : real;);
151
var Discrete_minus_TimeIntegrator_1 : real;
152
	Gain_1 : real;
153
	Gain1_1 : real;
154
	Sum2_1 : real;
155
	UnitDelay_1 : real;
156
	VariableLimitSaturation_1 : real;
157
let
158
	Discrete_minus_TimeIntegrator_1 = Discrete_minus_TimeIntegrator_27894_003(VariableLimitSaturation_1, ICtrig_1, IC_1, __time_step, __nb_step);
159
	Gain_1 = (Sum2_1 * 20.000000000000000);
160
	Gain1_1 = (ratelim_1 * -1.000000000000000);
161
	Sum2_1 = 0.0 + input_1 - UnitDelay_1;
162
	UnitDelay_1 = (0.000000000000000 -> (pre Discrete_minus_TimeIntegrator_1));
163
	VariableLimitSaturation_1 = VariableLimitSaturation_27899_003(ratelim_1, Gain_1, Gain1_1, __time_step, __nb_step);
164
	output_1 = Discrete_minus_TimeIntegrator_1;
165
tel
166

    
167
(*
168
Original block name: model2_PP/Model/AltitudeControl
169
*)
170
node  AltitudeControl_27869_003(engage_1 : bool;
171
	AltCmd_1 : real;
172
	Altitude_1 : real;
173
	gskts_1 : real;
174
	hdot_1 : real;
175
	hdotChgRate_1 : real;
176
	maxHdotChg_1 : real;
177
	__time_step : real;
178
	__nb_step : int;)
179
returns(altgamcmd_1 : real;);
180
var Abs_1 : real;
181
	Constant1_1 : real;
182
	Divide_1 : real;
183
	Kh_1 : real;
184
	LogicalOperator_1 : bool;
185
	Mux_1 : real;
186
	Mux_2 : real;
187
	Mux1_1 : real;
188
	Mux1_2 : real;
189
	Saturation_1 : real;
190
	Sum_1 : real;
191
	Sum3_1 : real;
192
	Switch_1 : real;
193
	VariableLimitSaturation_1 : real;
194
	VariableRateLimit_1 : real;
195
	k_1 : real;
196
	kts2fps_1 : real;
197
	r2d_1 : real;
198
let
199
	Abs_1 = if (hdot_1 >= 0.0) then
200
		hdot_1
201
	    else (- hdot_1);
202
	Constant1_1 = 0.000000000000000;
203
	Divide_1 = 1.0 * VariableRateLimit_1 / Saturation_1;
204
	Kh_1 = (Sum_1 * 0.080000000000000);
205
	LogicalOperator_1 = (not engage_1);
206
	Mux_1 = AltCmd_1;
207
	Mux_2 = Altitude_1;
208
	Mux1_1 = VariableLimitSaturation_1;
209
	Mux1_2 = VariableRateLimit_1;
210
	Saturation_1 = Saturation_27885_003(kts2fps_1, __time_step, __nb_step);
211
	Sum_1 = 0.0 + AltCmd_1 - Altitude_1;
212
	Sum3_1 = 0.0 + Abs_1 + maxHdotChg_1;
213
	Switch_1 = if engage_1 then
214
		Kh_1
215
	    else Constant1_1;
216
	VariableLimitSaturation_1 = VariableLimitSaturation_27926_004(Sum3_1, Switch_1, k_1, __time_step, __nb_step);
217
	VariableRateLimit_1 = VariableRateLimit_27889_003(hdotChgRate_1, VariableLimitSaturation_1, LogicalOperator_1, hdot_1, __time_step, __nb_step);
218
	k_1 = (Sum3_1 * -1.000000000000000);
219
	kts2fps_1 = (gskts_1 * 1.687800000000000);
220
	r2d_1 = (Divide_1 * 57.295800000000000);
221
	altgamcmd_1 = r2d_1;
222
tel
223

    
224
(*
225
Original block name: model2_PP/Model
226
*)
227
node  Model_27861_004(In1_1 : bool;
228
	In2_1 : real;
229
	In3_1 : real;
230
	In4_1 : real;
231
	In5_1 : real;
232
	In6_1 : real;
233
	In7_1 : real;
234
	__time_step : real;
235
	__nb_step : int;)
236
returns(Out1_1 : real;);
237
var AltitudeControl_1 : real;
238
let
239
	AltitudeControl_1 = AltitudeControl_27869_003(In1_1, In2_1, In3_1, In4_1, In5_1, In6_1, In7_1, __time_step, __nb_step);
240
	Out1_1 = AltitudeControl_1;
241
tel
242

    
243
(*
244
Original block name: model2_PP
245
*)
246
node  model2_PP(In4_1 : bool;
247
	In1_1 : real;
248
	In2_1 : real;
249
	In3_1 : real;
250
	In5_1 : real;
251
	In6_1 : real;
252
	In7_1 : real;)
253
returns(Out1_1 : real;);
254
var Model_1 : real;
255
	__time_step : real;
256
	__nb_step : int;
257
let
258
	Model_1 = Model_27861_004(In4_1, In1_1, In2_1, In3_1, In5_1, In6_1, In7_1, __time_step, __nb_step);
259
	Out1_1 = Model_1;
260
	__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
261
	__nb_step = (0 -> ((pre __nb_step) + 1));
262
tel
263