|
@@ -2,6 +2,7 @@ include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
include "object_operations.alh"
|
|
|
include "library.alh"
|
|
|
+include "conformance_scd.alh"
|
|
|
|
|
|
Void function petrinet_enabled(model : Element):
|
|
|
Element set_enabled
|
|
@@ -104,16 +105,28 @@ Void function petrinet_list(model : Element):
|
|
|
|
|
|
Void function main():
|
|
|
Element model
|
|
|
- String cmd
|
|
|
+ String verify_result
|
|
|
|
|
|
- model = read_root()
|
|
|
- while (element_eq(model, read_root())):
|
|
|
+ while (True):
|
|
|
output("Which model do you want to execute with petri net semantics?")
|
|
|
model = import_node(input())
|
|
|
|
|
|
+ if (element_eq(model, read_root())):
|
|
|
+ output("Could not find model; aborting")
|
|
|
+ elif (element_neq(model["metamodel"], import_node("models/PetriNets"))):
|
|
|
+ output("Not a PetriNets model; aborting")
|
|
|
+ else:
|
|
|
+ verify_result = conformance_scd(model)
|
|
|
+ if (verify_result == "OK"):
|
|
|
+ output("Model OK!")
|
|
|
+ execute_petrinet(model)
|
|
|
+ else:
|
|
|
+ output("Non-conforming model: " + verify_result)
|
|
|
+
|
|
|
+Void function execute_petrinet(model : Element):
|
|
|
+ String cmd
|
|
|
while (True):
|
|
|
output("Which operation do you want to execute?")
|
|
|
- output("Use 'help' for a list of available options")
|
|
|
cmd = input()
|
|
|
|
|
|
if (cmd == "help"):
|
|
@@ -122,13 +135,15 @@ Void function main():
|
|
|
output(" enabled -- list the enabled transitions")
|
|
|
output(" fire -- fire a transition")
|
|
|
output(" list -- list the state of the petrinet")
|
|
|
+ output(" exit -- select another model")
|
|
|
elif (cmd == "enabled"):
|
|
|
petrinet_enabled(model)
|
|
|
elif (cmd == "fire"):
|
|
|
petrinet_fire(model)
|
|
|
elif (cmd == "list"):
|
|
|
petrinet_list(model)
|
|
|
+ elif (cmd == "exit"):
|
|
|
+ return
|
|
|
else:
|
|
|
output("Did not understand command!")
|
|
|
-
|
|
|
- return
|
|
|
+ output("Use 'help' for a list of available options")
|