## lustrec-tests / regression_tests / lustre_files / success / Stateflow / src_Flowchart11 / Flowchart11.lus @ eb639349

History | View | Annotate | Download (7.5 KB)

1 | eb639349 | bourbouh | -- This file has been generated by cocoSim |
---|---|---|---|

2 | |||

3 | |||

4 | -- System nodes |
||

5 | |||

6 | |||

7 | |||

8 | |||

9 | node POINT__To__Flowchart10_Flowchart10Junction769_2_Condition_Action(y_1:int) |
||

10 | |||

11 | returns (y:int); |
||

12 | |||

13 | |||

14 | var y_2:int; |
||

15 | |||

16 | |||

17 | let |
||

18 | |||

19 | |||

20 | |||

21 | y_2 |
||

22 | = y_1 - 1; |
||

23 | |||

24 | |||

25 | (y) |
||

26 | = (y_2); |
||

27 | |||

28 | |||

29 | tel |
||

30 | |||

31 | |||

32 | |||

33 | |||

34 | |||

35 | |||

36 | node Flowchart10_A__To__Flowchart10_Flowchart10Junction771_1_Condition_Action(y_1:int) |
||

37 | |||

38 | returns (y:int); |
||

39 | |||

40 | |||

41 | var y_2:int; |
||

42 | |||

43 | |||

44 | let |
||

45 | |||

46 | |||

47 | |||

48 | y_2 |
||

49 | = y_1 -2; |
||

50 | |||

51 | |||

52 | (y) |
||

53 | = (y_2); |
||

54 | |||

55 | |||

56 | tel |
||

57 | |||

58 | |||

59 | |||

60 | |||

61 | |||

62 | |||

63 | node POINT__To__Flowchart10_Flowchart10Junction768_1_Condition_Action(y_1:int) |
||

64 | |||

65 | returns (y:int); |
||

66 | |||

67 | |||

68 | var y_2:int; |
||

69 | |||

70 | |||

71 | let |
||

72 | |||

73 | |||

74 | |||

75 | y_2 |
||

76 | = y_1 + 1; |
||

77 | |||

78 | |||

79 | (y) |
||

80 | = (y_2); |
||

81 | |||

82 | |||

83 | tel |
||

84 | |||

85 | |||

86 | |||

87 | |||

88 | |||

89 | |||

90 | node Flowchart10_A__To__Flowchart10_Flowchart10Junction770_2_Condition_Action(y_1:int) |
||

91 | |||

92 | returns (y:int); |
||

93 | |||

94 | |||

95 | var y_2:int; |
||

96 | |||

97 | |||

98 | let |
||

99 | |||

100 | |||

101 | |||

102 | y_2 |
||

103 | = y_1 +2; |
||

104 | |||

105 | |||

106 | (y) |
||

107 | = (y_2); |
||

108 | |||

109 | |||

110 | tel |
||

111 | |||

112 | |||

113 | |||

114 | |||

115 | |||

116 | |||

117 | -- Entry action for state :Flowchart10_A |
||

118 | node Flowchart10_A_en(idFlowchart10_A_1:int; |
||

119 | idFlowchart10_Flowchart10_1:int; |
||

120 | x:int; |
||

121 | y_1:int; |
||

122 | isInner:bool) |
||

123 | |||

124 | returns (idFlowchart10_A:int; |
||

125 | idFlowchart10_Flowchart10:int; |
||

126 | y:int); |
||

127 | |||

128 | |||

129 | var idFlowchart10_A_2, idFlowchart10_A_3, idFlowchart10_A_4:int; |
||

130 | idFlowchart10_Flowchart10_2, idFlowchart10_Flowchart10_3, idFlowchart10_Flowchart10_4:int; |
||

131 | y_2, y_3, y_4, y_5:int; |
||

132 | |||

133 | |||

134 | let |
||

135 | |||

136 | |||

137 | |||

138 | -- set state as active |
||

139 | idFlowchart10_Flowchart10_2 |
||

140 | = 767; |
||

141 | |||

142 | |||

143 | |||

144 | -- transition trace : |
||

145 | --POINT__To__Junction768_1 |
||

146 | -- condition Action : y++; |
||

147 | |||

148 | (y_2) |
||

149 | = |
||

150 | if (( x=0 )) then |
||

151 | POINT__To__Flowchart10_Flowchart10Junction768_1_Condition_Action(y_1) |
||

152 | else (y_1); |
||

153 | |||

154 | |||

155 | -- transition trace : |
||

156 | --POINT__To__Junction769_2 |
||

157 | -- condition Action : y--; |
||

158 | |||

159 | (y_3) |
||

160 | = |
||

161 | if (( x>0 )) then |
||

162 | POINT__To__Flowchart10_Flowchart10Junction769_2_Condition_Action(y_1) |
||

163 | else (y_1); |
||

164 | |||

165 | |||

166 | (idFlowchart10_A_2, idFlowchart10_Flowchart10_3, y_4) |
||

167 | = |
||

168 | |||

169 | if ( idFlowchart10_A_1 = 0) then |
||

170 | |||

171 | |||

172 | if (( x=0 )) then |
||

173 | (idFlowchart10_A_1, idFlowchart10_Flowchart10_2, y_2) |
||

174 | else |
||

175 | if (( x>0 )) then |
||

176 | (idFlowchart10_A_1, idFlowchart10_Flowchart10_2, y_3) |
||

177 | else (idFlowchart10_A_1, idFlowchart10_Flowchart10_2, y_1) |
||

178 | |||

179 | else(idFlowchart10_A_1, idFlowchart10_Flowchart10_2, y_1); |
||

180 | |||

181 | |||

182 | |||

183 | (idFlowchart10_A_3, idFlowchart10_Flowchart10_4, y_5) |
||

184 | = |
||

185 | if ( idFlowchart10_A_1 = 0) then |
||

186 | (idFlowchart10_A_2, idFlowchart10_Flowchart10_3, y_4) |
||

187 | else (idFlowchart10_A_1, idFlowchart10_Flowchart10_2, y_1); |
||

188 | -- case of state without states but contains transitions |
||

189 | idFlowchart10_A_4 |
||

190 | = -1; |
||

191 | |||

192 | |||

193 | (idFlowchart10_A, idFlowchart10_Flowchart10, y) |
||

194 | = (idFlowchart10_A_4, idFlowchart10_Flowchart10_4, y_5); |
||

195 | |||

196 | |||

197 | tel |
||

198 | |||

199 | |||

200 | |||

201 | |||

202 | |||

203 | -- Exit action for state :Flowchart10_A |
||

204 | node Flowchart10_A_ex(idFlowchart10_Flowchart10_1:int; |
||

205 | isInner:bool) |
||

206 | |||

207 | returns (idFlowchart10_Flowchart10:int); |
||

208 | |||

209 | |||

210 | var idFlowchart10_Flowchart10_2:int; |
||

211 | |||

212 | |||

213 | let |
||

214 | |||

215 | |||

216 | |||

217 | -- set state as inactive |
||

218 | idFlowchart10_Flowchart10_2 |
||

219 | = if (not isInner) then 0 else idFlowchart10_Flowchart10_1; |
||

220 | |||

221 | |||

222 | (idFlowchart10_Flowchart10) |
||

223 | = (idFlowchart10_Flowchart10_1); |
||

224 | |||

225 | |||

226 | tel |
||

227 | |||

228 | |||

229 | |||

230 | |||

231 | |||

232 | --During action for state :Flowchart10_A |
||

233 | node Flowchart10_A_du(x:int; |
||

234 | y_1:int) |
||

235 | |||

236 | returns (y:int); |
||

237 | |||

238 | |||

239 | |||

240 | |||

241 | let |
||

242 | |||

243 | |||

244 | |||

245 | automaton flowchart10_a_INNER |
||

246 | |||

247 | state POINTFlowchart10_A_INNER: |
||

248 | unless true and ( x>0 ) restart FLOWCHART10_A__TO__FLOWCHART10_FLOWCHART10JUNCTION771_1 |
||

249 | |||

250 | |||

251 | |||

252 | unless true and ( x=0 ) restart FLOWCHART10_A__TO__FLOWCHART10_FLOWCHART10JUNCTION770_2 |
||

253 | |||

254 | |||

255 | |||

256 | let |
||

257 | |||

258 | (y) |
||

259 | = (y_1); |
||

260 | |||

261 | |||

262 | tel |
||

263 | |||

264 | |||

265 | |||

266 | state FLOWCHART10_A__TO__FLOWCHART10_FLOWCHART10JUNCTION771_1: |
||

267 | |||

268 | var y_2:int; |
||

269 | let |
||

270 | |||

271 | -- transition trace : |
||

272 | --Flowchart10_A__To__Junction771_1 |
||

273 | -- condition Action : y-=2; |
||

274 | |||

275 | (y_2) |
||

276 | = Flowchart10_A__To__Flowchart10_Flowchart10Junction771_1_Condition_Action(y_1); |
||

277 | |||

278 | |||

279 | (y) |
||

280 | = (y_2); |
||

281 | |||

282 | |||

283 | tel |
||

284 | |||

285 | until true restart POINTFlowchart10_A_INNER |
||

286 | |||

287 | |||

288 | |||

289 | state FLOWCHART10_A__TO__FLOWCHART10_FLOWCHART10JUNCTION770_2: |
||

290 | |||

291 | var y_2:int; |
||

292 | let |
||

293 | |||

294 | -- transition trace : |
||

295 | --Flowchart10_A__To__Junction770_2 |
||

296 | -- condition Action : y+=2; |
||

297 | |||

298 | (y_2) |
||

299 | = Flowchart10_A__To__Flowchart10_Flowchart10Junction770_2_Condition_Action(y_1); |
||

300 | |||

301 | |||

302 | (y) |
||

303 | = (y_2); |
||

304 | |||

305 | |||

306 | tel |
||

307 | |||

308 | until true restart POINTFlowchart10_A_INNER |
||

309 | |||

310 | |||

311 | |||

312 | tel |
||

313 | |||

314 | |||

315 | --***************************************************State :Flowchart10_A Automaton*************************************************** |
||

316 | |||

317 | node Flowchart10_A_node(idFlowchart10_A_1:int; |
||

318 | x:int; |
||

319 | y_1:int) |
||

320 | |||

321 | returns (idFlowchart10_A:int; |
||

322 | y:int); |
||

323 | |||

324 | |||

325 | let |
||

326 | |||

327 | automaton flowchart10_a |
||

328 | |||

329 | state POINTFlowchart10_A: |
||

330 | unless (idFlowchart10_A_1=0) and ( x=0 ) restart POINT__TO__FLOWCHART10_FLOWCHART10JUNCTION768_1 |
||

331 | |||

332 | |||

333 | |||

334 | unless (idFlowchart10_A_1=0) and ( x>0 ) restart POINT__TO__FLOWCHART10_FLOWCHART10JUNCTION769_2 |
||

335 | |||

336 | |||

337 | |||

338 | let |
||

339 | |||

340 | (idFlowchart10_A, y) |
||

341 | = (idFlowchart10_A_1, y_1); |
||

342 | |||

343 | |||

344 | tel |
||

345 | |||

346 | |||

347 | |||

348 | state POINT__TO__FLOWCHART10_FLOWCHART10JUNCTION768_1: |
||

349 | |||

350 | var y_2:int; |
||

351 | let |
||

352 | |||

353 | -- transition trace : |
||

354 | --POINT__To__Junction768_1 |
||

355 | -- condition Action : y++; |
||

356 | |||

357 | (y_2) |
||

358 | = POINT__To__Flowchart10_Flowchart10Junction768_1_Condition_Action(y_1); |
||

359 | |||

360 | |||

361 | (idFlowchart10_A, y) |
||

362 | = (idFlowchart10_A_1, y_2); |
||

363 | |||

364 | |||

365 | tel |
||

366 | |||

367 | until true restart POINTFlowchart10_A |
||

368 | |||

369 | |||

370 | |||

371 | state POINT__TO__FLOWCHART10_FLOWCHART10JUNCTION769_2: |
||

372 | |||

373 | var y_2:int; |
||

374 | let |
||

375 | |||

376 | -- transition trace : |
||

377 | --POINT__To__Junction769_2 |
||

378 | -- condition Action : y--; |
||

379 | |||

380 | (y_2) |
||

381 | = POINT__To__Flowchart10_Flowchart10Junction769_2_Condition_Action(y_1); |
||

382 | |||

383 | |||

384 | (idFlowchart10_A, y) |
||

385 | = (idFlowchart10_A_1, y_2); |
||

386 | |||

387 | |||

388 | tel |
||

389 | |||

390 | until true restart POINTFlowchart10_A |
||

391 | |||

392 | |||

393 | |||

394 | tel |
||

395 | |||

396 | |||

397 | --***************************************************State :Flowchart10_Flowchart10 Automaton*************************************************** |
||

398 | |||

399 | node Flowchart10_Flowchart10_node(idFlowchart10_Flowchart10_1:int; |
||

400 | idFlowchart10_A_1:int; |
||

401 | x:int; |
||

402 | y_1:int) |
||

403 | |||

404 | returns (idFlowchart10_Flowchart10:int; |
||

405 | idFlowchart10_A:int; |
||

406 | y:int); |
||

407 | |||

408 | |||

409 | let |
||

410 | |||

411 | automaton flowchart10_flowchart10 |
||

412 | |||

413 | state POINTFlowchart10_Flowchart10: |
||

414 | unless (idFlowchart10_Flowchart10_1=0) restart POINT__TO__FLOWCHART10_A_1 |
||

415 | |||

416 | |||

417 | |||

418 | unless (idFlowchart10_Flowchart10_1=767) restart FLOWCHART10_A_IDL |
||

419 | |||

420 | let |
||

421 | |||

422 | (idFlowchart10_Flowchart10, idFlowchart10_A, y) |
||

423 | = (idFlowchart10_Flowchart10_1, idFlowchart10_A_1, y_1); |
||

424 | |||

425 | |||

426 | tel |
||

427 | |||

428 | |||

429 | |||

430 | state POINT__TO__FLOWCHART10_A_1: |
||

431 | |||

432 | var idFlowchart10_Flowchart10_2:int; |
||

433 | idFlowchart10_A_2:int; |
||

434 | y_2:int; |
||

435 | let |
||

436 | |||

437 | -- transition trace : |
||

438 | --POINT__To__Flowchart10_A_1 |
||

439 | (idFlowchart10_A_2, idFlowchart10_Flowchart10_2, y_2) |
||

440 | = Flowchart10_A_en(idFlowchart10_A_1, idFlowchart10_Flowchart10_1, x, y_1, false); |
||

441 | |||

442 | |||

443 | (idFlowchart10_Flowchart10, idFlowchart10_A, y) |
||

444 | = (idFlowchart10_Flowchart10_2, idFlowchart10_A_2, y_2); |
||

445 | |||

446 | |||

447 | tel |
||

448 | |||

449 | until true restart POINTFlowchart10_Flowchart10 |
||

450 | |||

451 | |||

452 | |||

453 | state FLOWCHART10_A_IDL: |
||

454 | |||

455 | var idFlowchart10_A_2:int; |
||

456 | y_2, y_3:int; |
||

457 | let |
||

458 | |||

459 | |||

460 | (y_2) |
||

461 | = Flowchart10_A_du(x, y_1); |
||

462 | |||

463 | |||

464 | |||

465 | (idFlowchart10_A_2, y_3) |
||

466 | = Flowchart10_A_node(idFlowchart10_A_1, x, y_2); |
||

467 | |||

468 | |||

469 | |||

470 | |||

471 | (idFlowchart10_Flowchart10, idFlowchart10_A, y) |
||

472 | = (idFlowchart10_Flowchart10_1, idFlowchart10_A_2, y_3); |
||

473 | |||

474 | |||

475 | tel |
||

476 | |||

477 | until true restart POINTFlowchart10_Flowchart10 |
||

478 | |||

479 | |||

480 | |||

481 | tel |
||

482 | |||

483 | |||

484 | --***************************************************State :Flowchart10_Flowchart10 Automaton*************************************************** |
||

485 | |||

486 | node Flowchart11_Flowchart10(x:int) |
||

487 | |||

488 | returns (y:int); |
||

489 | |||

490 | |||

491 | var y_1: int; |
||

492 | |||

493 | idFlowchart10_Flowchart10, idFlowchart10_Flowchart10_1: int; |
||

494 | |||

495 | idFlowchart10_A, idFlowchart10_A_1: int; |
||

496 | |||

497 | let |
||

498 | |||

499 | y_1 = 0 -> pre y; |
||

500 | |||

501 | idFlowchart10_Flowchart10_1 = 0 -> pre idFlowchart10_Flowchart10; |
||

502 | |||

503 | idFlowchart10_A_1 = 0 -> pre idFlowchart10_A; |
||

504 | |||

505 | |||

506 | |||

507 | |||

508 | |||

509 | (idFlowchart10_Flowchart10, idFlowchart10_A, y) |
||

510 | = Flowchart10_Flowchart10_node(idFlowchart10_Flowchart10_1, idFlowchart10_A_1, x, y_1); |
||

511 | |||

512 | |||

513 | --unused outputs |
||

514 | |||

515 | |||

516 | tel |
||

517 | |||

518 | |||

519 | |||

520 | node Flowchart11 (x_1_1 : int) |
||

521 | returns (y_1_1 : int); |
||

522 | var |
||

523 | Flowchart10_1_1 : int; |
||

524 | i_virtual_local : real; |
||

525 | let |
||

526 | Flowchart10_1_1 = Flowchart11_Flowchart10(x_1_1); |
||

527 | y_1_1 = Flowchart10_1_1; |
||

528 | i_virtual_local= 0.0 -> 1.0; |
||

529 | tel |