|
|
@@ -62,7 +62,7 @@ def register_service():
|
|
|
|
|
|
def start_pypdevs_client(conn):
|
|
|
init('msdl.uantwerpen.be:8001')
|
|
|
- login("pypdevs_client", "my_password")
|
|
|
+ login("admin", "admin")
|
|
|
|
|
|
print("Remove ParallelDEVS simulator client")
|
|
|
try:
|
|
|
@@ -73,7 +73,7 @@ def start_pypdevs_client(conn):
|
|
|
# TODO: Make this a transformation to a trace metamodel
|
|
|
print("Add ParallelDEVS simulator client")
|
|
|
try:
|
|
|
- transformation_add_AL({}, {}, "models/paralleldevs_simulator", open("../../integration/code/pdevs_client.alc", "r").read())
|
|
|
+ transformation_add_AL({"MyString": "formalisms/MyString"}, {}, "models/paralleldevs_simulator", open("../../integration/code/pdevs_client.alc", "r").read())
|
|
|
except ModelExists:
|
|
|
pass
|
|
|
|
|
|
@@ -93,89 +93,90 @@ if __name__ == '__main__':
|
|
|
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
|
|
|
+ if "example_PS_DEVS_String" not in model_list("models"):
|
|
|
+ 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")
|
|
|
- except ModelverseException:
|
|
|
- pass
|
|
|
-
|
|
|
- # Add the metamodel for Parallel DEVS
|
|
|
- print("Add ParallelDEVS metamodel")
|
|
|
- try:
|
|
|
- model_add("formalisms/ParallelDEVS", "formalisms/SimpleClassDiagrams", open("../../models/paralleldevs_design.mvc").read())
|
|
|
- except ModelExists:
|
|
|
- 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")
|
|
|
+ except ModelverseException:
|
|
|
+ pass
|
|
|
+
|
|
|
+ # Add the metamodel for Parallel DEVS
|
|
|
+ print("Add ParallelDEVS metamodel")
|
|
|
+ try:
|
|
|
+ model_add("formalisms/ParallelDEVS", "formalisms/SimpleClassDiagrams", open("../../models/paralleldevs_design.mvc").read())
|
|
|
+ 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
|
|
|
+ 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"}, tracability_model="models/PS_DEVS_traceability")
|
|
|
+ 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"}, tracability_model="models/PS_DEVS_traceability")
|
|
|
|
|
|
- print("Remove MyString metamodel")
|
|
|
- try:
|
|
|
- model_delete("formalisms/MyString")
|
|
|
- except ModelverseException:
|
|
|
- pass
|
|
|
-
|
|
|
- # Add the metamodel for String
|
|
|
- print("Add MyString metamodel")
|
|
|
- try:
|
|
|
- model_add("formalisms/MyString", "formalisms/SimpleClassDiagrams", open("../../models/string.mvc").read())
|
|
|
- except ModelExists:
|
|
|
- pass
|
|
|
+ print("Remove MyString metamodel")
|
|
|
+ try:
|
|
|
+ model_delete("formalisms/MyString")
|
|
|
+ except ModelverseException:
|
|
|
+ pass
|
|
|
+
|
|
|
+ # Add the metamodel for String
|
|
|
+ print("Add MyString metamodel")
|
|
|
+ try:
|
|
|
+ model_add("formalisms/MyString", "formalisms/SimpleClassDiagrams", open("../../models/string.mvc").read())
|
|
|
+ except ModelExists:
|
|
|
+ pass
|
|
|
|
|
|
- # 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
|
|
|
+ # 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 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())
|
|
|
- except ModelExists:
|
|
|
- pass
|
|
|
-
|
|
|
- print("Execute DEVS->String transformation")
|
|
|
- transformation_execute_AL("models/paralleldevs_to_string", {"ParallelDEVS": "models/example_PS_DEVS"}, {"MyString": "models/example_PS_DEVS_String"})
|
|
|
+ # 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())
|
|
|
+ except ModelExists:
|
|
|
+ pass
|
|
|
+
|
|
|
+ print("Execute DEVS->String transformation")
|
|
|
+ transformation_execute_AL("models/paralleldevs_to_string", {"ParallelDEVS": "models/example_PS_DEVS"}, {"MyString": "models/example_PS_DEVS_String"})
|
|
|
|
|
|
print("Starting PyPDEVS client")
|
|
|
parent_conn, child_conn = Pipe()
|
|
|
@@ -343,4 +344,4 @@ if __name__ == '__main__':
|
|
|
|
|
|
print("Starting controller")
|
|
|
controller.start()
|
|
|
- '''
|
|
|
+ '''
|