test_powerwindow.py 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. import unittest
  2. from utils import *
  3. model_list = set([" SimpleClassDiagrams : SimpleClassDiagrams",
  4. " CoreFormalism : SimpleClassDiagrams",
  5. " ManualOperation : SimpleClassDiagrams",
  6. " ActionLanguage : SimpleClassDiagrams",
  7. " ProcessModel : SimpleClassDiagrams",
  8. " core : CoreFormalism"])
  9. model_full_list = set([" 221 root admin SimpleClassDiagrams : SimpleClassDiagrams",
  10. " 221 root admin CoreFormalism : SimpleClassDiagrams",
  11. " 221 root admin ActionLanguage : SimpleClassDiagrams",
  12. " 221 root admin ManualOperation : SimpleClassDiagrams",
  13. " 221 root admin ProcessModel : SimpleClassDiagrams",
  14. " 200 root admin core : CoreFormalism"])
  15. all_files = [ "core/mini_modify.alc",
  16. "core/core_formalism.mvc",
  17. "core/core_algorithm.alc",
  18. "core/pm.mvc",
  19. "primitives.alc",
  20. "object_operations.alc",
  21. "conformance_scd.alc",
  22. "library.alc",
  23. "transform.alc",
  24. "model_management.alc",
  25. "ramify.alc",
  26. "metamodels.alc",
  27. "random.alc",
  28. "constructors.alc",
  29. "modelling.alc",
  30. "compilation_manager.alc",
  31. ]
  32. class TestPowerWindow(unittest.TestCase):
  33. @slow
  34. def test_process_powerwindow_fast(self):
  35. self.assertTrue(run_file(all_files,
  36. [ "root", "root", "root",
  37. "model_add",
  38. "SimpleClassDiagrams",
  39. "ReachabilityGraph",
  40. ] + get_model_constructor_2("models/reachability_graph.mvc") + [
  41. "model_add",
  42. "SimpleClassDiagrams",
  43. "PetriNet",
  44. ] + get_model_constructor_2("integration/code/pn_design.mvc") + [
  45. "model_add",
  46. "SimpleClassDiagrams",
  47. "Encapsulated_PetriNet",
  48. ] + get_model_constructor_2("models/petrinet_ports.mvc") + [
  49. "model_add",
  50. "SimpleClassDiagrams",
  51. "PW_Plant",
  52. ] + get_model_constructor_2("models/plant_PW.mvc") + [
  53. "model_add",
  54. "SimpleClassDiagrams",
  55. "PW_Environment",
  56. ] + get_model_constructor_2("models/environment_PW.mvc") + [
  57. "model_add",
  58. "SimpleClassDiagrams",
  59. "PW_Control",
  60. ] + get_model_constructor_2("models/control_PW.mvc") + [
  61. "model_add",
  62. "SimpleClassDiagrams",
  63. "Requirements",
  64. ] + get_model_constructor_2("models/requirements.mvc") + [
  65. "model_add",
  66. "SimpleClassDiagrams",
  67. "Query",
  68. ] + get_model_constructor_2("models/query.mvc") + [
  69. "model_add",
  70. "ProcessModel",
  71. "pm_powerwindow",
  72. ] + get_model_constructor_2("models/pm_req_analyse.mvc") + [
  73. "model_add",
  74. "SimpleClassDiagrams",
  75. "Architecture",
  76. ] + get_model_constructor_2("models/architecture.mvc") + [
  77. "model_list",
  78. "transformation_add_MT_language",
  79. "PetriNet",
  80. "Encapsulated_PetriNet",
  81. "PW_Plant",
  82. "PW_Control",
  83. "PW_Environment",
  84. "Requirements",
  85. "ReachabilityGraph",
  86. "Query",
  87. "Architecture",
  88. "",
  89. "All_RAM",
  90. "model_modify",
  91. "__merged_All_RAM",
  92. "instantiate",
  93. "Association",
  94. "CTRL2EPN_link",
  95. "PW_Control/State",
  96. "Encapsulated_PetriNet/Place",
  97. "instantiate",
  98. "Association",
  99. "CTRL2EPN_tlink",
  100. "PW_Control/Transition",
  101. "Encapsulated_PetriNet/Transition",
  102. "instantiate",
  103. "Association",
  104. "PLANT2EPN_link",
  105. "PW_Plant/State",
  106. "Encapsulated_PetriNet/Place",
  107. "instantiate",
  108. "Association",
  109. "PLANT2EPN_tlink",
  110. "PW_Plant/Transition",
  111. "Encapsulated_PetriNet/Transition",
  112. "instantiate",
  113. "Association",
  114. "ENV2EPN_link",
  115. "PW_Environment/Event",
  116. "Encapsulated_PetriNet/Place",
  117. "instantiate",
  118. "Association",
  119. "EPN2PN_place_link",
  120. "Encapsulated_PetriNet/Place",
  121. "PetriNet/Place",
  122. "instantiate",
  123. "Association",
  124. "EPN2PN_transition_link",
  125. "Encapsulated_PetriNet/Transition",
  126. "PetriNet/Transition",
  127. "exit",
  128. "transformation_RAMify",
  129. "__merged_All_RAM",
  130. "All_RAM",
  131. "transformation_add_MANUAL",
  132. "Requirements",
  133. "",
  134. "Requirements",
  135. "",
  136. "revise_req",
  137. "transformation_add_MANUAL",
  138. "Requirements",
  139. "PW_Environment",
  140. "",
  141. "PW_Environment",
  142. "",
  143. "revise_environment",
  144. "transformation_add_MANUAL",
  145. "Requirements",
  146. "PW_Plant",
  147. "",
  148. "PW_Plant",
  149. "",
  150. "revise_plant",
  151. "transformation_add_MANUAL",
  152. "Requirements",
  153. "PW_Control",
  154. "",
  155. "PW_Control",
  156. "",
  157. "revise_control",
  158. "transformation_add_MANUAL",
  159. "Requirements",
  160. "Query",
  161. "",
  162. "Query",
  163. "",
  164. "revise_query",
  165. "transformation_add_MANUAL",
  166. "Requirements",
  167. "Architecture",
  168. "",
  169. "Architecture",
  170. "",
  171. "revise_architecture",
  172. "transformation_add_MT",
  173. "All_RAM",
  174. "",
  175. "PW_Plant",
  176. "PW_Environment",
  177. "PW_Control",
  178. "Query",
  179. "Architecture",
  180. "Requirements",
  181. "",
  182. "make_initial_models",
  183. ] + get_model_constructor_2("models/initialize.mvc") + [
  184. "transformation_add_MT",
  185. "All_RAM",
  186. "PW_Plant",
  187. "",
  188. "Encapsulated_PetriNet",
  189. "",
  190. "plant_to_EPN",
  191. ] + get_model_constructor_2("models/plant_to_EPN.mvc") + [
  192. "transformation_add_MT",
  193. "All_RAM",
  194. "PW_Control",
  195. "",
  196. "Encapsulated_PetriNet",
  197. "",
  198. "control_to_EPN",
  199. ] + get_model_constructor_2("models/control_to_EPN.mvc") + [
  200. "transformation_add_MT",
  201. "All_RAM",
  202. "PW_Environment",
  203. "",
  204. "Encapsulated_PetriNet",
  205. "",
  206. "environment_to_EPN",
  207. ] + get_model_constructor_2("models/environment_to_EPN.mvc") + [
  208. "transformation_add_MT",
  209. "All_RAM",
  210. "Encapsulated_PetriNet",
  211. "Architecture",
  212. "",
  213. "Encapsulated_PetriNet",
  214. "",
  215. "combine_EPN",
  216. ] + get_model_constructor_2("models/combine_EPN.mvc") + [
  217. "transformation_add_MT",
  218. "All_RAM",
  219. "ReachabilityGraph",
  220. "Query",
  221. "",
  222. "",
  223. "match",
  224. ] + get_model_constructor_2("models/matches.mvc") + [
  225. "transformation_add_AL",
  226. "PetriNet",
  227. "",
  228. "ReachabilityGraph",
  229. "",
  230. "reachability",
  231. ] + get_constructor(open("models/reachability.alc", "r").read()) + [
  232. "transformation_add_AL",
  233. "PetriNet",
  234. "",
  235. "",
  236. "pn_print",
  237. ] + get_constructor(open("models/pn_print.alc", "r").read()) + [
  238. "transformation_add_AL",
  239. "Encapsulated_PetriNet",
  240. "",
  241. "",
  242. "epn_print",
  243. ] + get_constructor(open("models/epn_print.alc", "r").read()) + [
  244. "transformation_add_AL",
  245. "ReachabilityGraph",
  246. "",
  247. "",
  248. "bfs",
  249. ] + get_constructor(open("models/bfs.alc", "r").read()) + [
  250. "model_list",
  251. "process_execute",
  252. "pm_powerwindow",
  253. "pm_",
  254. # revise_req
  255. "upload",
  256. ] + get_model_constructor_2("models/requirements_model.mvc") + [
  257. "exit",
  258. # revise_plant
  259. "upload",
  260. ] + get_model_constructor_2("models/plant_model.mvc") + [
  261. "exit",
  262. # revise_environment
  263. "upload",
  264. ] + get_model_constructor_2("models/environment_model.mvc") + [
  265. "exit",
  266. # revise_control
  267. "upload",
  268. ] + get_model_constructor_2("models/control_model_wrong.mvc") + [
  269. "exit",
  270. # revise_query
  271. "upload",
  272. ] + get_model_constructor_2("models/query_model.mvc") + [
  273. "exit",
  274. # revise_architecture
  275. "upload",
  276. ] + get_model_constructor_2("models/architecture_model.mvc") + [
  277. "exit",
  278. ],
  279. [ # bootup phase
  280. "Desired username for admin user?",
  281. "Desired password for admin user?",
  282. "Please repeat the password",
  283. "Passwords match!",
  284. "Welcome to the Model Management Interface v2.0!",
  285. "Use the 'help' command for a list of possible commands",
  286. "Ready for command...",
  287. # model_add * 10
  288. ] + [ "Creating new model!",
  289. "Model type?",
  290. "Model name?",
  291. "Waiting for model constructors...",
  292. "Model upload success!",
  293. "Ready for command...", ] * 10 + [
  294. # model_list
  295. model_list |
  296. set([
  297. " ReachabilityGraph : SimpleClassDiagrams",
  298. " PetriNet : SimpleClassDiagrams",
  299. " Encapsulated_PetriNet : SimpleClassDiagrams",
  300. " PW_Plant : SimpleClassDiagrams",
  301. " PW_Environment : SimpleClassDiagrams",
  302. " PW_Control : SimpleClassDiagrams",
  303. " Requirements : SimpleClassDiagrams",
  304. " Query : SimpleClassDiagrams",
  305. " pm_powerwindow : ProcessModel",
  306. " Architecture : SimpleClassDiagrams",
  307. ]),
  308. "Ready for command...",
  309. # transformation_add_MT_language
  310. "Formalisms to include (terminate with empty string)?",
  311. "Name of the RAMified transformation metamodel?",
  312. "Ready for command...",
  313. # model_modify
  314. "Which model do you want to modify?",
  315. "Model loaded, ready for commands!",
  316. "Use 'help' command for a list of possible commands",
  317. "Please give your command.",
  318. # instantiate * 7
  319. ] + [ "Type to instantiate?",
  320. "Name of new element?",
  321. "Source name?",
  322. "Destination name?",
  323. "Instantiation successful!",
  324. "Please give your command.", ] * 7 + [
  325. "Ready for command...",
  326. # transformation_RAMify
  327. "Which metamodel do you want to RAMify?",
  328. "Where do you want to store the RAMified metamodel?",
  329. "Ready for command...",
  330. # transformation_add_MANUAL * 6
  331. ] + [
  332. "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
  333. "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
  334. "Name of Manual operation model?",
  335. "Ready for command...",
  336. ] * 6 + [
  337. # transformation_add_MT * 6
  338. ] + [
  339. "RAMified metamodel to use?",
  340. "Supported metamodels:",
  341. set([" PetriNet",
  342. " Encapsulated_PetriNet",
  343. " PW_Plant",
  344. " Architecture",
  345. " Query",
  346. " PW_Environment",
  347. " Requirements",
  348. " PW_Control",
  349. " ReachabilityGraph",
  350. ]),
  351. "",
  352. "Which ones do you want to use as source (empty string to finish)?",
  353. "Which ones do you want to use as target (empty string to finish)?",
  354. "Name of new transformation?",
  355. "Waiting for model constructors...",
  356. "Ready for command...",
  357. ] * 6 + [
  358. # transformation_add_AL * 4
  359. ] + [ "Which metamodels do you want to use as source for the action code (empty string to finish)?",
  360. "Which metamodels do you want to use as target for the action code (empty string to finish)?",
  361. "Name of Action Language model?",
  362. "Waiting for model constructors...",
  363. "Ready for command...", ] * 4 + [
  364. # model_list
  365. model_list |
  366. set([
  367. " PetriNet : SimpleClassDiagrams",
  368. " Encapsulated_PetriNet : SimpleClassDiagrams",
  369. " PW_Plant : SimpleClassDiagrams",
  370. " PW_Environment : SimpleClassDiagrams",
  371. " PW_Control : SimpleClassDiagrams",
  372. " Requirements : SimpleClassDiagrams",
  373. " Query : SimpleClassDiagrams",
  374. " reachability : ActionLanguage",
  375. " revise_req : ManualOperation",
  376. " revise_plant : ManualOperation",
  377. " revise_control : ManualOperation",
  378. " revise_environment : ManualOperation",
  379. " revise_query : ManualOperation",
  380. " revise_architecture : ManualOperation",
  381. " __merged_revise_req : SimpleClassDiagrams",
  382. " __merged_All_RAM : SimpleClassDiagrams",
  383. " __merged_revise_plant : SimpleClassDiagrams",
  384. " __merged_revise_control : SimpleClassDiagrams",
  385. " __merged_revise_environment : SimpleClassDiagrams",
  386. " __merged_revise_query : SimpleClassDiagrams",
  387. " __merged_revise_architecture : SimpleClassDiagrams",
  388. " pn_print : ActionLanguage",
  389. " epn_print : ActionLanguage",
  390. " match : All_RAM",
  391. " All_RAM : SimpleClassDiagrams",
  392. " make_initial_models : All_RAM",
  393. " pm_powerwindow : ProcessModel",
  394. " plant_to_EPN : All_RAM",
  395. " combine_EPN : All_RAM",
  396. " environment_to_EPN : All_RAM",
  397. " control_to_EPN : All_RAM",
  398. " ReachabilityGraph : SimpleClassDiagrams",
  399. " Architecture : SimpleClassDiagrams",
  400. " bfs : ActionLanguage",
  401. ]),
  402. "Ready for command...",
  403. # process_execute
  404. "Which process model do you want to execute?",
  405. "Model prefix to use?",
  406. # Manual transformation revise_req
  407. "Please perform manual transformation \"revise_req\"",
  408. "Model loaded, ready for commands!",
  409. "Use 'help' command for a list of possible commands",
  410. "Please give your command.",
  411. "Waiting for model constructors...",
  412. "Please give your command.",
  413. # Manual transformation revise_plant
  414. "Please perform manual transformation \"revise_plant\"",
  415. "Model loaded, ready for commands!",
  416. "Use 'help' command for a list of possible commands",
  417. "Please give your command.",
  418. "Waiting for model constructors...",
  419. "Please give your command.",
  420. # Manual transformation revise_environment
  421. "Please perform manual transformation \"revise_environment\"",
  422. "Model loaded, ready for commands!",
  423. "Use 'help' command for a list of possible commands",
  424. "Please give your command.",
  425. "Waiting for model constructors...",
  426. "Please give your command.",
  427. # Manual transformation revise_control
  428. "Please perform manual transformation \"revise_control\"",
  429. "Model loaded, ready for commands!",
  430. "Use 'help' command for a list of possible commands",
  431. "Please give your command.",
  432. "Waiting for model constructors...",
  433. "Please give your command.",
  434. # Manual transformation revise_query
  435. "Please perform manual transformation \"revise_query\"",
  436. "Model loaded, ready for commands!",
  437. "Use 'help' command for a list of possible commands",
  438. "Please give your command.",
  439. "Waiting for model constructors...",
  440. "Please give your command.",
  441. # Manual transformation revise_architecture
  442. "Please perform manual transformation \"revise_architecture\"",
  443. "Model loaded, ready for commands!",
  444. "Use 'help' command for a list of possible commands",
  445. "Please give your command.",
  446. "Waiting for model constructors...",
  447. "Please give your command.",
  448. # Computations happen without output
  449. # Finished, so we go back to the start
  450. "Ready for command...",
  451. ]))
  452. @slow
  453. def test_process_powerwindow_debug(self):
  454. self.assertTrue(run_file(all_files,
  455. [ "root", "root", "root",
  456. "model_add",
  457. "SimpleClassDiagrams",
  458. "ReachabilityGraph",
  459. ] + get_model_constructor_2("models/reachability_graph.mvc") + [
  460. "model_add",
  461. "SimpleClassDiagrams",
  462. "PetriNet",
  463. ] + get_model_constructor_2("integration/code/pn_design.mvc") + [
  464. "model_add",
  465. "SimpleClassDiagrams",
  466. "Encapsulated_PetriNet",
  467. ] + get_model_constructor_2("models/petrinet_ports.mvc") + [
  468. "model_add",
  469. "SimpleClassDiagrams",
  470. "PW_Plant",
  471. ] + get_model_constructor_2("models/plant_PW.mvc") + [
  472. "model_add",
  473. "SimpleClassDiagrams",
  474. "PW_Environment",
  475. ] + get_model_constructor_2("models/environment_PW.mvc") + [
  476. "model_add",
  477. "SimpleClassDiagrams",
  478. "PW_Control",
  479. ] + get_model_constructor_2("models/control_PW.mvc") + [
  480. "model_add",
  481. "SimpleClassDiagrams",
  482. "Requirements",
  483. ] + get_model_constructor_2("models/requirements.mvc") + [
  484. "model_add",
  485. "SimpleClassDiagrams",
  486. "Query",
  487. ] + get_model_constructor_2("models/query.mvc") + [
  488. "model_add",
  489. "ProcessModel",
  490. "pm_powerwindow",
  491. ] + get_model_constructor_2("models/pm_req_analyse_debug.mvc") + [
  492. "model_add",
  493. "SimpleClassDiagrams",
  494. "Architecture",
  495. ] + get_model_constructor_2("models/architecture.mvc") + [
  496. "model_list",
  497. "transformation_add_MT_language",
  498. "PetriNet",
  499. "Encapsulated_PetriNet",
  500. "PW_Plant",
  501. "PW_Control",
  502. "PW_Environment",
  503. "Requirements",
  504. "ReachabilityGraph",
  505. "Query",
  506. "Architecture",
  507. "",
  508. "All_RAM",
  509. "model_modify",
  510. "__merged_All_RAM",
  511. "instantiate",
  512. "Association",
  513. "CTRL2EPN_link",
  514. "PW_Control/State",
  515. "Encapsulated_PetriNet/Place",
  516. "instantiate",
  517. "Association",
  518. "CTRL2EPN_tlink",
  519. "PW_Control/Transition",
  520. "Encapsulated_PetriNet/Transition",
  521. "instantiate",
  522. "Association",
  523. "PLANT2EPN_link",
  524. "PW_Plant/State",
  525. "Encapsulated_PetriNet/Place",
  526. "instantiate",
  527. "Association",
  528. "PLANT2EPN_tlink",
  529. "PW_Plant/Transition",
  530. "Encapsulated_PetriNet/Transition",
  531. "instantiate",
  532. "Association",
  533. "ENV2EPN_link",
  534. "PW_Environment/Event",
  535. "Encapsulated_PetriNet/Place",
  536. "instantiate",
  537. "Association",
  538. "EPN2PN_place_link",
  539. "Encapsulated_PetriNet/Place",
  540. "PetriNet/Place",
  541. "instantiate",
  542. "Association",
  543. "EPN2PN_transition_link",
  544. "Encapsulated_PetriNet/Transition",
  545. "PetriNet/Transition",
  546. "exit",
  547. "transformation_RAMify",
  548. "__merged_All_RAM",
  549. "All_RAM",
  550. "transformation_add_MANUAL",
  551. "Requirements",
  552. "",
  553. "Requirements",
  554. "",
  555. "revise_req",
  556. "transformation_add_MANUAL",
  557. "Requirements",
  558. "PW_Environment",
  559. "",
  560. "PW_Environment",
  561. "",
  562. "revise_environment",
  563. "transformation_add_MANUAL",
  564. "Requirements",
  565. "PW_Plant",
  566. "",
  567. "PW_Plant",
  568. "",
  569. "revise_plant",
  570. "transformation_add_MANUAL",
  571. "Requirements",
  572. "PW_Control",
  573. "",
  574. "PW_Control",
  575. "",
  576. "revise_control",
  577. "transformation_add_MANUAL",
  578. "Requirements",
  579. "Query",
  580. "",
  581. "Query",
  582. "",
  583. "revise_query",
  584. "transformation_add_MANUAL",
  585. "Requirements",
  586. "Architecture",
  587. "",
  588. "Architecture",
  589. "",
  590. "revise_architecture",
  591. "transformation_add_MT",
  592. "All_RAM",
  593. "",
  594. "PW_Plant",
  595. "PW_Environment",
  596. "PW_Control",
  597. "Query",
  598. "Architecture",
  599. "Requirements",
  600. "",
  601. "make_initial_models",
  602. ] + get_model_constructor_2("models/initialize.mvc") + [
  603. "transformation_add_MT",
  604. "All_RAM",
  605. "PW_Plant",
  606. "",
  607. "Encapsulated_PetriNet",
  608. "",
  609. "plant_to_EPN",
  610. ] + get_model_constructor_2("models/plant_to_EPN.mvc") + [
  611. "transformation_add_MT",
  612. "All_RAM",
  613. "PW_Control",
  614. "",
  615. "Encapsulated_PetriNet",
  616. "",
  617. "control_to_EPN",
  618. ] + get_model_constructor_2("models/control_to_EPN.mvc") + [
  619. "transformation_add_MT",
  620. "All_RAM",
  621. "PW_Environment",
  622. "",
  623. "Encapsulated_PetriNet",
  624. "",
  625. "environment_to_EPN",
  626. ] + get_model_constructor_2("models/environment_to_EPN.mvc") + [
  627. "transformation_add_MT",
  628. "All_RAM",
  629. "Encapsulated_PetriNet",
  630. "Architecture",
  631. "",
  632. "Encapsulated_PetriNet",
  633. "",
  634. "combine_EPN",
  635. ] + get_model_constructor_2("models/combine_EPN.mvc") + [
  636. "transformation_add_MT",
  637. "All_RAM",
  638. "ReachabilityGraph",
  639. "Query",
  640. "",
  641. "",
  642. "match",
  643. ] + get_model_constructor_2("models/matches.mvc") + [
  644. "transformation_add_AL",
  645. "PetriNet",
  646. "",
  647. "ReachabilityGraph",
  648. "",
  649. "reachability",
  650. ] + get_constructor(open("models/reachability.alc", "r").read()) + [
  651. "transformation_add_AL",
  652. "PetriNet",
  653. "",
  654. "",
  655. "pn_print",
  656. ] + get_constructor(open("models/pn_print.alc", "r").read()) + [
  657. "transformation_add_AL",
  658. "Encapsulated_PetriNet",
  659. "",
  660. "",
  661. "epn_print",
  662. ] + get_constructor(open("models/epn_print.alc", "r").read()) + [
  663. "transformation_add_AL",
  664. "ReachabilityGraph",
  665. "",
  666. "",
  667. "bfs",
  668. ] + get_constructor(open("models/bfs.alc", "r").read()) + [
  669. "model_list",
  670. "process_execute",
  671. "pm_powerwindow",
  672. "pm_",
  673. # revise_req
  674. "upload",
  675. ] + get_model_constructor_2("models/requirements_model.mvc") + [
  676. "exit",
  677. #### First phase!
  678. # revise_plant
  679. "upload",
  680. ] + get_model_constructor_2("models/plant_model.mvc") + [
  681. "exit",
  682. # revise_environment
  683. "upload",
  684. ] + get_model_constructor_2("models/environment_model.mvc") + [
  685. "exit",
  686. # revise_control
  687. "upload",
  688. ] + get_model_constructor_2("models/control_model_wrong.mvc") + [
  689. "exit",
  690. # revise_query
  691. "upload",
  692. ] + get_model_constructor_2("models/query_model.mvc") + [
  693. "exit",
  694. # revise_architecture
  695. "upload",
  696. ] + get_model_constructor_2("models/architecture_model.mvc") + [
  697. "exit",
  698. #### Second phase!
  699. # revise_plant
  700. "upload",
  701. ] + get_model_constructor_2("models/plant_model.mvc") + [
  702. "exit",
  703. # revise_environment
  704. "upload",
  705. ] + get_model_constructor_2("models/environment_model.mvc") + [
  706. "exit",
  707. # revise_control
  708. "upload",
  709. ] + get_model_constructor_2("models/control_model.mvc") + [
  710. "exit",
  711. # revise_query
  712. "upload",
  713. ] + get_model_constructor_2("models/query_model.mvc") + [
  714. "exit",
  715. # revise_architecture
  716. "upload",
  717. ] + get_model_constructor_2("models/architecture_model.mvc") + [
  718. "exit",
  719. ],
  720. [ # bootup phase
  721. "Desired username for admin user?",
  722. "Desired password for admin user?",
  723. "Please repeat the password",
  724. "Passwords match!",
  725. "Welcome to the Model Management Interface v2.0!",
  726. "Use the 'help' command for a list of possible commands",
  727. "Ready for command...",
  728. # model_add * 10
  729. ] + [ "Creating new model!",
  730. "Model type?",
  731. "Model name?",
  732. "Waiting for model constructors...",
  733. "Model upload success!",
  734. "Ready for command...", ] * 10 + [
  735. # model_list
  736. model_list |
  737. set([
  738. " ReachabilityGraph : SimpleClassDiagrams",
  739. " PetriNet : SimpleClassDiagrams",
  740. " Encapsulated_PetriNet : SimpleClassDiagrams",
  741. " PW_Plant : SimpleClassDiagrams",
  742. " PW_Environment : SimpleClassDiagrams",
  743. " PW_Control : SimpleClassDiagrams",
  744. " Requirements : SimpleClassDiagrams",
  745. " Query : SimpleClassDiagrams",
  746. " pm_powerwindow : ProcessModel",
  747. " Architecture : SimpleClassDiagrams",
  748. ]),
  749. "Ready for command...",
  750. # transformation_add_MT_language
  751. "Formalisms to include (terminate with empty string)?",
  752. "Name of the RAMified transformation metamodel?",
  753. "Ready for command...",
  754. # model_modify
  755. "Which model do you want to modify?",
  756. "Model loaded, ready for commands!",
  757. "Use 'help' command for a list of possible commands",
  758. "Please give your command.",
  759. # instantiate * 7
  760. ] + [ "Type to instantiate?",
  761. "Name of new element?",
  762. "Source name?",
  763. "Destination name?",
  764. "Instantiation successful!",
  765. "Please give your command.", ] * 7 + [
  766. "Ready for command...",
  767. # transformation_RAMify
  768. "Which metamodel do you want to RAMify?",
  769. "Where do you want to store the RAMified metamodel?",
  770. "Ready for command...",
  771. # transformation_add_MANUAL * 6
  772. ] + [
  773. "Which metamodels do you want to use as source for the manual operation (empty string to finish)?",
  774. "Which metamodels do you want to use as target for the manual operation (empty string to finish)?",
  775. "Name of Manual operation model?",
  776. "Ready for command...",
  777. ] * 6 + [
  778. # transformation_add_MT * 6
  779. ] + [
  780. "RAMified metamodel to use?",
  781. "Supported metamodels:",
  782. set([" PetriNet",
  783. " Encapsulated_PetriNet",
  784. " PW_Plant",
  785. " Architecture",
  786. " Query",
  787. " PW_Environment",
  788. " Requirements",
  789. " PW_Control",
  790. " ReachabilityGraph",
  791. ]),
  792. "",
  793. "Which ones do you want to use as source (empty string to finish)?",
  794. "Which ones do you want to use as target (empty string to finish)?",
  795. "Name of new transformation?",
  796. "Waiting for model constructors...",
  797. "Ready for command...",
  798. ] * 6 + [
  799. # transformation_add_AL * 4
  800. ] + [ "Which metamodels do you want to use as source for the action code (empty string to finish)?",
  801. "Which metamodels do you want to use as target for the action code (empty string to finish)?",
  802. "Name of Action Language model?",
  803. "Waiting for model constructors...",
  804. "Ready for command...", ] * 4 + [
  805. # model_list
  806. model_list |
  807. set([
  808. " PetriNet : SimpleClassDiagrams",
  809. " Encapsulated_PetriNet : SimpleClassDiagrams",
  810. " PW_Plant : SimpleClassDiagrams",
  811. " PW_Environment : SimpleClassDiagrams",
  812. " PW_Control : SimpleClassDiagrams",
  813. " Requirements : SimpleClassDiagrams",
  814. " Query : SimpleClassDiagrams",
  815. " reachability : ActionLanguage",
  816. " revise_req : ManualOperation",
  817. " revise_plant : ManualOperation",
  818. " revise_control : ManualOperation",
  819. " revise_environment : ManualOperation",
  820. " revise_query : ManualOperation",
  821. " revise_architecture : ManualOperation",
  822. " __merged_revise_req : SimpleClassDiagrams",
  823. " __merged_All_RAM : SimpleClassDiagrams",
  824. " __merged_revise_plant : SimpleClassDiagrams",
  825. " __merged_revise_control : SimpleClassDiagrams",
  826. " __merged_revise_environment : SimpleClassDiagrams",
  827. " __merged_revise_query : SimpleClassDiagrams",
  828. " __merged_revise_architecture : SimpleClassDiagrams",
  829. " pn_print : ActionLanguage",
  830. " epn_print : ActionLanguage",
  831. " match : All_RAM",
  832. " All_RAM : SimpleClassDiagrams",
  833. " make_initial_models : All_RAM",
  834. " pm_powerwindow : ProcessModel",
  835. " plant_to_EPN : All_RAM",
  836. " combine_EPN : All_RAM",
  837. " environment_to_EPN : All_RAM",
  838. " control_to_EPN : All_RAM",
  839. " ReachabilityGraph : SimpleClassDiagrams",
  840. " Architecture : SimpleClassDiagrams",
  841. " bfs : ActionLanguage",
  842. ]),
  843. "Ready for command...",
  844. # process_execute
  845. "Which process model do you want to execute?",
  846. "Model prefix to use?",
  847. # Manual transformation revise_req
  848. "Please perform manual transformation \"revise_req\"",
  849. "Model loaded, ready for commands!",
  850. "Use 'help' command for a list of possible commands",
  851. "Please give your command.",
  852. "Waiting for model constructors...",
  853. "Please give your command.",
  854. # Manual transformation revise_plant
  855. "Please perform manual transformation \"revise_plant\"",
  856. "Model loaded, ready for commands!",
  857. "Use 'help' command for a list of possible commands",
  858. "Please give your command.",
  859. "Waiting for model constructors...",
  860. "Please give your command.",
  861. # Manual transformation revise_environment
  862. "Please perform manual transformation \"revise_environment\"",
  863. "Model loaded, ready for commands!",
  864. "Use 'help' command for a list of possible commands",
  865. "Please give your command.",
  866. "Waiting for model constructors...",
  867. "Please give your command.",
  868. # Manual transformation revise_control
  869. "Please perform manual transformation \"revise_control\"",
  870. "Model loaded, ready for commands!",
  871. "Use 'help' command for a list of possible commands",
  872. "Please give your command.",
  873. "Waiting for model constructors...",
  874. "Please give your command.",
  875. # Manual transformation revise_query
  876. "Please perform manual transformation \"revise_query\"",
  877. "Model loaded, ready for commands!",
  878. "Use 'help' command for a list of possible commands",
  879. "Please give your command.",
  880. "Waiting for model constructors...",
  881. "Please give your command.",
  882. # Manual transformation revise_architecture
  883. "Please perform manual transformation \"revise_architecture\"",
  884. "Model loaded, ready for commands!",
  885. "Use 'help' command for a list of possible commands",
  886. "Please give your command.",
  887. "Waiting for model constructors...",
  888. "Please give your command.",
  889. # Computations happen without output
  890. # Got an error!
  891. # Manual transformation revise_plant
  892. "Please perform manual transformation \"revise_plant\"",
  893. "Model loaded, ready for commands!",
  894. "Use 'help' command for a list of possible commands",
  895. "Please give your command.",
  896. "Waiting for model constructors...",
  897. "Please give your command.",
  898. # Manual transformation revise_environment
  899. "Please perform manual transformation \"revise_environment\"",
  900. "Model loaded, ready for commands!",
  901. "Use 'help' command for a list of possible commands",
  902. "Please give your command.",
  903. "Waiting for model constructors...",
  904. "Please give your command.",
  905. # Manual transformation revise_control
  906. "Please perform manual transformation \"revise_control\"",
  907. "Model loaded, ready for commands!",
  908. "Use 'help' command for a list of possible commands",
  909. "Please give your command.",
  910. "Waiting for model constructors...",
  911. "Please give your command.",
  912. # Manual transformation revise_query
  913. "Please perform manual transformation \"revise_query\"",
  914. "Model loaded, ready for commands!",
  915. "Use 'help' command for a list of possible commands",
  916. "Please give your command.",
  917. "Waiting for model constructors...",
  918. "Please give your command.",
  919. # Manual transformation revise_architecture
  920. "Please perform manual transformation \"revise_architecture\"",
  921. "Model loaded, ready for commands!",
  922. "Use 'help' command for a list of possible commands",
  923. "Please give your command.",
  924. "Waiting for model constructors...",
  925. "Please give your command.",
  926. # Finished, so we go back to the start
  927. "Ready for command...",
  928. ]))