1

 This file has been generated by CoCoSim2.

2


3

 Compiler: Lustre compiler 2 (ToLustre.m)

4

 Time: 03Dec2018 22:02:14

5

#open <conv>

6

node abs_int(x : int;)

7

returns(y : int;);

8

let

9

y = if (x >= 0) then

10

x

11

else ( x);

12

tel

13


14

node rem_int_int(x : int;

15

y : int;)

16

returns(z : int;);

17

let

18

z = if ((y = 0) or (x = 0)) then

19

0

20

else ((x mod y)  (if (((x mod y) <> 0) and (x <= 0)) then abs_int(y) else 0));

21

tel

22


23

node int_to_bool(x : int;)

24

returns(y : bool;);

25

let

26

y = (x <> 0);

27

tel

28


29

node int_to_int16(x : int;)

30

returns(y : int;);

31

let

32

y = if (x > 32767) then

33

(32768 + rem_int_int(( x  32767  1 ), 65536))

34

else if (x < 32768) then

35

(32767 + rem_int_int(( x + 32768 + 1 ), 65536))

36

else x;

37

tel

38


39

node int_to_int8(x : int;)

40

returns(y : int;);

41

let

42

y = if (x > 127) then

43

(128 + rem_int_int(( x  127  1 ), 256))

44

else if (x < 128) then

45

(127 + rem_int_int(( x + 128 + 1 ), 256))

46

else x;

47

tel

48


49

node int_to_uint16(x : int;)

50

returns(y : int;);

51

let

52

y = if (x > 65535) then

53

(0 + rem_int_int(( x  65535  1 ), 65536))

54

else if (x < 0) then

55

(65535 + rem_int_int(( x + 0 + 1 ), 65536))

56

else x;

57

tel

58


59

node int_to_uint8(x : int;)

60

returns(y : int;);

61

let

62

y = if (x > 255) then

63

(0 + rem_int_int(( x  255  1 ), 256))

64

else if (x < 0) then

65

(255 + rem_int_int(( x + 0 + 1 ), 256))

66

else x;

67

tel

68


69

node real_to_bool(x : real;)

70

returns(y : bool;);

71

let

72

y = (x <> 0.0);

73

tel

74


75

(*

76

Original block name: datatypeconversion_test_PP

77

*)

78

node datatypeconversion_test_PP(In1_1 : real;

79

In2_1 : real;

80

In3_1 : real;

81

In4_1 : real;

82

In5_1 : real;

83

In6_1 : real;

84

In9_1 : real;

85

In11_1 : real;

86

In12_1 : real;

87

In13_1 : real;

88

In14_1 : real;

89

In15_1 : real;

90

In16_1 : real;

91

In17_1 : real;

92

In18_1 : real;

93

In21_1 : real;

94

In23_1 : real;

95

In24_1 : real;

96

In25_1 : int;

97

In26_1 : int;

98

In27_1 : int;

99

In28_1 : int;

100

In29_1 : int;

101

In30_1 : int;

102

In33_1 : int;

103

In35_1 : int;

104

In36_1 : int;)

105

returns(Out1_1 : real;

106

Out2_1 : real;

107

Out3_1 : int;

108

Out4_1 : int;

109

Out5_1 : int;

110

Out6_1 : int;

111

Out9_1 : bool;

112

Out11_1 : int;

113

Out12_1 : int;

114

Out13_1 : real;

115

Out14_1 : real;

116

Out15_1 : int;

117

Out16_1 : int;

118

Out17_1 : int;

119

Out18_1 : int;

120

Out21_1 : bool;

121

Out23_1 : int;

122

Out24_1 : int;

123

Out25_1 : real;

124

Out26_1 : real;

125

Out27_1 : int;

126

Out28_1 : int;

127

Out29_1 : int;

128

Out30_1 : int;

129

Out33_1 : bool;

130

Out35_1 : int;

131

Out36_1 : int;);

132

var DataTypeConversion_1 : real;

133

DataTypeConversion1_1 : real;

134

DataTypeConversion10_1 : int;

135

DataTypeConversion11_1 : int;

136

DataTypeConversion12_1 : real;

137

DataTypeConversion13_1 : real;

138

DataTypeConversion14_1 : int;

139

DataTypeConversion15_1 : int;

140

DataTypeConversion16_1 : int;

141

DataTypeConversion17_1 : int;

142

DataTypeConversion18_1 : int;

143

DataTypeConversion19_1 : int;

144

DataTypeConversion2_1 : int;

145

DataTypeConversion22_1 : bool;

146

DataTypeConversion24_1 : real;

147

DataTypeConversion25_1 : real;

148

DataTypeConversion26_1 : int;

149

DataTypeConversion27_1 : int;

150

DataTypeConversion28_1 : int;

151

DataTypeConversion29_1 : int;

152

DataTypeConversion3_1 : int;

153

DataTypeConversion30_1 : int;

154

DataTypeConversion31_1 : int;

155

DataTypeConversion34_1 : bool;

156

DataTypeConversion4_1 : int;

157

DataTypeConversion5_1 : int;

158

DataTypeConversion8_1 : bool;

159

__time_step : real;

160

__nb_step : int;

161

let

162

DataTypeConversion_1 = In1_1;

163

DataTypeConversion1_1 = In2_1;

164

DataTypeConversion10_1 = int_to_int16(_Floor(In11_1));

165

DataTypeConversion11_1 = int_to_int16(_Floor(In12_1));

166

DataTypeConversion12_1 = In13_1;

167

DataTypeConversion13_1 = In14_1;

168

DataTypeConversion14_1 = int_to_int16(_Floor(In23_1));

169

DataTypeConversion15_1 = int_to_int16(_Floor(In24_1));

170

DataTypeConversion16_1 = int_to_int8(_Floor(In15_1));

171

DataTypeConversion17_1 = int_to_uint8(_Floor(In16_1));

172

DataTypeConversion18_1 = int_to_int16(_Floor(In17_1));

173

DataTypeConversion19_1 = int_to_uint16(_Floor(In18_1));

174

DataTypeConversion2_1 = int_to_int8(_Floor(In3_1));

175

DataTypeConversion22_1 = real_to_bool(In21_1);

176

DataTypeConversion24_1 = int_to_real(In25_1);

177

DataTypeConversion25_1 = int_to_real(In26_1);

178

DataTypeConversion26_1 = int_to_int16(In35_1);

179

DataTypeConversion27_1 = int_to_int16(In36_1);

180

DataTypeConversion28_1 = In27_1;

181

DataTypeConversion29_1 = int_to_uint8(In28_1);

182

DataTypeConversion3_1 = int_to_uint8(_Floor(In4_1));

183

DataTypeConversion30_1 = int_to_int16(In29_1);

184

DataTypeConversion31_1 = int_to_uint16(In30_1);

185

DataTypeConversion34_1 = int_to_bool(In33_1);

186

DataTypeConversion4_1 = int_to_int16(_Floor(In5_1));

187

DataTypeConversion5_1 = int_to_uint16(_Floor(In6_1));

188

DataTypeConversion8_1 = real_to_bool(In9_1);

189

Out1_1 = DataTypeConversion_1;

190

Out2_1 = DataTypeConversion1_1;

191

Out3_1 = DataTypeConversion2_1;

192

Out4_1 = DataTypeConversion3_1;

193

Out5_1 = DataTypeConversion4_1;

194

Out6_1 = DataTypeConversion5_1;

195

Out9_1 = DataTypeConversion8_1;

196

Out11_1 = DataTypeConversion10_1;

197

Out12_1 = DataTypeConversion11_1;

198

Out13_1 = DataTypeConversion12_1;

199

Out14_1 = DataTypeConversion13_1;

200

Out15_1 = DataTypeConversion16_1;

201

Out16_1 = DataTypeConversion17_1;

202

Out17_1 = DataTypeConversion18_1;

203

Out18_1 = DataTypeConversion19_1;

204

Out21_1 = DataTypeConversion22_1;

205

Out23_1 = DataTypeConversion14_1;

206

Out24_1 = DataTypeConversion15_1;

207

Out25_1 = DataTypeConversion24_1;

208

Out26_1 = DataTypeConversion25_1;

209

Out27_1 = DataTypeConversion28_1;

210

Out28_1 = DataTypeConversion29_1;

211

Out29_1 = DataTypeConversion30_1;

212

Out30_1 = DataTypeConversion31_1;

213

Out33_1 = DataTypeConversion34_1;

214

Out35_1 = DataTypeConversion26_1;

215

Out36_1 = DataTypeConversion27_1;

216

__time_step = (0.0 > ((pre __time_step) + 0.200000000000000));

217

__nb_step = (0 > ((pre __nb_step) + 1));

218

tel

219

