Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (7.9 KB)

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

    
3
-- Compiler: Lustre compiler 2 (ToLustre.m)
4
-- Time: 03-Dec-2018 22:48:54
5
node  _max_real(x : real;
6
	y : real;)
7
returns(z : real;);
8
let
9
	z = if (x > y) then
10
		x
11
	    else y;
12
tel
13

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

    
23
node  abs_real(x : real;)
24
returns(y : real;);
25
let
26
	y = if (x >= 0.0) then
27
		x
28
	    else (- x);
29
tel
30

    
31
(*
32
Original block name: LookupTableND_test_1D_nearest_PP/Saturation1
33
*)
34
node  Saturation1_44_527(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 = -1.000000000000000;
45
	upper_1 = _min_real(upper_limit_1, In_1);
46
	upper_limit_1 = 4.000000000000000;
47
	Out_1 = lower_1;
48
tel
49

    
50
(*
51
external node code for doing Lookup_nD
52
*)
53
node  n_minus_DLookupTable_61_508_ext_node(Saturation1_1 : real;)
54
returns(n_minus_DLookupTable_1 : real;);
55
var n_minus_DLookupTable_61_508_table_elem_1 : real;
56
	n_minus_DLookupTable_61_508_table_elem_2 : real;
57
	n_minus_DLookupTable_61_508_table_elem_3 : real;
58
	n_minus_DLookupTable_61_508_table_elem_4 : real;
59
	n_minus_DLookupTable_61_508_Breakpoints_dim1_1 : real;
60
	n_minus_DLookupTable_61_508_Breakpoints_dim1_2 : real;
61
	n_minus_DLookupTable_61_508_Breakpoints_dim1_3 : real;
62
	n_minus_DLookupTable_61_508_Breakpoints_dim1_4 : real;
63
	n_minus_DLookupTable_61_508_dimJump_1 : int;
64
	n_minus_DLookupTable_61_508_index_dim_1_1 : int;
65
	n_minus_DLookupTable_61_508_index_dim_1_2 : int;
66
	n_minus_DLookupTable_61_508_coords_dim_1_1 : real;
67
	n_minus_DLookupTable_61_508_coords_dim_1_2 : real;
68
	n_minus_DLookupTable_61_508_retTableInd_1 : int;
69
	n_minus_DLookupTable_61_508_disFromTableNode_dim_1_1 : real;
70
	n_minus_DLookupTable_61_508_disFromTableNode_dim_1_2 : real;
71
	n_minus_DLookupTable_61_508_nearestIndex_dim_1 : int;
72
let
73
	n_minus_DLookupTable_61_508_table_elem_1 = 10.000000000000000;
74
	n_minus_DLookupTable_61_508_table_elem_2 = 110.000000000000000;
75
	n_minus_DLookupTable_61_508_table_elem_3 = 120.000000000000000;
76
	n_minus_DLookupTable_61_508_table_elem_4 = 230.000000000000000;
77
	n_minus_DLookupTable_61_508_Breakpoints_dim1_1 = 0.000000000000000;
78
	n_minus_DLookupTable_61_508_Breakpoints_dim1_2 = 1.500000000000000;
79
	n_minus_DLookupTable_61_508_Breakpoints_dim1_3 = 2.200000000000000;
80
	n_minus_DLookupTable_61_508_Breakpoints_dim1_4 = 3.100000000000000;
81
	n_minus_DLookupTable_61_508_dimJump_1 = 1;
82
	n_minus_DLookupTable_61_508_index_dim_1_1 = if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_4) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_4) <= 0.000000000000000444089209850063) then
83
		4
84
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_3) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_3) <= 0.000000000000000444089209850063) then
85
		3
86
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_2) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_2) <= 0.000000000000000222044604925031) then
87
		2
88
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_1) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_1) <= 0.000000000000000000000000000000) then
89
		1
90
	    else 1;
91
	n_minus_DLookupTable_61_508_coords_dim_1_1 = if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_4) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_4) <= 0.000000000000000444089209850063) then
92
		n_minus_DLookupTable_61_508_Breakpoints_dim1_3
93
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_3) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_3) <= 0.000000000000000444089209850063) then
94
		n_minus_DLookupTable_61_508_Breakpoints_dim1_3
95
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_2) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_2) <= 0.000000000000000222044604925031) then
96
		n_minus_DLookupTable_61_508_Breakpoints_dim1_2
97
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_1) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_1) <= 0.000000000000000000000000000000) then
98
		n_minus_DLookupTable_61_508_Breakpoints_dim1_1
99
	    else n_minus_DLookupTable_61_508_Breakpoints_dim1_1;
100
	n_minus_DLookupTable_61_508_index_dim_1_2 = if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_4) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_4) <= 0.000000000000000444089209850063) then
101
		4
102
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_3) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_3) <= 0.000000000000000444089209850063) then
103
		4
104
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_2) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_2) <= 0.000000000000000222044604925031) then
105
		3
106
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_1) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_1) <= 0.000000000000000000000000000000) then
107
		2
108
	    else 2;
109
	n_minus_DLookupTable_61_508_coords_dim_1_2 = if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_4) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_4) <= 0.000000000000000444089209850063) then
110
		n_minus_DLookupTable_61_508_Breakpoints_dim1_4
111
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_3) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_3) <= 0.000000000000000444089209850063) then
112
		n_minus_DLookupTable_61_508_Breakpoints_dim1_4
113
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_2) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_2) <= 0.000000000000000222044604925031) then
114
		n_minus_DLookupTable_61_508_Breakpoints_dim1_3
115
	    else if ((Saturation1_1 >= n_minus_DLookupTable_61_508_Breakpoints_dim1_1) or abs_real(Saturation1_1 - n_minus_DLookupTable_61_508_Breakpoints_dim1_1) <= 0.000000000000000000000000000000) then
116
		n_minus_DLookupTable_61_508_Breakpoints_dim1_2
117
	    else n_minus_DLookupTable_61_508_Breakpoints_dim1_2;
118
	n_minus_DLookupTable_61_508_disFromTableNode_dim_1_1 = (Saturation1_1 - n_minus_DLookupTable_61_508_coords_dim_1_1);
119
	n_minus_DLookupTable_61_508_disFromTableNode_dim_1_2 = (n_minus_DLookupTable_61_508_coords_dim_1_2 - Saturation1_1);
120
	n_minus_DLookupTable_61_508_nearestIndex_dim_1 = if ((n_minus_DLookupTable_61_508_disFromTableNode_dim_1_2 <= n_minus_DLookupTable_61_508_disFromTableNode_dim_1_1) or abs_real(n_minus_DLookupTable_61_508_disFromTableNode_dim_1_2 - n_minus_DLookupTable_61_508_disFromTableNode_dim_1_1) <= 0.000000000000000222044604925031) then
121
		n_minus_DLookupTable_61_508_index_dim_1_2
122
	    else n_minus_DLookupTable_61_508_index_dim_1_1;
123
	n_minus_DLookupTable_61_508_retTableInd_1 = (n_minus_DLookupTable_61_508_nearestIndex_dim_1 * 1);
124
	n_minus_DLookupTable_1 = if (n_minus_DLookupTable_61_508_retTableInd_1 = 1) then
125
		n_minus_DLookupTable_61_508_table_elem_1
126
	    else if (n_minus_DLookupTable_61_508_retTableInd_1 = 2) then
127
		n_minus_DLookupTable_61_508_table_elem_2
128
	    else if (n_minus_DLookupTable_61_508_retTableInd_1 = 3) then
129
		n_minus_DLookupTable_61_508_table_elem_3
130
	    else n_minus_DLookupTable_61_508_table_elem_4;
131
tel
132

    
133
(*
134
Original block name: LookupTableND_test_1D_nearest_PP
135
*)
136
node  LookupTableND_test_1D_nearest_PP(In1_1 : real;)
137
returns(Out1_1 : real;);
138
var Saturation1_1 : real;
139
	n_minus_DLookupTable_1 : real;
140
	__time_step : real;
141
	__nb_step : int;
142
let
143
	Saturation1_1 = Saturation1_44_527(In1_1, __time_step, __nb_step);
144
	n_minus_DLookupTable_1 = n_minus_DLookupTable_61_508_ext_node(Saturation1_1);
145
	Out1_1 = n_minus_DLookupTable_1;
146
	__time_step = (0.0 -> ((pre __time_step) + 0.200000000000000));
147
	__nb_step = (0 -> ((pre __nb_step) + 1));
148
tel
149