## lustrec-tests/regression_tests/lustre_files/success/Simulink/src_many_files/FromWorkSpace_1_extrapolation_PP.LUSTREC.lus @ 4748b215

1 | 4748b215 | hbourbou | ```
-- This file has been generated by CoCoSim2.
``` |
---|---|---|---|

2 | |||

3 | ```
-- Compiler: Lustre compiler 2 (ToLustre.m)
``` |
||

4 | ```
-- Time: 03-Dec-2018 22:41:55
``` |
||

5 | node abs_real(x : real;) |
||

6 | returns(y : real;); |
||

7 | ```
let
``` |
||

8 | y = if (x >= 0.0) then |
||

9 | ```
x
``` |
||

10 | else (- x); |
||

11 | ```
tel
``` |
||

12 | |||

13 | ```
(*
``` |
||

14 | ```
external node code for doing Lookup_nD
``` |
||

15 | ```
*)
``` |
||

16 | node T_22975_002_ext_node(D_1 : real;) |
||

17 | returns(T_1 : real;); |
||

18 | var T_22975_002_table_elem_1 : real; |
||

19 | T_22975_002_table_elem_2 : real; |
||

20 | T_22975_002_Breakpoints_dim1_1 : real; |
||

21 | T_22975_002_Breakpoints_dim1_2 : real; |
||

22 | T_22975_002_dimJump_1 : int; |
||

23 | T_22975_002_index_dim_1_1 : int; |
||

24 | T_22975_002_index_dim_1_2 : int; |
||

25 | T_22975_002_coords_dim_1_1 : real; |
||

26 | T_22975_002_coords_dim_1_2 : real; |
||

27 | T_22975_002_u_node_1 : real; |
||

28 | T_22975_002_N_shape_1 : real; |
||

29 | T_22975_002_u_node_2 : real; |
||

30 | T_22975_002_N_shape_2 : real; |
||

31 | T_22975_002_bound_node_index_1 : int; |
||

32 | T_22975_002_bound_node_index_2 : int; |
||

33 | T_22975_002_clip_input_1 : real; |
||

34 | ```
let
``` |
||

35 | T_22975_002_table_elem_1 = 20.000000000000000; |
||

36 | T_22975_002_table_elem_2 = 40.000000000000000; |
||

37 | T_22975_002_Breakpoints_dim1_1 = 10.000000000000000; |
||

38 | T_22975_002_Breakpoints_dim1_2 = 30.000000000000000; |
||

39 | T_22975_002_dimJump_1 = 1; |
||

40 | T_22975_002_index_dim_1_1 = if ((D_1 >= T_22975_002_Breakpoints_dim1_2) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_2) <= 0.000000000000003552713678800501) then |
||

41 | ```
1
``` |
||

42 | else if ((D_1 >= T_22975_002_Breakpoints_dim1_1) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_1) <= 0.000000000000001776356839400250) then |
||

43 | ```
1
``` |
||

44 | else 1; |
||

45 | T_22975_002_coords_dim_1_1 = if ((D_1 >= T_22975_002_Breakpoints_dim1_2) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_2) <= 0.000000000000003552713678800501) then |
||

46 | ```
T_22975_002_Breakpoints_dim1_1
``` |
||

47 | else if ((D_1 >= T_22975_002_Breakpoints_dim1_1) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_1) <= 0.000000000000001776356839400250) then |
||

48 | ```
T_22975_002_Breakpoints_dim1_1
``` |
||

49 | else T_22975_002_Breakpoints_dim1_1; |
||

50 | T_22975_002_index_dim_1_2 = if ((D_1 >= T_22975_002_Breakpoints_dim1_2) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_2) <= 0.000000000000003552713678800501) then |
||

51 | ```
2
``` |
||

52 | else if ((D_1 >= T_22975_002_Breakpoints_dim1_1) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_1) <= 0.000000000000001776356839400250) then |
||

53 | ```
2
``` |
||

54 | else 2; |
||

55 | T_22975_002_coords_dim_1_2 = if ((D_1 >= T_22975_002_Breakpoints_dim1_2) or abs_real(D_1 - T_22975_002_Breakpoints_dim1_2) <= 0.000000000000003552713678800501) then |
||

56 | ```
T_22975_002_Breakpoints_dim1_2
``` |
||

57 | |||

58 | ```
T_22975_002_Breakpoints_dim1_2
``` |
||

59 | else T_22975_002_Breakpoints_dim1_2; |
||

60 | T_22975_002_bound_node_index_1 = (T_22975_002_index_dim_1_1 * 1); |
||

61 | T_22975_002_u_node_1 = if (T_22975_002_bound_node_index_1 = 1) then |
||

62 | ```
T_22975_002_table_elem_1
``` |
||

63 | else T_22975_002_table_elem_2; |
||

64 | T_22975_002_bound_node_index_2 = (T_22975_002_index_dim_1_2 * 1); |
||

65 | T_22975_002_u_node_2 = if (T_22975_002_bound_node_index_2 = 1) then |
||

66 | ```
T_22975_002_table_elem_1
``` |
||

67 | else T_22975_002_table_elem_2; |
||

68 | T_22975_002_clip_input_1 = D_1; |
||

69 | T_22975_002_N_shape_1 = ((T_22975_002_coords_dim_1_2 - T_22975_002_clip_input_1) / (T_22975_002_coords_dim_1_2 - T_22975_002_coords_dim_1_1)); |
||

70 | T_22975_002_N_shape_2 = ((T_22975_002_clip_input_1 - T_22975_002_coords_dim_1_1) / (T_22975_002_coords_dim_1_2 - T_22975_002_coords_dim_1_1)); |
||

71 | T_1 = ( (T_22975_002_N_shape_1 * T_22975_002_u_node_1) + (T_22975_002_N_shape_2 * T_22975_002_u_node_2) ); |
||

72 | ```
tel
``` |
||

73 | |||

74 | ```
(*
``` |
||

75 | ```
Original block name: FromWorkSpace_1_extrapolation_PP/FromWorkspace
``` |
||

76 | ```
*)
``` |
||

77 | node FromWorkspace_19_086(__time_step : real; |
||

78 | __nb_step : int;) |
||

79 | returns(Out1_1 : real;); |
||

80 | var D_1 : real; |
||

81 | T_1 : real; |
||

82 | ```
let
``` |
||

83 | D_1 = if ((__nb_step mod 1) = 0) then |
||

84 | ```
__time_step
``` |
||

85 | else if (__nb_step = 0) then |
||

86 | 0.0 |
||

87 | else (pre D_1); |
||

88 | T_1 = T_22975_002_ext_node(D_1); |
||

89 | Out1_1 = T_1; |
||

90 | ```
tel
``` |
||

91 | |||

92 | ```
(*
``` |
||

93 | ```
Original block name: FromWorkSpace_1_extrapolation_PP
``` |
||

94 | ```
*)
``` |
||

95 | node FromWorkSpace_1_extrapolation_PP(_virtual : bool;) |
||

96 | returns(Out1_1 : real;); |
||

97 | var FromWorkspace_1 : real; |
||

98 | __time_step : real; |
||

99 | __nb_step : int; |
||

100 | ```
let
``` |
||

101 | FromWorkspace_1 = FromWorkspace_19_086(__time_step, __nb_step); |
||

102 | Out1_1 = FromWorkspace_1; |
||

103 | __time_step = (0.0 -> ((pre __time_step) + 0.200000000000000)); |
||

104 | __nb_step = (0 -> ((pre __nb_step) + 1)); |
||

105 | ```
tel
``` |