Browse Source

Added various operations; start working on the LoLa code

Yentl Van Tendeloo 3 years ago
parent
commit
487f0ff9cd

+ 0 - 41
examples/live_modelling_CBD.py

@@ -1,41 +0,0 @@
-import sys
-sys.path.append("wrappers")
-from modelverse import *
-
-init()
-login("admin", "admin")
-
-model_add("formalisms/CBD/Design_MM", "formalisms/SimpleClassDiagrams", open("models/CBD/metamodels/CBD_MM.mvc", 'r').read())
-model_add("formalisms/CBD/PartialRuntime_MM", "formalisms/SimpleClassDiagrams", open("models/CBD/metamodels/CBD_MM_partial_runtime.mvc", 'r').read())
-model_add("formalisms/CBD/FullRuntime_MM", "formalisms/SimpleClassDiagrams", open("models/CBD/metamodels/CBD_MM_runtime.mvc", 'r').read())
-
-model_add("models/CBD_spring", "formalisms/CBD/Design_MM", open("models/CBD/models/cbd_spring.mvc", 'r').read())
-
-transformation_add_MANUAL({"Design": "formalisms/CBD/Design_MM"}, {"Design": "formalisms/CBD/Design_MM"}, "models/CBD/edit")
-
-def trace_D2P(model):
-    instantiate(model, "Association", ("Design/Block", "PartialRuntime/Block"), ID="D2P_block")
-
-transformation_add_AL({"Design": "formalisms/CBD/Design_MM", "PartialRuntime": "formalisms/CBD/PartialRuntime_MM"}, {"PartialRuntime": "formalisms/CBD/PartialRuntime_MM"}, "models/CBD/toRuntime", open("models/CBD/transformations/to_runtime.alc", 'r').read(), trace_D2P)
-
-def trace_P2F(model):
-    instantiate(model, "Association", ("PartialRuntime/Block", "FullRuntime/Block"), ID="P2F_block")
-
-transformation_add_AL({"PartialRuntime": "formalisms/CBD/PartialRuntime_MM", "FullRuntime": "formalisms/CBD/FullRuntime_MM"}, {"NewFullRuntime": "formalisms/CBD/FullRuntime_MM"}, "models/CBD/merge", open("models/CBD/transformations/merge.alc", 'r').read(), trace_P2F)
-transformation_add_AL({"FullRuntime": "formalisms/CBD/FullRuntime_MM"}, {"FullRuntime": "formalisms/CBD/FullRuntime_MM"}, "models/CBD/simulate", open("models/CBD/transformations/simulate.alc", 'r').read())
-transformation_add_AL({}, {}, "models/CBD/restartSim", open("models/generic/restart_simulation.alc", 'r').read())
-
-model_add("models/live_modelling_CBD", "formalisms/ProcessModel", open("models/CBD/PM_live_modelling.mvc", 'r').read())
-
-def modify_model(model):
-    if len(all_instances(model, "Design/ProbeBlock")) > 2:
-        import time
-        print("Sufficient Probeblocks detected, so pausing with edits")
-        while 1:
-            time.sleep(1)
-
-    new_block = instantiate(model, "Design/ProbeBlock")
-    attr_assign(model, new_block, "name", "MyProbeBlock")
-    print("Added new probeblock: " + new_block)
-
-process_execute("models/live_modelling_CBD", {"design_model": "models/CBD_spring"}, {"models/CBD/edit": modify_model})

+ 2 - 2
examples/powerwindow.py

@@ -14,7 +14,7 @@ model_add("formalisms/PW_Plant", "formalisms/SimpleClassDiagrams", open("models/
 model_add("formalisms/PW_Environment", "formalisms/SimpleClassDiagrams", open("models/PowerWindow/metamodels/environment.mvc", 'r').read())
 model_add("formalisms/PW_Control", "formalisms/SimpleClassDiagrams", open("models/PowerWindow/metamodels/control.mvc", 'r').read())
 model_add("formalisms/Requirements", "formalisms/SimpleClassDiagrams", open("models/PowerWindow/metamodels/requirements.mvc", 'r').read())
-model_add("formalisms/Query", "formalisms/SimpleClassDiagrams", open("models/PowerWindow/metamodels/query.mvc", 'r').read())
+model_add("formalisms/Query", "formalisms/SimpleClassDiagrams", open("models/SafetyQuery/metamodels/query.mvc", 'r').read())
 model_add("formalisms/Architecture", "formalisms/SimpleClassDiagrams", open("models/PowerWindow/metamodels/architecture.mvc", 'r').read())
 
 model_add("models/pm_powerwindow", "formalisms/ProcessModel", open("models/PowerWindow/PM_analyze.mvc", 'r').read())
@@ -78,7 +78,7 @@ cb_req = get_function(  "models/PowerWindow/models/requirements.mvc")
 cb_plant = get_function("models/PowerWindow/models/plant.mvc")
 cb_env = get_function(  "models/PowerWindow/models/environment.mvc")
 cb_ctrl = get_function( "models/PowerWindow/models/control.mvc")
-cb_query = get_function("models/PowerWindow/models/query.mvc")
+cb_query = get_function("models/SafetyQuery/models/query.mvc")
 cb_arch = get_function( "models/PowerWindow/models/architecture.mvc")
 
 callbacks = {

File diff suppressed because it is too large
+ 1835 - 0
models/FTGPM/transformations/to_SCCD.mvc


+ 74 - 0
models/PetriNets/models/critical_section_with_check.mvc

@@ -0,0 +1,74 @@
+Place critical_section_1 {
+    tokens = 0
+    name = "critical_section_1"
+}
+Place critical_section_2 {
+    tokens = 0
+    name = "critical_section_2"
+}
+Place lock_available {
+    tokens = 1
+    name = "lock_available"
+}
+
+Transition release_section_1 {
+    name = "release_section_1"
+}
+Transition release_section_2 {
+    name = "release_section_2"
+}
+Transition acquire_section_1 {
+    name = "acquire_section_1"
+}
+Transition acquire_section_2 {
+    name = "acquire_section_2"
+}
+
+P2T (critical_section_1, release_section_1) {
+    weight = 1
+}
+
+P2T (critical_section_2, release_section_2) {
+    weight = 1
+}
+
+P2T (lock_available, acquire_section_1) {
+    weight = 1
+}
+
+P2T (lock_available, acquire_section_2) {
+    weight = 1
+}
+
+T2P (release_section_1, lock_available) {
+    weight = 1
+}
+
+T2P (release_section_2, lock_available) {
+    weight = 1
+}
+
+T2P (acquire_section_1, critical_section_1) {
+    weight = 1
+}
+
+T2P (acquire_section_2, critical_section_2) {
+    weight = 1
+}
+
+Place check {
+    tokens = 0
+    name = "ERROR"
+}
+Transition error {
+    name = "both_enabled"
+}
+P2T (critical_section_1, error) {
+    weight = 1
+}
+P2T (critical_section_2, error) {
+    weight = 1
+}
+T2P (error, check) {
+    weight = 1
+}

models/PowerWindow/metamodels/query.mvc → models/SafetyQuery/metamodels/query.mvc


+ 4 - 0
models/SafetyQuery/models/both_criticals_enabled.mvc

@@ -0,0 +1,4 @@
+Query/Place error {
+    name = "ERROR"
+    tokens = 1
+}

models/PowerWindow/models/query.mvc → models/SafetyQuery/models/powerwindow_safe.mvc