|
|
@@ -8,6 +8,31 @@ init()
|
|
|
print("Login")
|
|
|
login("admin", "admin")
|
|
|
|
|
|
+print("Remove ProductionSystem metamodel")
|
|
|
+try:
|
|
|
+ model_delete("formalisms/ProductionSystem")
|
|
|
+except ModelverseException:
|
|
|
+ pass
|
|
|
+
|
|
|
+# Add the metamodel for ProductionSystem
|
|
|
+print("Add ProductionSystem metamodel")
|
|
|
+try:
|
|
|
+ model_add("formalisms/ProductionSystem", "formalisms/SimpleClassDiagrams", open("../../models/production_system_design.mvc").read())
|
|
|
+except ModelExists:
|
|
|
+ pass
|
|
|
+
|
|
|
+print("Remove model")
|
|
|
+try:
|
|
|
+ model_delete("models/example_PS")
|
|
|
+except ModelverseException:
|
|
|
+ pass
|
|
|
+
|
|
|
+print("Add model")
|
|
|
+try:
|
|
|
+ model_add("models/example_PS", "formalisms/ProductionSystem", open("../../models/example_PS.mvc").read())
|
|
|
+except ModelExists:
|
|
|
+ pass
|
|
|
+
|
|
|
print("Remove ParallelDEVS metamodel")
|
|
|
try:
|
|
|
model_delete("formalisms/ParallelDEVS")
|
|
|
@@ -21,6 +46,22 @@ try:
|
|
|
except ModelExists:
|
|
|
pass
|
|
|
|
|
|
+def traceability_PS2DEVS():
|
|
|
+ instantiate(None, "Association", ("ProductionSystem/Machine", "ParallelDEVS/BaseDEVSBlock"), ID="PS2DEVS_typelink")
|
|
|
+ instantiate(None, "Association", ("ProductionSystem/Machine", "ParallelDEVS/DEVSInstance"), ID="PS2DEVS_instancelink")
|
|
|
+
|
|
|
+print("Remove PS->DEVS transformation model")
|
|
|
+try:
|
|
|
+ model_delete("models/ps_to_devs")
|
|
|
+except ModelverseException:
|
|
|
+ pass
|
|
|
+
|
|
|
+print("Add PS->DEVS transformation model")
|
|
|
+transformation_add_MT({"ProductionSystem": "formalisms/ProductionSystem"}, {"ParallelDEVS": "formalisms/ParallelDEVS"}, "models/ps_to_devs", open("../../models/ps_to_devs.mvc", 'r').read(), traceability_PS2DEVS)
|
|
|
+
|
|
|
+print("Execute PS->DEVS transformation")
|
|
|
+transformation_execute_MT("models/ps_to_devs", {"ProductionSystem": "models/example_PS"}, {"ParallelDEVS": "models/example_PS_DEVS"})
|
|
|
+
|
|
|
print("Remove MyString metamodel")
|
|
|
try:
|
|
|
model_delete("formalisms/MyString")
|
|
|
@@ -33,28 +74,29 @@ try:
|
|
|
model_add("formalisms/MyString", "formalisms/SimpleClassDiagrams", open("../../models/string.mvc").read())
|
|
|
except ModelExists:
|
|
|
pass
|
|
|
-
|
|
|
-print("Remove model")
|
|
|
+
|
|
|
+"""
|
|
|
+print("Remove PDEVS model")
|
|
|
try:
|
|
|
model_delete("models/produce_consume_pdevs")
|
|
|
except ModelverseException:
|
|
|
pass
|
|
|
|
|
|
-print("Add model")
|
|
|
+print("Add PDEVS model")
|
|
|
try:
|
|
|
model_add("models/produce_consume_pdevs", "formalisms/ParallelDEVS", open("../../models/produce_consume_PDEVS.mvc").read())
|
|
|
except ModelExists:
|
|
|
pass
|
|
|
+"""
|
|
|
|
|
|
-# Remove the action language code to transform between them
|
|
|
+# Remove the action language code to transform between DEVS->String
|
|
|
print("Remove DEVS->String transformation model")
|
|
|
try:
|
|
|
model_delete("models/paralleldevs_to_string")
|
|
|
except ModelverseException:
|
|
|
pass
|
|
|
|
|
|
-# Add the action language code to transform between them
|
|
|
-# TODO: Make this a transformation to a trace metamodel
|
|
|
+# Add the action language code to transform between DEVS->String
|
|
|
print("Add DEVS->String transformation model")
|
|
|
try:
|
|
|
transformation_add_AL({"ParallelDEVS": "formalisms/ParallelDEVS"}, {"MyString": "formalisms/MyString"}, "models/paralleldevs_to_string", open("../../models/devs_to_string.alc", "r").read())
|
|
|
@@ -62,14 +104,16 @@ except ModelExists:
|
|
|
pass
|
|
|
|
|
|
print("Execute DEVS->String transformation")
|
|
|
-transformation_execute_AL("models/paralleldevs_to_string", {"ParallelDEVS": "models/produce_consume_pdevs"}, {"MyString": "models/produce_consume_string"})
|
|
|
+transformation_execute_AL("models/paralleldevs_to_string", {"ParallelDEVS": "models/example_PS_DEVS"}, {"MyString": "models/example_PS_DEVS_String"})
|
|
|
|
|
|
+'''
|
|
|
print("Remove ParallelDEVS simulator service")
|
|
|
try:
|
|
|
model_delete("models/paralleldevs_simulator")
|
|
|
except ModelverseException:
|
|
|
pass
|
|
|
|
|
|
+# TODO: Make this a transformation to a trace metamodel
|
|
|
print("Add ParallelDEVS simulator service")
|
|
|
try:
|
|
|
transformation_add_AL({"MyString": "formalisms/MyString"}, {}, "models/paralleldevs_simulator", open("../../integration/code/pdevs_client.alc", "r").read())
|
|
|
@@ -222,4 +266,5 @@ print("Starting PyPDEVS service...")
|
|
|
transformation_execute_AL("models/paralleldevs_simulator", {"MyString": "models/produce_consume_string"}, {}, statechart=(controller, "mv_input", "mv_output"))
|
|
|
|
|
|
print("Starting controller")
|
|
|
-controller.start()
|
|
|
+controller.start()
|
|
|
+'''
|