Sfoglia il codice sorgente

Change modelling language formalism grammar for non-bootstrap, just like
the construct_model functions

Yentl Van Tendeloo 8 anni fa
parent
commit
0360acb14b
49 ha cambiato i file con 3844 aggiunte e 3990 eliminazioni
  1. 1 1
      bootstrap/bootstrap.py
  2. 0 75
      bootstrap/modelling.alc
  3. 39 12
      doc/modellanguage.rst
  4. 1 5
      interface/HUTN/grammars/modelling.g
  5. 56 0
      interface/HUTN/grammars/modelling_bootstrap.g
  6. 9 28
      interface/HUTN/hutn_compiler/model_visitor.py
  7. 12 18
      interface/HUTN/test/modelling_language/code/my_petrinet.mvc
  8. 0 33
      interface/HUTN/test/modelling_language/code/my_petrinet_with_MM.mvc
  9. 10 16
      interface/HUTN/test/modelling_language/code/petrinets.mvc
  10. 20 25
      interface/HUTN/test/modelling_language/code/petrinets_constraints.mvc
  11. 16 20
      interface/HUTN/test/modelling_language/code/simpleclassdiagrams.mvc
  12. 1 1
      interface/HUTN/test/modelling_language/expected/my_petrinet
  13. 0 1
      interface/HUTN/test/modelling_language/expected/my_petrinet_with_MM
  14. 1 1
      interface/HUTN/test/modelling_language/expected/petrinets
  15. 1 1
      interface/HUTN/test/modelling_language/expected/petrinets_constraints
  16. 1 1
      interface/HUTN/test/modelling_language/expected/simpleclassdiagrams
  17. 3 7
      interface/HUTN/test/modelling_language/test_compile.py
  18. 230 232
      models/CBD_mapper.mvc
  19. 52 54
      models/MM_rendered_graphical.mvc
  20. 28 30
      models/MM_rendered_plot.mvc
  21. 17 19
      models/architecture.mvc
  22. 83 85
      models/architecture_model.mvc
  23. 394 397
      models/combine_EPN.mvc
  24. 24 26
      models/control_PW.mvc
  25. 32 34
      models/control_model.mvc
  26. 32 34
      models/control_model_wrong.mvc
  27. 796 798
      models/control_to_EPN.mvc
  28. 9 11
      models/environment_PW.mvc
  29. 21 23
      models/environment_model.mvc
  30. 117 119
      models/environment_to_EPN.mvc
  31. 3 5
      models/initialize.mvc
  32. 62 64
      models/matches.mvc
  33. 58 63
      models/my_pn.mvc
  34. 31 33
      models/petrinet_ports.mvc
  35. 14 20
      models/petrinets.mvc
  36. 14 16
      models/plant_PW.mvc
  37. 101 103
      models/plant_model.mvc
  38. 704 706
      models/plant_to_EPN.mvc
  39. 226 228
      models/pm_req_analyse.mvc
  40. 227 229
      models/pm_req_analyse_debug.mvc
  41. 7 9
      models/query.mvc
  42. 3 5
      models/query_model.mvc
  43. 51 53
      models/reachability_graph.mvc
  44. 56 58
      models/reachabilitygraph_print.mvc
  45. 21 23
      models/requirements.mvc
  46. 4 6
      models/requirements_model.mvc
  47. 10 12
      models/trace.mvc
  48. 121 123
      models/trace_example.mvc
  49. 125 127
      models/trace_mapper.mvc

+ 1 - 1
bootstrap/bootstrap.py

@@ -202,7 +202,7 @@ def bootstrap():
                     import sys
                     import sys
                     sys.path.append("interface/HUTN/")
                     sys.path.append("interface/HUTN/")
                     from hutn_compiler.compiler import main as compile_code
                     from hutn_compiler.compiler import main as compile_code
-                    model_code = compile_code(filename, "interface/HUTN/grammars/modelling.g", "MB", ["--modelname:%s" % model_name])
+                    model_code = compile_code(filename, "interface/HUTN/grammars/modelling_bootstrap.g", "MB", ["--modelname:%s" % model_name])
                     return model_code + "\n"
                     return model_code + "\n"
 
 
                 # Compile all model definitions to ALC directly
                 # Compile all model definitions to ALC directly

+ 0 - 75
bootstrap/modelling.alc

@@ -558,62 +558,6 @@ String function add_AL(model : Element, element : Element):
 
 
 	return reverseKeyLookup(model["model"], element)!
 	return reverseKeyLookup(model["model"], element)!
 
 
-Void function construct_model():
-	String command
-
-	while (True):
-		command = input()
-		if (command == "instantiate_bottom"):
-			Element m
-			m = instantiate_bottom()
-			dict_add_fast(global_models, input(), m)
-		elif (command == "add_node"):
-			model_add_node(global_models[input()], input())
-		elif (command == "add_value"):
-			model_add_value(global_models[input()], input(), input())
-		elif (command == "add_edge"):
-			model_add_edge(global_models[input()], input(), input(), input())
-		elif (command == "exit"):
-			return!
-		elif (command == "retype_model"):
-			retype_model(global_models[input()], global_models[input()])
-		elif (command == "retype"):
-			retype(global_models[input()], input(), input())
-		elif (command == "instantiate_model"):
-			Element m
-			m = instantiate_model(global_models[input()])
-			dict_add_fast(global_models, input(), m)
-		elif (command == "instantiate_node"):
-			instantiate_node(global_models[input()], input(), input())
-		elif (command == "instantiate_attribute"):
-			instantiate_attribute(global_models[input()], input(), input(), input())
-		elif (command == "instantiate_attribute_ref"):
-			instantiate_attribute_ref(global_models[input()], input(), input(), input())
-		elif (command == "instantiate_attribute_code"):
-			instantiate_attribute_code(global_models[input()], input(), input(), construct_function())
-		elif (command == "instantiate_link"):
-			instantiate_link(global_models[input()], input(), input(), input(), input())
-		elif (command == "model_define_attribute"):
-			model_define_attribute(global_models[input()], input(), input(), input(), input())
-		elif (command == "export_node"):
-			String local_name
-			String location
-			local_name = input()
-			location = input()
-			export_node(location, global_models[local_name])
-		elif (command == "import_node"):
-			Element m
-			command = input()
-			m = import_node(command)
-			if (element_eq(m, read_root())):
-				log("Error: import not found for " + command)
-			else:
-				dict_add_fast(global_models, input(), m)
-		elif (command == "add_code_model"):
-			add_code_model(global_models[input()], input(), construct_function())
-		else:
-			log("Modelling error: did not understand command " + command)
-
 Element function construct_model_raw(metamodel : Element):
 Element function construct_model_raw(metamodel : Element):
 	String command
 	String command
 	Element model
 	Element model
@@ -623,45 +567,26 @@ Element function construct_model_raw(metamodel : Element):
 	while (True):
 	while (True):
 		command = input()
 		command = input()
 		if (command == "add_node"):
 		if (command == "add_node"):
-			input()
 			model_add_node(model, input())
 			model_add_node(model, input())
 		elif (command == "add_value"):
 		elif (command == "add_value"):
-			input()
 			model_add_value(model, input(), input())
 			model_add_value(model, input(), input())
 		elif (command == "add_edge"):
 		elif (command == "add_edge"):
-			input()
 			model_add_edge(model, input(), input(), input())
 			model_add_edge(model, input(), input(), input())
 		elif (command == "exit"):
 		elif (command == "exit"):
 			return model!
 			return model!
 		elif (command == "instantiate_node"):
 		elif (command == "instantiate_node"):
-			input()
 			instantiate_node(model, input(), input())
 			instantiate_node(model, input(), input())
 		elif (command == "model_define_attribute"):
 		elif (command == "model_define_attribute"):
-			input()
 			model_define_attribute(model, input(), input(), input(), input())
 			model_define_attribute(model, input(), input(), input(), input())
 		elif (command == "instantiate_attribute"):
 		elif (command == "instantiate_attribute"):
-			input()
 			instantiate_attribute(model, input(), input(), input())
 			instantiate_attribute(model, input(), input(), input())
 		elif (command == "instantiate_attribute_ref"):
 		elif (command == "instantiate_attribute_ref"):
-			input()
 			instantiate_attribute_ref(model, input(), input(), input())
 			instantiate_attribute_ref(model, input(), input(), input())
 		elif (command == "instantiate_attribute_code"):
 		elif (command == "instantiate_attribute_code"):
-			input()
 			instantiate_attribute_code(model, input(), input(), construct_function())
 			instantiate_attribute_code(model, input(), input(), construct_function())
 		elif (command == "instantiate_link"):
 		elif (command == "instantiate_link"):
-			input()
 			instantiate_link(model, input(), input(), input(), input())
 			instantiate_link(model, input(), input(), input(), input())
-		elif (command == "import_node"):
-			input()
-			input()
-		elif (command == "export_node"):
-			input()
-			input()
-		elif (command == "instantiate_model"):
-			input()
-			input()
 		elif (command == "add_code_model"):
 		elif (command == "add_code_model"):
-			input()
 			add_code_model(model, input(), construct_function())
 			add_code_model(model, input(), construct_function())
 		else:
 		else:
 			log("Modelling error: did not understand command " + command)
 			log("Modelling error: did not understand command " + command)

+ 39 - 12
doc/modellanguage.rst

@@ -4,7 +4,7 @@ Modelling Language
 Apart from the action language, the Modelverse also has a modelling language.
 Apart from the action language, the Modelverse also has a modelling language.
 With this language, models (*i.e.*, data) can be defined in addition to the algorithms.
 With this language, models (*i.e.*, data) can be defined in addition to the algorithms.
 
 
-This language is still mostly work in progress, but should be decent enough to construct simple metamodels and instantiate them.
+This language is still work in progress, but should be decent enough to construct simple metamodels and instantiate them.
 All models have the extension \*.mvc, indicating that they are models and should be compiled as such.
 All models have the extension \*.mvc, indicating that they are models and should be compiled as such.
 
 
 If you want to create models interactively, such as with another tool, it is strongly recommended to use the interactive interface to do this, as the modelling language is completely static.
 If you want to create models interactively, such as with another tool, it is strongly recommended to use the interactive interface to do this, as the modelling language is completely static.
@@ -16,21 +16,14 @@ The modelling language defines data structures, which will be formed as models i
 
 
 Several constructs are supported.
 Several constructs are supported.
 
 
-Import
-^^^^^^
-
-An import pulls in a model and makes it accessible using a simpler identifier.
-The structure is as follows::
-
-    import path/in/modelverse as my_model
-
-After this import, the model that was previously exported to *path/in/modelverse* becomes available as *my_model*.
-
 Include
 Include
 ^^^^^^^
 ^^^^^^^
 
 
-When combined with action language, the action language might require some includes of header files.
+When combined with action language, for example with code fragments, the action language might require some includes of header files.
 To do this, the includes can be placed at the top of the hierarchy.
 To do this, the includes can be placed at the top of the hierarchy.
+The structure is as follows::
+
+        include "primitives.alh"
 
 
 Model
 Model
 ^^^^^
 ^^^^^
@@ -38,6 +31,15 @@ Model
 Every model is defined by first specifying the type of model to instantiate, followed by the name of the model to create.
 Every model is defined by first specifying the type of model to instantiate, followed by the name of the model to create.
 The name of the model can then later on be referenced in other models (as type, or for exporting).
 The name of the model can then later on be referenced in other models (as type, or for exporting).
 Within the model, all names of the type model can be used as types again.
 Within the model, all names of the type model can be used as types again.
+This is only used internally for bootstrapping purposes, so feel free to write whatever you want here.
+
+The structure is as follows::
+
+        SimpleClassDiagrams PetriNets{
+                ...
+        }
+
+All further operations happen inside such a definition.
 
 
 Instance
 Instance
 ^^^^^^^^
 ^^^^^^^^
@@ -45,6 +47,14 @@ Instance
 A model consists of some instances.
 A model consists of some instances.
 These instances are instances of types specified by the model that is the metaclass of the current model.
 These instances are instances of types specified by the model that is the metaclass of the current model.
 
 
+The structure is as follows::
+
+        SimpleClassDiagrams PetriNets {
+                Class Place {
+                        ...
+                }
+        }
+
 Attribute
 Attribute
 ^^^^^^^^^
 ^^^^^^^^^
 
 
@@ -180,3 +190,20 @@ Use in interactive interface
 
 
 The interactive interface, such as the *prompt.py* script, can also invoke the model compiler.
 The interactive interface, such as the *prompt.py* script, can also invoke the model compiler.
 In this case, however, the import, export, and model type and model name parameters are ignored as they have to be defined and checked in the bigger context of the MvC.
 In this case, however, the import, export, and model type and model name parameters are ignored as they have to be defined and checked in the bigger context of the MvC.
+
+Internal use only
+-----------------
+
+Some constructs only make sense in the context of the bootstrap generation.
+These constructs can still be used at all times, but are meaningless.
+
+Import
+^^^^^^
+
+An import pulls in a model and makes it accessible using a simpler identifier.
+The structure is as follows::
+
+    import path/in/modelverse as my_model
+
+After this import, the model that was previously exported to *path/in/modelverse* becomes available as *my_model*.
+

+ 1 - 5
interface/HUTN/grammars/modelling.g

@@ -1,12 +1,8 @@
 grammar{
 grammar{
-    start: (import | export | include_files | model | NEWLINE)+;
+    start: (include_files | model_element | NEWLINE)*;
 
 
-    import: IMPORT MV_URL AS MODEL_ID;
-    export: EXPORT MODEL_ID TO MV_URL;
     include_files: INCLUDE STRVALUE NEWLINE;
     include_files: INCLUDE STRVALUE NEWLINE;
 
 
-    model: MODEL_ID MODEL_ID NEWLINE? LCURLY NEWLINE? (model_element)* RCURLY;
-
     model_element: MODEL_ID MODEL_ID? inheritance? (LPAR MODEL_ID COMMA MODEL_ID RPAR)? NEWLINE? LCURLY NEWLINE? (model_attribute)* RCURLY NEWLINE?;
     model_element: MODEL_ID MODEL_ID? inheritance? (LPAR MODEL_ID COMMA MODEL_ID RPAR)? NEWLINE? LCURLY NEWLINE? (model_attribute)* RCURLY NEWLINE?;
 
 
     inheritance: COLON MODEL_ID (COMMA MODEL_ID)*;
     inheritance: COLON MODEL_ID (COMMA MODEL_ID)*;

+ 56 - 0
interface/HUTN/grammars/modelling_bootstrap.g

@@ -0,0 +1,56 @@
+grammar{
+    start: (import | export | include_files | model | NEWLINE)*;
+
+    import: IMPORT MV_URL AS MODEL_ID;
+    export: EXPORT MODEL_ID TO MV_URL;
+    include_files: INCLUDE STRVALUE NEWLINE;
+
+    model: MODEL_ID MODEL_ID NEWLINE? LCURLY NEWLINE? (model_element)* RCURLY;
+
+    model_element: MODEL_ID MODEL_ID? inheritance? (LPAR MODEL_ID COMMA MODEL_ID RPAR)? NEWLINE? LCURLY NEWLINE? (model_attribute)* RCURLY NEWLINE?;
+
+    inheritance: COLON MODEL_ID (COMMA MODEL_ID)*;
+
+    model_attribute : ((LCURLY MODEL_ID RCURLY)? model_element)
+                    | (MODEL_ID OPTIONAL? COLON MODEL_ID (LCURLY NEWLINE? model_attr_instance* RCURLY)? NEWLINE?)
+                    | (model_attr_instance);
+
+    model_attr_instance: (MODEL_ID ASSIGN value NEWLINE?)
+                       | (MODEL_ID ASSIGN NEWLINE? DOLLAR ANYTHING_EXCEPT_DOLLAR DOLLAR NEWLINE?);
+
+    value
+        : DEC_NUMBER
+        | FLOAT_NUMBER
+        | TRUE
+        | FALSE
+        | STRVALUE;
+
+    tokens{
+        IMPORT: 'import';
+        OPTIONAL: '\?';
+        AS: 'as';
+        MODEL_ID: '[a-zA-Z_][a-zA-Z_0-9/]*';
+        MV_URL: '[a-zA-Z_0-9/]*';
+        LCURLY: '{';
+        RCURLY: '}';
+        NEWLINE: '(\r?\n)+';
+        DEC_NUMBER: '[+-]?(0|[1-9]\d*[lL]?)';
+        FLOAT_NUMBER: '[+-]?((\d+\.\d*|\.\d+)([eE][-+]?\d+)?|\d+[eE][-+]?\d+)';
+        STRVALUE: 'u?r?("(?!"").*?(?<!\\)(\\\\)*?"|\'(?!\'\').*?(?<!\\)(\\\\)*?\')';
+        TRUE: 'True';
+        FALSE: 'False';
+        ASSIGN: '=';
+        DOLLAR: '\$';
+        WS: '[ ]+' @Impl;
+        TAB: '[\t]+' @Impl;
+        COLON : ':';
+        LPAR: '\(';
+        RPAR: '\)';
+        COMMA: ',';
+        EXPORT: 'export';
+        TO: 'to';
+        ANYTHING_EXCEPT_DOLLAR: '[^$]*';
+        INCLUDE: 'include';
+        EXCLAMATION: '!';
+    }
+}

+ 9 - 28
interface/HUTN/hutn_compiler/model_visitor.py

@@ -11,7 +11,6 @@ class ModelVisitor(Visitor):
         self.constructors = []
         self.constructors = []
         self.free_id = 0
         self.free_id = 0
         self.names = set()
         self.names = set()
-        self.current_model = None
         self.current_element = []
         self.current_element = []
         self.includes = []
         self.includes = []
 
 
@@ -31,26 +30,6 @@ class ModelVisitor(Visitor):
     def visit_include_files(self, tree):
     def visit_include_files(self, tree):
         self.includes.append('include %s' % tree.get_children("STRVALUE")[0].get_text())
         self.includes.append('include %s' % tree.get_children("STRVALUE")[0].get_text())
 
 
-    def visit_import(self, tree):
-        url = tree.get_children("MV_URL")[0]
-        target = tree.get_children("MODEL_ID")[0]
-        self.constructors.extend(["import_node", url.get_text(), target.get_text()])
-
-    def visit_export(self, tree):
-        url = tree.get_children("MV_URL")[0]
-        target = tree.get_children("MODEL_ID")[0]
-        self.constructors.extend(["export_node", target.get_text(), url.get_text()])
-
-    def visit_model(self, tree):
-        children = tree.get_children("MODEL_ID")
-        model_type = children[0].get_text()
-        model_name = children[-1].get_text()
-        self.constructors.extend(["instantiate_model", model_type, model_name])
-        self.current_model = model_name
-        self.names = set()
-        for element in tree.get_children("model_element"):
-            self.visit(element)
-
     def visit_model_element(self, tree):
     def visit_model_element(self, tree):
         children = tree.get_children("MODEL_ID")
         children = tree.get_children("MODEL_ID")
         element_type = children[0].get_text()
         element_type = children[0].get_text()
@@ -72,9 +51,9 @@ class ModelVisitor(Visitor):
             if target_name not in self.names:
             if target_name not in self.names:
                 raise Exception("Target of link %s unknown: %s" % (element_name, target_name))
                 raise Exception("Target of link %s unknown: %s" % (element_name, target_name))
 
 
-            self.constructors.extend(["instantiate_link", self.current_model, element_type, element_name, source_name, target_name])
+            self.constructors.extend(["instantiate_link", element_type, element_name, source_name, target_name])
         else:
         else:
-            self.constructors.extend(["instantiate_node", self.current_model, element_type, element_name])
+            self.constructors.extend(["instantiate_node", element_type, element_name])
 
 
         self.names.add(element_name)
         self.names.add(element_name)
         self.current_element.append(element_name)
         self.current_element.append(element_name)
@@ -95,7 +74,7 @@ class ModelVisitor(Visitor):
             if superclass not in self.names:
             if superclass not in self.names:
                 raise Exception("Superclass %s is undefined" % superclass)
                 raise Exception("Superclass %s is undefined" % superclass)
 
 
-            self.constructors.extend(["instantiate_link", self.current_model, "Inheritance", "%s_inherits_from_%s" % (self.current_element[-1], superclass), self.current_element[-1], superclass])
+            self.constructors.extend(["instantiate_link", "Inheritance", "%s_inherits_from_%s" % (self.current_element[-1], superclass), self.current_element[-1], superclass])
             self.names.add("%s_inherits_from_%s" % (self.current_element[-1], superclass))
             self.names.add("%s_inherits_from_%s" % (self.current_element[-1], superclass))
 
 
     def visit_model_attribute(self, tree):
     def visit_model_attribute(self, tree):
@@ -108,7 +87,9 @@ class ModelVisitor(Visitor):
             attr_name = children[0].get_text()
             attr_name = children[0].get_text()
             attr_optional = len(tree.get_children("OPTIONAL")) > 0
             attr_optional = len(tree.get_children("OPTIONAL")) > 0
             attr_type = children[1].get_text()
             attr_type = children[1].get_text()
-            self.constructors.extend(["model_define_attribute", self.current_model, self.current_element[-1], attr_name, attr_optional, attr_type])
+            if attr_type not in self.names:
+                raise Exception("Unknown Attribute type!")
+            self.constructors.extend(["model_define_attribute", self.current_element[-1], attr_name, attr_optional, attr_type])
             full_attribute_name = self.current_element[-1] + "_" + attr_name
             full_attribute_name = self.current_element[-1] + "_" + attr_name
 
 
             if is_assign:
             if is_assign:
@@ -127,7 +108,7 @@ class ModelVisitor(Visitor):
             else:
             else:
                 contains_link = ""
                 contains_link = ""
             entry = self.visit(tree.get_children("model_element")[0])
             entry = self.visit(tree.get_children("model_element")[0])
-            self.constructors.extend(["instantiate_link", self.current_model, contains_link, "__%s" % self.free_id, self.current_element[-1], entry])
+            self.constructors.extend(["instantiate_link", contains_link, "__%s" % self.free_id, self.current_element[-1], entry])
             self.names.add("__%s" % self.free_id)
             self.names.add("__%s" % self.free_id)
             self.free_id += 1
             self.free_id += 1
 
 
@@ -165,8 +146,8 @@ class ModelVisitor(Visitor):
                 attr_value = float(attr_value.get_text())
                 attr_value = float(attr_value.get_text())
             else:
             else:
                 raise Exception(attr_value.head)
                 raise Exception(attr_value.head)
-            self.constructors.extend(["instantiate_attribute", self.current_model, self.current_element[-1], attr_name, attr_value])
+            self.constructors.extend(["instantiate_attribute", self.current_element[-1], attr_name, attr_value])
         elif tree.get_children("DOLLAR"):
         elif tree.get_children("DOLLAR"):
             # Coded attribute
             # Coded attribute
-            self.constructors.extend(["instantiate_attribute_code", self.current_model, self.current_element[-1], attr_name])
+            self.constructors.extend(["instantiate_attribute_code", self.current_element[-1], attr_name])
             self.constructors.extend(constructors_compile(tree.get_children("ANYTHING_EXCEPT_DOLLAR")[0].get_text()))
             self.constructors.extend(constructors_compile(tree.get_children("ANYTHING_EXCEPT_DOLLAR")[0].get_text()))

+ 12 - 18
interface/HUTN/test/modelling_language/code/my_petrinet.mvc

@@ -1,19 +1,13 @@
-import models/PetriNets as PetriNets
-
-PetriNets my_petrinet {
-    Place p1 {
-        tokens = 1
-    }
-    Place p2 {
-        tokens = 3
-    }
-    Transition t1 {}
-    P2T (p1, t1) {
-        weight = 1
-    }
-    T2P (t1, p2) {
-        weight = 2
-    }
+Place p1 {
+	tokens = 1
+}
+Place p2 {
+	tokens = 3
+}
+Transition t1 {}
+P2T (p1, t1) {
+	weight = 1
+}
+T2P (t1, p2) {
+	weight = 2
 }
 }
-
-export my_petrinet to models/my_petrinet

+ 0 - 33
interface/HUTN/test/modelling_language/code/my_petrinet_with_MM.mvc

@@ -1,33 +0,0 @@
-import models/SimpleClassDiagrams as SCD
-
-SCD PetriNets{
-    SimpleAttribute Natural {}
-    Class Place{
-        tokens : Natural
-    }
-    Class Transition{}
-    Association P2T (Place, Transition) {
-        weight : Natural
-    }
-    Association T2P (Transition, Place) {
-        weight : Natural
-    }
-}
-
-PetriNets my_petrinet {
-    Place p1 {
-        tokens = 1
-    }
-    Place p2 {
-        tokens = 3
-    }
-    Transition t1 {}
-    P2T (p1, t1) {
-        weight = 1
-    }
-    T2P (t1, p2) {
-        weight = 2
-    }
-}
-
-export my_petrinet to models/my_petrinet

+ 10 - 16
interface/HUTN/test/modelling_language/code/petrinets.mvc

@@ -1,17 +1,11 @@
-import models/SimpleClassDiagrams as SCD
-
-SCD PetriNets{
-    SimpleAttribute Natural {}
-    Class Place{
-        tokens : Natural
-    }
-    Class Transition{}
-    Association P2T (Place, Transition) {
-        weight : Natural
-    }
-    Association T2P (Transition, Place) {
-        weight : Natural
-    }
+SimpleAttribute Natural {}
+Class Place{
+	tokens : Natural
+}
+Class Transition{}
+Association P2T (Place, Transition) {
+	weight : Natural
+}
+Association T2P (Transition, Place) {
+	weight : Natural
 }
 }
-
-export PetriNets to models/PetriNets

+ 20 - 25
interface/HUTN/test/modelling_language/code/petrinets_constraints.mvc

@@ -1,28 +1,23 @@
-import models/SimpleClassDiagrams as SCD
 include "primitives.alh"
 include "primitives.alh"
 
 
-SCD PetriNets{
-    SimpleAttribute Natural {
-        constraint = $
-            String function constraint(model : Element, name : String):
-                if (bool_not(is_physical_int(model["model"][name]))):
-                    return "Natural has no integer value"!
-                elif (integer_lt(model["model"][name], 0)):
-                    return "Natural does not have a positive or zero value"!
-                else:
-                    return "OK"!
-            $
-    }
-    Class Place{
-        tokens : Natural
-    }
-    Class Transition{}
-    Association P2T (Place, Transition) {
-        weight : Natural
-    }
-    Association T2P (Transition, Place) {
-        weight : Natural
-    }
+SimpleAttribute Natural {
+	constraint = $
+		String function constraint(model : Element, name : String):
+			if (bool_not(is_physical_int(model["model"][name]))):
+				return "Natural has no integer value"!
+			elif (integer_lt(model["model"][name], 0)):
+				return "Natural does not have a positive or zero value"!
+			else:
+				return "OK"!
+		$
+}
+Class Place{
+	tokens : Natural
+}
+Class Transition{}
+Association P2T (Place, Transition) {
+	weight : Natural
+}
+Association T2P (Transition, Place) {
+	weight : Natural
 }
 }
-
-export PetriNets to models/PetriNets

+ 16 - 20
interface/HUTN/test/modelling_language/code/simpleclassdiagrams.mvc

@@ -1,21 +1,17 @@
-import /formalisms/SimpleClassDiagrams as SCD
-
-SCD SimpleClassDiagrams{
-    Class Any {}
-    SimpleAttribute Natural {}
-    SimpleAttribute String {}
-    Class Class{
-        lower_cardinality : Natural
-        upper_cardinality : Natural
-    }
-    Association Association (Class, Class){
-        name : String
-        source_lower_cardinality : Natural
-        source_upper_cardinality : Natural
-        target_lower_cardinality : Natural
-        target_upper_cardinality : Natural
-    }
-    Association Inheritance (Class, Class){}
-    Inheritance assoc_inh_class (Association, Class) {}
-    Inheritance class_inh_any (Class, Any) {}
+Class Any {}
+SimpleAttribute Natural {}
+SimpleAttribute String {}
+Class Class{
+    lower_cardinality : Natural
+    upper_cardinality : Natural
 }
 }
+Association Association (Class, Class){
+    name : String
+    source_lower_cardinality : Natural
+    source_upper_cardinality : Natural
+    target_lower_cardinality : Natural
+    target_upper_cardinality : Natural
+}
+Association Inheritance (Class, Class){}
+Inheritance assoc_inh_class (Association, Class) {}
+Inheritance class_inh_any (Class, Any) {}

File diff suppressed because it is too large
+ 1 - 1
interface/HUTN/test/modelling_language/expected/my_petrinet


File diff suppressed because it is too large
+ 0 - 1
interface/HUTN/test/modelling_language/expected/my_petrinet_with_MM


File diff suppressed because it is too large
+ 1 - 1
interface/HUTN/test/modelling_language/expected/petrinets


File diff suppressed because it is too large
+ 1 - 1
interface/HUTN/test/modelling_language/expected/petrinets_constraints


File diff suppressed because it is too large
+ 1 - 1
interface/HUTN/test/modelling_language/expected/simpleclassdiagrams


+ 3 - 7
interface/HUTN/test/modelling_language/test_compile.py

@@ -9,9 +9,9 @@ def compile_file(obj, filename):
     try:
     try:
         expected = json.loads(open(util.get_expected_path(filename)).read())
         expected = json.loads(open(util.get_expected_path(filename)).read())
     except:
     except:
-        #f = open(util.get_expected_path(filename), 'w')
-        #f.write(json.dumps(result))
-        #f.close()
+        f = open(util.get_expected_path(filename), 'w')
+        f.write(json.dumps(result))
+        f.close()
         pass
         pass
     assert result == expected
     assert result == expected
 
 
@@ -25,9 +25,5 @@ class TestCompile(unittest.TestCase):
     def test_SimpleClassDiagrams(self):
     def test_SimpleClassDiagrams(self):
         compile_file(self, "simpleclassdiagrams.mvc")
         compile_file(self, "simpleclassdiagrams.mvc")
 
 
-    def test_PetriNetsBoth(self):
-        compile_file(self, "my_petrinet_with_MM.mvc")
-
     def test_PetriNets_constraints(self):
     def test_PetriNets_constraints(self):
         compile_file(self, "petrinets_constraints.mvc")
         compile_file(self, "petrinets_constraints.mvc")
-

+ 230 - 232
models/CBD_mapper.mvc

@@ -2,246 +2,244 @@ include "primitives.alh"
 include "modelling.alh"
 include "modelling.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
-A B {
-    Composite schedule {
-        {Contains} Success success {}
-
-        {Contains} ForAll render_blocks {
-            LHS {
-                Pre_CausalBlockDiagrams/Block pre_block_0 {
-                    label = "0"
-                }
-
-                constraint = $
-                    Boolean function constraint(model : Element, mapping : Element):
-                        Element trace_links
-                        trace_links = allOutgoingAssociationInstances(model, mapping["0"], "TracabilityGraphical")
-                        log("Found tracability links: " + cast_v2s(read_nr_out(trace_links)))
-                        if (read_nr_out(trace_links) > 0):
-                            log("Block already connected; ignoring!")
-                            return False!
+Composite schedule {
+    {Contains} Success success {}
+
+    {Contains} ForAll render_blocks {
+        LHS {
+            Pre_CausalBlockDiagrams/Block pre_block_0 {
+                label = "0"
+            }
+
+            constraint = $
+                Boolean function constraint(model : Element, mapping : Element):
+                    Element trace_links
+                    trace_links = allOutgoingAssociationInstances(model, mapping["0"], "TracabilityGraphical")
+                    log("Found tracability links: " + cast_v2s(read_nr_out(trace_links)))
+                    if (read_nr_out(trace_links) > 0):
+                        log("Block already connected; ignoring!")
+                        return False!
+                    else:
+                        return True!
+                $
+        }
+        RHS {
+            Post_CausalBlockDiagrams/Block post_block_0 {
+                label = "0"
+            }
+            Post_MM_rendered_graphical/Group post_block_1 {
+                label = "1"
+                value___asid = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return mapping["0"]!
+                    $
+                value_x = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 0!
+                    $
+                value_y = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 0!
+                    $
+            }
+            Post_MM_rendered_graphical/Rectangle post_block_2 {
+                label = "2"
+                value_x = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 0!
+                    $
+                value_y = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 0!
+                    $
+                value_width = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 30!
+                    $
+                value_height = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 30!
+                    $
+                value_lineWidth = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 2!
+                    $
+                value_lineColour = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "black"!
+                    $
+                value_fillColour = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "white"!
+                    $
+            }
+            Post_MM_rendered_graphical/Text post_block_3 {
+                label = "3"
+                value_x = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 10!
+                    $
+                value_y = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 10!
+                    $
+                value_lineWidth = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 1!
+                    $
+                value_lineColour = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "black"!
+                    $
+                value_text = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        String type
+                        type = read_type(model, mapping["0"])
+                        if (type == "CausalBlockDiagrams/AdditionBlock"):
+                            return "+"!
+                        elif (type == "CausalBlockDiagrams/NegatorBlock"):
+                            return "-"!
+                        elif (type == "CausalBlockDiagrams/ConstantBlock"):
+                            return "c"!
+                        elif (type == "CausalBlockDiagrams/MultiplyBlock"):
+                            return "*"!
+                        elif (type == "CausalBlockDiagrams/InverseBlock"):
+                            return "/"!
+                        elif (type == "CausalBlockDiagrams/DerivatorBlock"):
+                            return "d/dx"!
+                        elif (type == "CausalBlockDiagrams/IntegratorBlock"):
+                            return "1/s"!
+                        elif (type == "CausalBlockDiagrams/DelayBlock"):
+                            return "DELAY"!
+                        elif (type == "CausalBlockDiagrams/ProbeBlock"):
+                            return "PROBE"!
                         else:
                         else:
-                            return True!
-                    $
-            }
-            RHS {
-                Post_CausalBlockDiagrams/Block post_block_0 {
-                    label = "0"
-                }
-                Post_MM_rendered_graphical/Group post_block_1 {
-                    label = "1"
-                    value___asid = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return mapping["0"]!
-                        $
-                    value_x = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 0!
-                        $
-                    value_y = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 0!
-                        $
-                }
-                Post_MM_rendered_graphical/Rectangle post_block_2 {
-                    label = "2"
-                    value_x = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 0!
-                        $
-                    value_y = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 0!
-                        $
-                    value_width = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 30!
-                        $
-                    value_height = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 30!
-                        $
-                    value_lineWidth = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 2!
-                        $
-                    value_lineColour = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "black"!
-                        $
-                    value_fillColour = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "white"!
-                        $
-                }
-                Post_MM_rendered_graphical/Text post_block_3 {
-                    label = "3"
-                    value_x = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 10!
-                        $
-                    value_y = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 10!
-                        $
-                    value_lineWidth = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 1!
-                        $
-                    value_lineColour = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "black"!
-                        $
-                    value_text = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            String type
-                            type = read_type(model, mapping["0"])
-                            if (type == "CausalBlockDiagrams/AdditionBlock"):
-                                return "+"!
-                            elif (type == "CausalBlockDiagrams/NegatorBlock"):
-                                return "-"!
-                            elif (type == "CausalBlockDiagrams/ConstantBlock"):
-                                return "c"!
-                            elif (type == "CausalBlockDiagrams/MultiplyBlock"):
-                                return "*"!
-                            elif (type == "CausalBlockDiagrams/InverseBlock"):
-                                return "/"!
-                            elif (type == "CausalBlockDiagrams/DerivatorBlock"):
-                                return "d/dx"!
-                            elif (type == "CausalBlockDiagrams/IntegratorBlock"):
-                                return "1/s"!
-                            elif (type == "CausalBlockDiagrams/DelayBlock"):
-                                return "DELAY"!
-                            elif (type == "CausalBlockDiagrams/ProbeBlock"):
-                                return "PROBE"!
-                            else:
-                                return ("Unknown type: " + type)!
-                        $
-                }
-                Post_MM_rendered_graphical/contains (post_block_1, post_block_2) {
-                    label = "4"
-                }
-                Post_MM_rendered_graphical/contains (post_block_1, post_block_3) {
-                    label = "5"
-                }
-
-                Post_TracabilityGraphical (post_block_0, post_block_1) {
-                    label = "6"
-                }
+                            return ("Unknown type: " + type)!
+                    $
+            }
+            Post_MM_rendered_graphical/contains (post_block_1, post_block_2) {
+                label = "4"
+            }
+            Post_MM_rendered_graphical/contains (post_block_1, post_block_3) {
+                label = "5"
+            }
+
+            Post_TracabilityGraphical (post_block_0, post_block_1) {
+                label = "6"
+            }
+        }
+    }
+
+    {Contains} ForAll render_connections {
+        LHS {
+            Pre_CausalBlockDiagrams/Block pre_conn_0 {
+                label = "0"
+            }
+
+            Pre_CausalBlockDiagrams/Block pre_conn_1 {
+                label = "1"
+            }
+
+            Pre_CausalBlockDiagrams/Link (pre_conn_0, pre_conn_1){
+                label = "2"
+            }
+
+            Pre_MM_rendered_graphical/Group pre_conn_3 {
+                label = "3"
+            }
+
+            Pre_MM_rendered_graphical/Group pre_conn_4 {
+                label = "4"
+            }
+
+            Pre_TracabilityGraphical (pre_conn_0, pre_conn_3) {
+                label = "5"
             }
             }
+            Pre_TracabilityGraphical (pre_conn_1, pre_conn_4) {
+                label = "6"
+            }
+
+            constraint = $
+                Boolean function constraint(model : Element, mapping : Element):
+                    Element trace_links
+                    trace_links = allOutgoingAssociationInstances(model, mapping["2"], "TracabilityGraphical")
+                    if (read_nr_out(trace_links) > 0):
+                        log("Block already connected; ignoring!")
+                        return False!
+                    else:
+                        return True!
+                $
         }
         }
+        RHS {
+            Post_CausalBlockDiagrams/Block post_conn_0 {
+                label = "0"
+            }
+
+            Post_CausalBlockDiagrams/Block post_conn_1 {
+                label = "1"
+            }
+
+            Post_CausalBlockDiagrams/Link (post_conn_0, post_conn_1){
+                label = "2"
+            }
 
 
-        {Contains} ForAll render_connections {
-            LHS {
-                Pre_CausalBlockDiagrams/Block pre_conn_0 {
-                    label = "0"
-                }
-
-                Pre_CausalBlockDiagrams/Block pre_conn_1 {
-                    label = "1"
-                }
-
-                Pre_CausalBlockDiagrams/Link (pre_conn_0, pre_conn_1){
-                    label = "2"
-                }
-
-                Pre_MM_rendered_graphical/Group pre_conn_3 {
-                    label = "3"
-                }
-
-                Pre_MM_rendered_graphical/Group pre_conn_4 {
-                    label = "4"
-                }
-
-                Pre_TracabilityGraphical (pre_conn_0, pre_conn_3) {
-                    label = "5"
-                }
-                Pre_TracabilityGraphical (pre_conn_1, pre_conn_4) {
-                    label = "6"
-                }
-
-                constraint = $
-                    Boolean function constraint(model : Element, mapping : Element):
-                        Element trace_links
-                        trace_links = allOutgoingAssociationInstances(model, mapping["2"], "TracabilityGraphical")
-                        if (read_nr_out(trace_links) > 0):
-                            log("Block already connected; ignoring!")
-                            return False!
+            Post_MM_rendered_graphical/Group post_conn_3 {
+                label = "3"
+            }
+
+            Post_MM_rendered_graphical/Group post_conn_4 {
+                label = "4"
+            }
+
+            Post_TracabilityGraphical (post_conn_0, post_conn_3) {
+                label = "5"
+            }
+            Post_TracabilityGraphical (post_conn_1, post_conn_4) {
+                label = "6"
+            }
+
+            Post_MM_rendered_graphical/Line {
+                label = "7"
+                value___asid = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return mapping["2"]!
+                    $
+                value_x = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["3"], "x")!
+                    $
+                value_y = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["3"], "y")!
+                    $
+                value_lineWidth = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return 1!
+                    $
+                value_lineColour = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        if (read_type(model, name) == "ICLink"):
+                            return "red"!
                         else:
                         else:
-                            return True!
-                    $
-            }
-            RHS {
-                Post_CausalBlockDiagrams/Block post_conn_0 {
-                    label = "0"
-                }
-
-                Post_CausalBlockDiagrams/Block post_conn_1 {
-                    label = "1"
-                }
-
-                Post_CausalBlockDiagrams/Link (post_conn_0, post_conn_1){
-                    label = "2"
-                }
-
-                Post_MM_rendered_graphical/Group post_conn_3 {
-                    label = "3"
-                }
-
-                Post_MM_rendered_graphical/Group post_conn_4 {
-                    label = "4"
-                }
-
-                Post_TracabilityGraphical (post_conn_0, post_conn_3) {
-                    label = "5"
-                }
-                Post_TracabilityGraphical (post_conn_1, post_conn_4) {
-                    label = "6"
-                }
-
-                Post_MM_rendered_graphical/Line {
-                    label = "7"
-                    value___asid = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return mapping["2"]!
-                        $
-                    value_x = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["3"], "x")!
-                        $
-                    value_y = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["3"], "y")!
-                        $
-                    value_lineWidth = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return 1!
-                        $
-                    value_lineColour = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            if (read_type(model, name) == "ICLink"):
-                                return "red"!
-                            else:
-                                return "black"!
-                        $
-                    value_targetX = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["4"], "x")!
-                        $
-                    value_targetY = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["4"], "y")!
-                        $
-                }
+                            return "black"!
+                    $
+                value_targetX = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["4"], "x")!
+                    $
+                value_targetY = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["4"], "y")!
+                    $
             }
             }
         }
         }
     }
     }
+}
 
 
-    Initial (schedule, render_blocks) {}
+Initial (schedule, render_blocks) {}
 
 
-    OnSuccess (render_blocks, render_connections) {}
-    OnFailure (render_blocks, render_connections) {}
+OnSuccess (render_blocks, render_connections) {}
+OnFailure (render_blocks, render_connections) {}
 
 
-    OnSuccess (render_connections, success) {}
-    OnFailure (render_connections, success) {}
-}
+OnSuccess (render_connections, success) {}
+OnFailure (render_connections, success) {}

+ 52 - 54
models/MM_rendered_graphical.mvc

@@ -1,57 +1,55 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleClassDiagram MM_rendered_graphical{
-    SimpleAttribute Natural {}
-    SimpleAttribute String {}
-
-    Class GraphicalElement {
-        x : Natural
-        y : Natural
-        __asid? : String
-    }
-
-    Class Group : GraphicalElement {
-    }
-
-    Class LineElement : GraphicalElement {
-        lineWidth : Natural
-        lineColour : String
-    }
-
-    Class Text : LineElement {
-        text : String
-    }
-
-    Class Line : LineElement {
-        targetX : Natural
-        targetY : Natural
-    }
-
-    Class Shape : LineElement {
-        fillColour : String
-        width : Natural
-        height : Natural
-    }
-
-    Class Figure : GraphicalElement {
-        width : Natural
-        height : Natural
-    }
-
-    Class SVG {
-        data : String
-    }
-
-    Class Rectangle : Shape {
-    }
-
-    Class Ellipse : Shape {
-    }
-
-    Association contains (Group, GraphicalElement) {}
-    Association renders (Figure, SVG) {
-        source_lower_cardinality = 1
-        target_lower_cardinality = 1
-        target_upper_cardinality = 1
-    }
+SimpleAttribute Natural {}
+SimpleAttribute String {}
+
+Class GraphicalElement {
+    x : Natural
+    y : Natural
+    __asid? : String
+}
+
+Class Group : GraphicalElement {
+}
+
+Class LineElement : GraphicalElement {
+    lineWidth : Natural
+    lineColour : String
+}
+
+Class Text : LineElement {
+    text : String
+}
+
+Class Line : LineElement {
+    targetX : Natural
+    targetY : Natural
+}
+
+Class Shape : LineElement {
+    fillColour : String
+    width : Natural
+    height : Natural
+}
+
+Class Figure : GraphicalElement {
+    width : Natural
+    height : Natural
+}
+
+Class SVG {
+    data : String
+}
+
+Class Rectangle : Shape {
+}
+
+Class Ellipse : Shape {
+}
+
+Association contains (Group, GraphicalElement) {}
+Association renders (Figure, SVG) {
+    source_lower_cardinality = 1
+    target_lower_cardinality = 1
+    target_upper_cardinality = 1
 }
 }

+ 28 - 30
models/MM_rendered_plot.mvc

@@ -1,36 +1,34 @@
-SCD MM_Rendered_Plot{
-    SimpleAttribute String {}
-    SimpleAttribute Boolean {}
-    SimpleAttribute Float {}
+SimpleAttribute String {}
+SimpleAttribute Boolean {}
+SimpleAttribute Float {}
 
 
-    Class Plot {
-        title : String
-        legend : Boolean
-    }
+Class Plot {
+    title : String
+    legend : Boolean
+}
 
 
-    Class Dataset {
-        legend : String
-        color : String
-        linestyle : String
-    }
+Class Dataset {
+    legend : String
+    color : String
+    linestyle : String
+}
 
 
-    Class Datapoint {
-        x : Float
-        y : Float
-    }
+Class Datapoint {
+    x : Float
+    y : Float
+}
 
 
-    Class Axis {
-        name : String
-        unit : String
-        lim_low? : Float
-        lim_high? : Float
-    }
+Class Axis {
+    name : String
+    unit : String
+    lim_low? : Float
+    lim_high? : Float
+}
 
 
-    Class XAxis : Axis {}
-    Class YAxis : Axis {}
+Class XAxis : Axis {}
+Class YAxis : Axis {}
 
 
-    Association x (Plot, XAxis) {}
-    Association y (Plot, YAxis) {}
-    Association data (Plot, Dataset) {}
-    Association point (Dataset, Datapoint) {}
-}
+Association x (Plot, XAxis) {}
+Association y (Plot, YAxis) {}
+Association data (Plot, Dataset) {}
+Association point (Dataset, Datapoint) {}

+ 17 - 19
models/architecture.mvc

@@ -1,24 +1,22 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleClassDiagram Architecture{
-    SimpleAttribute String{
-        constraint = $
-            String function main(model : Element, name : String):
-                if (is_physical_string(model["model"][name])):
-                    return "OK"!
-                else:
-                    return "String has non-string value"!
-            $
-    }
-
-    Class Group {
-        name : String
-    }
+SimpleAttribute String{
+    constraint = $
+        String function main(model : Element, name : String):
+            if (is_physical_string(model["model"][name])):
+                return "OK"!
+            else:
+                return "String has non-string value"!
+        $
+}
 
 
-    Class Port {
-        name : String
-    }
+Class Group {
+    name : String
+}
 
 
-    Association Connects (Port, Port) {}
-    Association Contains (Group, Port) {}
+Class Port {
+    name : String
 }
 }
+
+Association Connects (Port, Port) {}
+Association Contains (Group, Port) {}

+ 83 - 85
models/architecture_model.mvc

@@ -1,96 +1,94 @@
-Architecture arch{
-    Architecture/Group {
-        name = "environment"
+Architecture/Group {
+    name = "environment"
 
 
-        Architecture/Port env_no_objPresent {
-            name = "no_objPresent"
-        }
-        Architecture/Port env_objPresent {
-            name = "objPresent"
-        }
-        Architecture/Port env_cmdDown {
-            name = "cmdDown"
-        }
-        Architecture/Port env_cmdNeutral {
-            name = "cmdNeutral"
-        }
-        Architecture/Port env_cmdUp {
-            name = "cmdUp"
-        }
+    Architecture/Port env_no_objPresent {
+        name = "no_objPresent"
     }
     }
+    Architecture/Port env_objPresent {
+        name = "objPresent"
+    }
+    Architecture/Port env_cmdDown {
+        name = "cmdDown"
+    }
+    Architecture/Port env_cmdNeutral {
+        name = "cmdNeutral"
+    }
+    Architecture/Port env_cmdUp {
+        name = "cmdUp"
+    }
+}
 
 
-    Architecture/Group {
-        name = "plant"
+Architecture/Group {
+    name = "plant"
 
 
-        Architecture/Port plant_up {
-            name = "up"
-        }
-        Architecture/Port plant_neutral {
-            name = "neutral"
-        }
-        Architecture/Port plant_down {
-            name = "down"
-        }
-        Architecture/Port plant_interrupt {
-            name = "interrupt"
-        }
-        Architecture/Port plant_objPresent {
-            name = "objPresent"
-        }
-        Architecture/Port plant_no_objPresent {
-            name = "no_objPresent"
-        }
-        Architecture/Port plant_objDetected {
-            name = "objDetected"
-        }
-        Architecture/Port plant_no_objDetected {
-            name = "no_objDetected"
-        }
+    Architecture/Port plant_up {
+        name = "up"
+    }
+    Architecture/Port plant_neutral {
+        name = "neutral"
+    }
+    Architecture/Port plant_down {
+        name = "down"
+    }
+    Architecture/Port plant_interrupt {
+        name = "interrupt"
+    }
+    Architecture/Port plant_objPresent {
+        name = "objPresent"
+    }
+    Architecture/Port plant_no_objPresent {
+        name = "no_objPresent"
+    }
+    Architecture/Port plant_objDetected {
+        name = "objDetected"
+    }
+    Architecture/Port plant_no_objDetected {
+        name = "no_objDetected"
     }
     }
+}
 
 
-    Architecture/Group {
-        name = "control"
+Architecture/Group {
+    name = "control"
 
 
-        Architecture/Port control_cmdDown {
-            name = "cmdDown"
-        }
-        Architecture/Port control_cmdNeutral {
-            name = "cmdNeutral"
-        }
-        Architecture/Port control_cmdUp {
-            name = "cmdUp"
-        }
-        Architecture/Port control_up {
-            name = "up"
-        }
-        Architecture/Port control_down {
-            name = "down"
-        }
-        Architecture/Port control_neutral {
-            name = "neutral"
-        }
-        Architecture/Port control_interrupt {
-            name = "interrupt"
-        }
-        Architecture/Port control_objDetected {
-            name = "objDetected"
-        }
-        Architecture/Port control_no_objDetected {
-            name = "no_objDetected"
-        }
+    Architecture/Port control_cmdDown {
+        name = "cmdDown"
+    }
+    Architecture/Port control_cmdNeutral {
+        name = "cmdNeutral"
+    }
+    Architecture/Port control_cmdUp {
+        name = "cmdUp"
+    }
+    Architecture/Port control_up {
+        name = "up"
+    }
+    Architecture/Port control_down {
+        name = "down"
+    }
+    Architecture/Port control_neutral {
+        name = "neutral"
     }
     }
+    Architecture/Port control_interrupt {
+        name = "interrupt"
+    }
+    Architecture/Port control_objDetected {
+        name = "objDetected"
+    }
+    Architecture/Port control_no_objDetected {
+        name = "no_objDetected"
+    }
+}
 
 
-    Architecture/Connects (env_no_objPresent, plant_no_objPresent) {}
-    Architecture/Connects (env_objPresent, plant_objPresent) {}
-    Architecture/Connects (env_cmdDown, control_cmdDown) {}
-    Architecture/Connects (env_cmdNeutral, control_cmdNeutral) {}
-    Architecture/Connects (env_cmdUp, control_cmdUp) {}
+Architecture/Connects (env_no_objPresent, plant_no_objPresent) {}
+Architecture/Connects (env_objPresent, plant_objPresent) {}
+Architecture/Connects (env_cmdDown, control_cmdDown) {}
+Architecture/Connects (env_cmdNeutral, control_cmdNeutral) {}
+Architecture/Connects (env_cmdUp, control_cmdUp) {}
 
 
-    Architecture/Connects (plant_objDetected, control_objDetected) {}
-    Architecture/Connects (plant_no_objDetected, control_no_objDetected) {}
-    Architecture/Connects (plant_interrupt, control_interrupt) {}
+Architecture/Connects (plant_objDetected, control_objDetected) {}
+Architecture/Connects (plant_no_objDetected, control_no_objDetected) {}
+Architecture/Connects (plant_interrupt, control_interrupt) {}
 
 
-    Architecture/Connects (control_up, plant_up) {}
-    Architecture/Connects (control_neutral, plant_neutral) {}
-    Architecture/Connects (control_down, plant_down) {}
-}
+Architecture/Connects (control_up, plant_up) {}
+Architecture/Connects (control_neutral, plant_neutral) {}
+Architecture/Connects (control_down, plant_down) {}

+ 394 - 397
models/combine_EPN.mvc

@@ -2,433 +2,430 @@ include "primitives.alh"
 include "modelling.alh"
 include "modelling.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
-A B {
-    Composite schedule {
-        {Contains} Success success {}
-        {Contains} Failure failure {}
+Composite schedule {
+    {Contains} Success success {}
+    {Contains} Failure failure {}
 
 
-        {Contains} ForAll link {
-            LHS {
-                Pre_Architecture/Group pre_l_0{
-                    label = "0"
-                }
-                Pre_Architecture/Port pre_l_1{
-                    label = "1"
-                }
-                Pre_Architecture/Contains pre_l_10 (pre_l_0, pre_l_1){
-                    label = "10"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_l_2{
-                    label = "2"
-                }
-                Pre_Architecture/Group pre_l_3{
-                    label = "3"
-                }
-                Pre_Architecture/Port pre_l_4{
-                    label = "4"
-                }
-                Pre_Architecture/Contains pre_l_11 (pre_l_3, pre_l_4){
-                    label = "11"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_l_5{
-                    label = "5"
-                }
-                Pre_Architecture/Connects (pre_l_1, pre_l_4){
-                    label = "6"
-                }
+    {Contains} ForAll link {
+        LHS {
+            Pre_Architecture/Group pre_l_0{
+                label = "0"
+            }
+            Pre_Architecture/Port pre_l_1{
+                label = "1"
+            }
+            Pre_Architecture/Contains pre_l_10 (pre_l_0, pre_l_1){
+                label = "10"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_l_2{
+                label = "2"
+            }
+            Pre_Architecture/Group pre_l_3{
+                label = "3"
+            }
+            Pre_Architecture/Port pre_l_4{
+                label = "4"
+            }
+            Pre_Architecture/Contains pre_l_11 (pre_l_3, pre_l_4){
+                label = "11"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_l_5{
+                label = "5"
+            }
+            Pre_Architecture/Connects (pre_l_1, pre_l_4){
+                label = "6"
+            }
 
 
-                constraint = $
-                    Boolean function constraint(model : Element, mapping : Element):
-                        String name_0
-                        String name_1
-                        String name_2
-                        String name_3
-                        String name_4
-                        String name_5
+            constraint = $
+                Boolean function constraint(model : Element, mapping : Element):
+                    String name_0
+                    String name_1
+                    String name_2
+                    String name_3
+                    String name_4
+                    String name_5
 
 
-                        name_0 = read_attribute(model, mapping["0"], "name")
-                        name_1 = read_attribute(model, mapping["1"], "name")
-                        name_2 = read_attribute(model, mapping["2"], "name")
-                        name_3 = read_attribute(model, mapping["3"], "name")
-                        name_4 = read_attribute(model, mapping["4"], "name")
-                        name_5 = read_attribute(model, mapping["5"], "name")
+                    name_0 = read_attribute(model, mapping["0"], "name")
+                    name_1 = read_attribute(model, mapping["1"], "name")
+                    name_2 = read_attribute(model, mapping["2"], "name")
+                    name_3 = read_attribute(model, mapping["3"], "name")
+                    name_4 = read_attribute(model, mapping["4"], "name")
+                    name_5 = read_attribute(model, mapping["5"], "name")
 
 
-                        if bool_not((name_0 + "/") + name_1 == name_2):
-                            return False!
-                        if bool_not((name_3 + "/") + name_4 == name_5):
-                            return False!
-                        return True!
-                    $
+                    if bool_not((name_0 + "/") + name_1 == name_2):
+                        return False!
+                    if bool_not((name_3 + "/") + name_4 == name_5):
+                        return False!
+                    return True!
+                $
+        }
+        RHS {
+            Post_Architecture/Group post_l_0{
+                label = "0"
+            }
+            Post_Architecture/Port post_l_1{
+                label = "1"
+            }
+            Post_Architecture/Contains post_l_10 (post_l_0, post_l_1){
+                label = "10"
+            }
+            Post_Encapsulated_PetriNet/Port post_l_2{
+                label = "2"
+            }
+            Post_Architecture/Group post_l_3{
+                label = "3"
             }
             }
-            RHS {
-                Post_Architecture/Group post_l_0{
-                    label = "0"
-                }
-                Post_Architecture/Port post_l_1{
-                    label = "1"
-                }
-                Post_Architecture/Contains post_l_10 (post_l_0, post_l_1){
-                    label = "10"
-                }
-                Post_Encapsulated_PetriNet/Port post_l_2{
-                    label = "2"
-                }
-                Post_Architecture/Group post_l_3{
-                    label = "3"
-                }
-                Post_Architecture/Port post_l_4{
-                    label = "4"
-                }
-                Post_Architecture/Contains post_l_11 (post_l_3, post_l_4){
-                    label = "11"
-                }
-                Post_Encapsulated_PetriNet/Port post_l_5{
-                    label = "5"
-                }
-                Post_Architecture/Connects (post_l_1, post_l_4){
-                    label = "6"
-                }
-                Post_Encapsulated_PetriNet/Related (post_l_2, post_l_5){
-                    label = "7"
-                }
+            Post_Architecture/Port post_l_4{
+                label = "4"
+            }
+            Post_Architecture/Contains post_l_11 (post_l_3, post_l_4){
+                label = "11"
+            }
+            Post_Encapsulated_PetriNet/Port post_l_5{
+                label = "5"
+            }
+            Post_Architecture/Connects (post_l_1, post_l_4){
+                label = "6"
+            }
+            Post_Encapsulated_PetriNet/Related (post_l_2, post_l_5){
+                label = "7"
             }
             }
         }
         }
+    }
 
 
-        {Contains} ForAll remove_old {
-            LHS {
-                Pre_Encapsulated_PetriNet/Port pre_ro_0 {
-                    label = "0"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_ro_1 {
-                    label = "1"
-                }
-                Pre_Encapsulated_PetriNet/Place pre_ro_2 {
-                    label = "2"
-                }
-                Pre_Encapsulated_PetriNet/Related (pre_ro_0, pre_ro_1) {
-                    label = "3"
-                }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_ro_1, pre_ro_2) {
-                    label = "4"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Port {
-                    label = "0"
-                }
+    {Contains} ForAll remove_old {
+        LHS {
+            Pre_Encapsulated_PetriNet/Port pre_ro_0 {
+                label = "0"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_ro_1 {
+                label = "1"
+            }
+            Pre_Encapsulated_PetriNet/Place pre_ro_2 {
+                label = "2"
+            }
+            Pre_Encapsulated_PetriNet/Related (pre_ro_0, pre_ro_1) {
+                label = "3"
+            }
+            Pre_Encapsulated_PetriNet/PortPlace (pre_ro_1, pre_ro_2) {
+                label = "4"
+            }
+        }
+        RHS {
+            Post_Encapsulated_PetriNet/Port {
+                label = "0"
             }
             }
         }
         }
+    }
 
 
-        {Contains} ForAll merge_P2T {
-            LHS {
-                Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
-                    label = "1"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
-                    label = "2"
-                }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
-                    label = "3"
-                }
-                Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
-                    label = "4"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
-                    label = "5"
-                }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
-                    label = "6"
-                }
-                Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
-                    label = "7"
-                }
-                Pre_Encapsulated_PetriNet/P2T (pre_p2t_4, pre_p2t_7) {
-                    label = "8"
-                }
-                Pre_Encapsulated_PetriNet/Related (pre_p2t_2, pre_p2t_5) {
-                    label = "10"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Place post_p2t_1 {
-                    label = "1"
-                }
-                Post_Encapsulated_PetriNet/Port post_p2t_2 {
-                    label = "2"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
-                    label = "3"
-                }
-                Post_Encapsulated_PetriNet/Place post_p2t_4 {
-                    label = "4"
-                }
-                Post_Encapsulated_PetriNet/Port post_p2t_5 {
-                    label = "5"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
-                    label = "6"
-                }
-                Post_Encapsulated_PetriNet/Transition post_p2t_7 {
-                    label = "7"
-                }
-                Post_Encapsulated_PetriNet/P2T (post_p2t_4, post_p2t_7) {
-                    label = "8"
-                }
-                Post_Encapsulated_PetriNet/P2T (post_p2t_1, post_p2t_7) {
-                    label = "9"
-                }
-                Post_Encapsulated_PetriNet/Related (post_p2t_2, post_p2t_5) {
-                    label = "10"
-                }
+    {Contains} ForAll merge_P2T {
+        LHS {
+            Pre_Encapsulated_PetriNet/Place pre_p2t_1 {
+                label = "1"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_p2t_2 {
+                label = "2"
+            }
+            Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_2, pre_p2t_1){
+                label = "3"
+            }
+            Pre_Encapsulated_PetriNet/Place pre_p2t_4 {
+                label = "4"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_p2t_5 {
+                label = "5"
+            }
+            Pre_Encapsulated_PetriNet/PortPlace (pre_p2t_5, pre_p2t_4){
+                label = "6"
+            }
+            Pre_Encapsulated_PetriNet/Transition pre_p2t_7 {
+                label = "7"
+            }
+            Pre_Encapsulated_PetriNet/P2T (pre_p2t_4, pre_p2t_7) {
+                label = "8"
+            }
+            Pre_Encapsulated_PetriNet/Related (pre_p2t_2, pre_p2t_5) {
+                label = "10"
             }
             }
         }
         }
+        RHS {
+            Post_Encapsulated_PetriNet/Place post_p2t_1 {
+                label = "1"
+            }
+            Post_Encapsulated_PetriNet/Port post_p2t_2 {
+                label = "2"
+            }
+            Post_Encapsulated_PetriNet/PortPlace (post_p2t_2, post_p2t_1){
+                label = "3"
+            }
+            Post_Encapsulated_PetriNet/Place post_p2t_4 {
+                label = "4"
+            }
+            Post_Encapsulated_PetriNet/Port post_p2t_5 {
+                label = "5"
+            }
+            Post_Encapsulated_PetriNet/PortPlace (post_p2t_5, post_p2t_4){
+                label = "6"
+            }
+            Post_Encapsulated_PetriNet/Transition post_p2t_7 {
+                label = "7"
+            }
+            Post_Encapsulated_PetriNet/P2T (post_p2t_4, post_p2t_7) {
+                label = "8"
+            }
+            Post_Encapsulated_PetriNet/P2T (post_p2t_1, post_p2t_7) {
+                label = "9"
+            }
+            Post_Encapsulated_PetriNet/Related (post_p2t_2, post_p2t_5) {
+                label = "10"
+            }
+        }
+    }
 
 
-        {Contains} ForAll merge_T2P {
-            LHS {
-                Pre_Encapsulated_PetriNet/Place pre_t2p_1 {
-                    label = "1"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_t2p_2 {
-                    label = "2"
-                }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_t2p_2, pre_t2p_1){
-                    label = "3"
-                }
-                Pre_Encapsulated_PetriNet/Place pre_t2p_4 {
-                    label = "4"
-                }
-                Pre_Encapsulated_PetriNet/Port pre_t2p_5 {
-                    label = "5"
-                }
-                Pre_Encapsulated_PetriNet/PortPlace (pre_t2p_5, pre_t2p_4){
-                    label = "6"
-                }
-                Pre_Encapsulated_PetriNet/Transition pre_t2p_7 {
-                    label = "7"
-                }
-                Pre_Encapsulated_PetriNet/T2P (pre_t2p_7, pre_t2p_4) {
-                    label = "8"
-                }
+    {Contains} ForAll merge_T2P {
+        LHS {
+            Pre_Encapsulated_PetriNet/Place pre_t2p_1 {
+                label = "1"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_t2p_2 {
+                label = "2"
+            }
+            Pre_Encapsulated_PetriNet/PortPlace (pre_t2p_2, pre_t2p_1){
+                label = "3"
+            }
+            Pre_Encapsulated_PetriNet/Place pre_t2p_4 {
+                label = "4"
+            }
+            Pre_Encapsulated_PetriNet/Port pre_t2p_5 {
+                label = "5"
+            }
+            Pre_Encapsulated_PetriNet/PortPlace (pre_t2p_5, pre_t2p_4){
+                label = "6"
+            }
+            Pre_Encapsulated_PetriNet/Transition pre_t2p_7 {
+                label = "7"
+            }
+            Pre_Encapsulated_PetriNet/T2P (pre_t2p_7, pre_t2p_4) {
+                label = "8"
+            }
 
 
-                Pre_Encapsulated_PetriNet/Related (pre_t2p_2, pre_t2p_5) {
-                    label = "10"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Place post_t2p_1 {
-                    label = "1"
-                }
-                Post_Encapsulated_PetriNet/Port post_t2p_2 {
-                    label = "2"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_t2p_2, post_t2p_1){
-                    label = "3"
-                }
-                Post_Encapsulated_PetriNet/Place post_t2p_4 {
-                    label = "4"
-                }
-                Post_Encapsulated_PetriNet/Port post_t2p_5 {
-                    label = "5"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (post_t2p_5, post_t2p_4){
-                    label = "6"
-                }
-                Post_Encapsulated_PetriNet/Transition post_t2p_7 {
-                    label = "7"
-                }
-                Post_Encapsulated_PetriNet/T2P (post_t2p_7, post_t2p_4) {
-                    label = "8"
-                }
-                Post_Encapsulated_PetriNet/T2P (post_t2p_7, post_t2p_1) {
-                    label = "9"
-                }
-                Post_Encapsulated_PetriNet/Related (post_t2p_2, post_t2p_5) {
-                    label = "10"
-                }
+            Pre_Encapsulated_PetriNet/Related (pre_t2p_2, pre_t2p_5) {
+                label = "10"
+            }
+        }
+        RHS {
+            Post_Encapsulated_PetriNet/Place post_t2p_1 {
+                label = "1"
+            }
+            Post_Encapsulated_PetriNet/Port post_t2p_2 {
+                label = "2"
+            }
+            Post_Encapsulated_PetriNet/PortPlace (post_t2p_2, post_t2p_1){
+                label = "3"
+            }
+            Post_Encapsulated_PetriNet/Place post_t2p_4 {
+                label = "4"
+            }
+            Post_Encapsulated_PetriNet/Port post_t2p_5 {
+                label = "5"
+            }
+            Post_Encapsulated_PetriNet/PortPlace (post_t2p_5, post_t2p_4){
+                label = "6"
+            }
+            Post_Encapsulated_PetriNet/Transition post_t2p_7 {
+                label = "7"
+            }
+            Post_Encapsulated_PetriNet/T2P (post_t2p_7, post_t2p_4) {
+                label = "8"
+            }
+            Post_Encapsulated_PetriNet/T2P (post_t2p_7, post_t2p_1) {
+                label = "9"
+            }
+            Post_Encapsulated_PetriNet/Related (post_t2p_2, post_t2p_5) {
+                label = "10"
             }
             }
         }
         }
+    }
 
 
-        {Contains} ForAll copy_transitions {
-            LHS {
-                Pre_Encapsulated_PetriNet/Transition {
-                    label = "0"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Transition ct1 {
-                    label = "0"
-                }
-                Post_PetriNet/Transition ct2 {
-                    label = "1"
-                    value_name = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["0"], "name")!
-                        $
-                }
-                Post_EPN2PN_transition_link (ct1, ct2){
-                    label = "2"
-                }
+    {Contains} ForAll copy_transitions {
+        LHS {
+            Pre_Encapsulated_PetriNet/Transition {
+                label = "0"
             }
             }
         }
         }
-        {Contains} ForAll copy_places {
-            LHS {
-                Pre_Encapsulated_PetriNet/Place {
-                    label = "0"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Place cp1 {
-                    label = "0"
-                }
-                Post_PetriNet/Place cp2 {
-                    label = "1"
-                    value_tokens = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["0"], "tokens")!
-                        $
-                    value_name = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["0"], "name")!
-                        $
-                }
-                Post_EPN2PN_place_link (cp1, cp2){
-                    label = "2"
-                }
+        RHS {
+            Post_Encapsulated_PetriNet/Transition ct1 {
+                label = "0"
+            }
+            Post_PetriNet/Transition ct2 {
+                label = "1"
+                value_name = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["0"], "name")!
+                    $
+            }
+            Post_EPN2PN_transition_link (ct1, ct2){
+                label = "2"
             }
             }
         }
         }
-        {Contains} ForAll copy_P2T {
-            LHS {
-                Pre_Encapsulated_PetriNet/Place cp2t_p{
-                    label = "0"
-                }
-                Pre_Encapsulated_PetriNet/Transition cp2t_t{
-                    label = "1"
-                }
-                Pre_Encapsulated_PetriNet/P2T (cp2t_p, cp2t_t){
-                    label = "2"
-                }
-                Pre_PetriNet/Place cp2t_p2{
-                    label = "3"
-                }
-                Pre_PetriNet/Transition cp2t_t2{
-                    label = "4"
-                }
-                Pre_EPN2PN_place_link (cp2t_p, cp2t_p2){
-                    label = "5"
-                }
-                Pre_EPN2PN_transition_link (cp2t_t, cp2t_t2){
-                    label = "6"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Place rhs_cp2t_p{
-                    label = "0"
-                }
-                Post_Encapsulated_PetriNet/Transition rhs_cp2t_t{
-                    label = "1"
-                }
-                Post_Encapsulated_PetriNet/P2T rhs_cp2t_p2t (rhs_cp2t_p, rhs_cp2t_t){
-                    label = "2"
-                }
-                Post_PetriNet/Place rhs_cp2t_p2 {
-                    label = "3"
-                }
-                Post_PetriNet/Transition rhs_cp2t_t2 {
-                    label = "4"
-                }
-                Post_EPN2PN_place_link (rhs_cp2t_p, rhs_cp2t_p2){
-                    label = "5"
-                }
-                Post_EPN2PN_transition_link (rhs_cp2t_t, rhs_cp2t_t2){
-                    label = "6"
-                }
-                Post_PetriNet/P2T rhs_cp2t_p2t2(rhs_cp2t_p2, rhs_cp2t_t2) {
-                    label = "7"
-                    value_weight = $
-                        Integer function value(host_model : Element, name : String, mapping : Element):
-                            return 1!
-                        $
-                }
+    }
+    {Contains} ForAll copy_places {
+        LHS {
+            Pre_Encapsulated_PetriNet/Place {
+                label = "0"
             }
             }
         }
         }
-        {Contains} ForAll copy_T2P {
-            LHS {
-                Pre_Encapsulated_PetriNet/Place ct2p_p{
-                    label = "0"
-                }
-                Pre_Encapsulated_PetriNet/Transition ct2p_t{
-                    label = "1"
-                }
-                Pre_Encapsulated_PetriNet/T2P (ct2p_t, ct2p_p){
-                    label = "2"
-                }
-                Pre_PetriNet/Place ct2p_p2{
-                    label = "3"
-                }
-                Pre_PetriNet/Transition ct2p_t2{
-                    label = "4"
-                }
-                Pre_EPN2PN_place_link (ct2p_p, ct2p_p2){
-                    label = "5"
-                }
-                Pre_EPN2PN_transition_link (ct2p_t, ct2p_t2){
-                    label = "6"
-                }
-            }
-            RHS {
-                Post_Encapsulated_PetriNet/Place rhs_ct2p_p{
-                    label = "0"
-                }
-                Post_Encapsulated_PetriNet/Transition rhs_ct2p_t{
-                    label = "1"
-                }
-                Post_Encapsulated_PetriNet/T2P (rhs_ct2p_t, rhs_ct2p_p){
-                    label = "2"
-                }
-                Post_PetriNet/Place rhs_ct2p_p2 {
-                    label = "3"
-                }
-                Post_PetriNet/Transition rhs_ct2p_t2 {
-                    label = "4"
-                }
-                Post_EPN2PN_place_link (rhs_ct2p_p, rhs_ct2p_p2){
-                    label = "5"
-                }
-                Post_EPN2PN_transition_link (rhs_ct2p_t, rhs_ct2p_t2){
-                    label = "6"
-                }
-                Post_PetriNet/T2P (rhs_ct2p_t2, rhs_ct2p_p2) {
-                    label = "7"
-                    value_weight = $
-                        Integer function value(host_model : Element, name : String, mapping : Element):
-                            return 1!
-                        $
-                }
+        RHS {
+            Post_Encapsulated_PetriNet/Place cp1 {
+                label = "0"
+            }
+            Post_PetriNet/Place cp2 {
+                label = "1"
+                value_tokens = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["0"], "tokens")!
+                    $
+                value_name = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["0"], "name")!
+                    $
+            }
+            Post_EPN2PN_place_link (cp1, cp2){
+                label = "2"
             }
             }
         }
         }
     }
     }
+    {Contains} ForAll copy_P2T {
+        LHS {
+            Pre_Encapsulated_PetriNet/Place cp2t_p{
+                label = "0"
+            }
+            Pre_Encapsulated_PetriNet/Transition cp2t_t{
+                label = "1"
+            }
+            Pre_Encapsulated_PetriNet/P2T (cp2t_p, cp2t_t){
+                label = "2"
+            }
+            Pre_PetriNet/Place cp2t_p2{
+                label = "3"
+            }
+            Pre_PetriNet/Transition cp2t_t2{
+                label = "4"
+            }
+            Pre_EPN2PN_place_link (cp2t_p, cp2t_p2){
+                label = "5"
+            }
+            Pre_EPN2PN_transition_link (cp2t_t, cp2t_t2){
+                label = "6"
+            }
+        }
+        RHS {
+            Post_Encapsulated_PetriNet/Place rhs_cp2t_p{
+                label = "0"
+            }
+            Post_Encapsulated_PetriNet/Transition rhs_cp2t_t{
+                label = "1"
+            }
+            Post_Encapsulated_PetriNet/P2T rhs_cp2t_p2t (rhs_cp2t_p, rhs_cp2t_t){
+                label = "2"
+            }
+            Post_PetriNet/Place rhs_cp2t_p2 {
+                label = "3"
+            }
+            Post_PetriNet/Transition rhs_cp2t_t2 {
+                label = "4"
+            }
+            Post_EPN2PN_place_link (rhs_cp2t_p, rhs_cp2t_p2){
+                label = "5"
+            }
+            Post_EPN2PN_transition_link (rhs_cp2t_t, rhs_cp2t_t2){
+                label = "6"
+            }
+            Post_PetriNet/P2T rhs_cp2t_p2t2(rhs_cp2t_p2, rhs_cp2t_t2) {
+                label = "7"
+                value_weight = $
+                    Integer function value(host_model : Element, name : String, mapping : Element):
+                        return 1!
+                    $
+            }
+        }
+    }
+    {Contains} ForAll copy_T2P {
+        LHS {
+            Pre_Encapsulated_PetriNet/Place ct2p_p{
+                label = "0"
+            }
+            Pre_Encapsulated_PetriNet/Transition ct2p_t{
+                label = "1"
+            }
+            Pre_Encapsulated_PetriNet/T2P (ct2p_t, ct2p_p){
+                label = "2"
+            }
+            Pre_PetriNet/Place ct2p_p2{
+                label = "3"
+            }
+            Pre_PetriNet/Transition ct2p_t2{
+                label = "4"
+            }
+            Pre_EPN2PN_place_link (ct2p_p, ct2p_p2){
+                label = "5"
+            }
+            Pre_EPN2PN_transition_link (ct2p_t, ct2p_t2){
+                label = "6"
+            }
+        }
+        RHS {
+            Post_Encapsulated_PetriNet/Place rhs_ct2p_p{
+                label = "0"
+            }
+            Post_Encapsulated_PetriNet/Transition rhs_ct2p_t{
+                label = "1"
+            }
+            Post_Encapsulated_PetriNet/T2P (rhs_ct2p_t, rhs_ct2p_p){
+                label = "2"
+            }
+            Post_PetriNet/Place rhs_ct2p_p2 {
+                label = "3"
+            }
+            Post_PetriNet/Transition rhs_ct2p_t2 {
+                label = "4"
+            }
+            Post_EPN2PN_place_link (rhs_ct2p_p, rhs_ct2p_p2){
+                label = "5"
+            }
+            Post_EPN2PN_transition_link (rhs_ct2p_t, rhs_ct2p_t2){
+                label = "6"
+            }
+            Post_PetriNet/T2P (rhs_ct2p_t2, rhs_ct2p_p2) {
+                label = "7"
+                value_weight = $
+                    Integer function value(host_model : Element, name : String, mapping : Element):
+                        return 1!
+                    $
+            }
+        }
+    }
+}
 
 
-    Initial (schedule, link) {}
-
-    OnSuccess (link, merge_P2T) {}
-    OnFailure (link, merge_P2T) {}
+Initial (schedule, link) {}
 
 
-    OnSuccess (merge_P2T, merge_T2P) {}
-    OnFailure (merge_P2T, merge_T2P) {}
+OnSuccess (link, merge_P2T) {}
+OnFailure (link, merge_P2T) {}
 
 
-    OnSuccess (merge_T2P, remove_old) {}
-    OnFailure (merge_T2P, remove_old) {}
+OnSuccess (merge_P2T, merge_T2P) {}
+OnFailure (merge_P2T, merge_T2P) {}
 
 
-    OnSuccess (remove_old, copy_places) {}
-    OnFailure (remove_old, copy_places) {}
+OnSuccess (merge_T2P, remove_old) {}
+OnFailure (merge_T2P, remove_old) {}
 
 
-    OnSuccess (copy_places, copy_transitions) {}
-    OnSuccess (copy_transitions, copy_P2T) {}
-    OnSuccess (copy_P2T, copy_T2P) {}
-    OnSuccess (copy_T2P, success) {}
-    OnFailure (copy_places, copy_transitions) {}
-    OnFailure (copy_transitions, copy_P2T) {}
-    OnFailure (copy_P2T, copy_T2P) {}
-    OnFailure (copy_T2P, success) {}
+OnSuccess (remove_old, copy_places) {}
+OnFailure (remove_old, copy_places) {}
 
 
-}
+OnSuccess (copy_places, copy_transitions) {}
+OnSuccess (copy_transitions, copy_P2T) {}
+OnSuccess (copy_P2T, copy_T2P) {}
+OnSuccess (copy_T2P, success) {}
+OnFailure (copy_places, copy_transitions) {}
+OnFailure (copy_transitions, copy_P2T) {}
+OnFailure (copy_P2T, copy_T2P) {}
+OnFailure (copy_T2P, success) {}

+ 24 - 26
models/control_PW.mvc

@@ -1,32 +1,30 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleClassDiagram Control_PW{
-    SimpleAttribute Boolean {}
-    SimpleAttribute TriState {}
-    SimpleAttribute String{
-        constraint = $
-            String function constraint(model : Element, name : String):
-                if (is_physical_string(model["model"][name])):
-                    return "OK"!
-                else:
-                    return "String has non-string value"!
-            $
-    }
+SimpleAttribute Boolean {}
+SimpleAttribute TriState {}
+SimpleAttribute String{
+    constraint = $
+        String function constraint(model : Element, name : String):
+            if (is_physical_string(model["model"][name])):
+                return "OK"!
+            else:
+                return "String has non-string value"!
+        $
+}
 
 
-    Class State {
-        isInitial : Boolean
-        isError : Boolean
-        name : String
-    }
+Class State {
+    isInitial : Boolean
+    isError : Boolean
+    name : String
+}
 
 
-    Class Up : State {}
-    Class Down : State {}
-    Class Neutral : State {}
+Class Up : State {}
+Class Down : State {}
+Class Neutral : State {}
 
 
-    Association Transition (State, State) {
-        objDetected : TriState
-    }
-    Association UpPressed : Transition (State, State) {}
-    Association NonePressed : Transition (State, State) {}
-    Association DownPressed : Transition (State, State) {}
+Association Transition (State, State) {
+    objDetected : TriState
 }
 }
+Association UpPressed : Transition (State, State) {}
+Association NonePressed : Transition (State, State) {}
+Association DownPressed : Transition (State, State) {}

+ 32 - 34
models/control_model.mvc

@@ -1,36 +1,34 @@
-Control_PW control_model_PW {
-    PW_Control/Up up {
-        isInitial = False
-        isError = False
-        name = "ctrl_up"
-    }
-    PW_Control/Down down {
-        isInitial = False
-        isError = False
-        name = "ctrl_down"
-    }
-    PW_Control/Neutral neutral {
-        isInitial = True
-        isError = True
-        name = "ctrl_neutral"
-    }
+PW_Control/Up up {
+    isInitial = False
+    isError = False
+    name = "ctrl_up"
+}
+PW_Control/Down down {
+    isInitial = False
+    isError = False
+    name = "ctrl_down"
+}
+PW_Control/Neutral neutral {
+    isInitial = True
+    isError = True
+    name = "ctrl_neutral"
+}
 
 
-    PW_Control/UpPressed (down, neutral) {
-        objDetected = "*"
-    }
-    PW_Control/UpPressed (neutral, up) {
-        objDetected = "N"
-    }
-    PW_Control/DownPressed (up, neutral) {
-        objDetected = "*"
-    }
-    PW_Control/DownPressed (neutral, down) {
-        objDetected = "*"
-    }
-    PW_Control/NonePressed (up, neutral) {
-        objDetected = "*"
-    }
-    PW_Control/NonePressed (down, neutral) {
-        objDetected = "*"
-    }
+PW_Control/UpPressed (down, neutral) {
+    objDetected = "*"
+}
+PW_Control/UpPressed (neutral, up) {
+    objDetected = "N"
+}
+PW_Control/DownPressed (up, neutral) {
+    objDetected = "*"
+}
+PW_Control/DownPressed (neutral, down) {
+    objDetected = "*"
+}
+PW_Control/NonePressed (up, neutral) {
+    objDetected = "*"
+}
+PW_Control/NonePressed (down, neutral) {
+    objDetected = "*"
 }
 }

+ 32 - 34
models/control_model_wrong.mvc

@@ -1,36 +1,34 @@
-Control_PW control_model_PW {
-    PW_Control/Up up {
-        isInitial = False
-        isError = False
-        name = "ctrl_up"
-    }
-    PW_Control/Down down {
-        isInitial = False
-        isError = False
-        name = "ctrl_down"
-    }
-    PW_Control/Neutral neutral {
-        isInitial = True
-        isError = True
-        name = "ctrl_neutral"
-    }
+PW_Control/Up up {
+    isInitial = False
+    isError = False
+    name = "ctrl_up"
+}
+PW_Control/Down down {
+    isInitial = False
+    isError = False
+    name = "ctrl_down"
+}
+PW_Control/Neutral neutral {
+    isInitial = True
+    isError = True
+    name = "ctrl_neutral"
+}
 
 
-    PW_Control/UpPressed (down, neutral) {
-        objDetected = "*"
-    }
-    PW_Control/UpPressed (neutral, up) {
-        objDetected = "*"
-    }
-    PW_Control/DownPressed (up, neutral) {
-        objDetected = "*"
-    }
-    PW_Control/DownPressed (neutral, down) {
-        objDetected = "*"
-    }
-    PW_Control/NonePressed (up, neutral) {
-        objDetected = "*"
-    }
-    PW_Control/NonePressed (down, neutral) {
-        objDetected = "*"
-    }
+PW_Control/UpPressed (down, neutral) {
+    objDetected = "*"
+}
+PW_Control/UpPressed (neutral, up) {
+    objDetected = "*"
+}
+PW_Control/DownPressed (up, neutral) {
+    objDetected = "*"
+}
+PW_Control/DownPressed (neutral, down) {
+    objDetected = "*"
+}
+PW_Control/NonePressed (up, neutral) {
+    objDetected = "*"
+}
+PW_Control/NonePressed (down, neutral) {
+    objDetected = "*"
 }
 }

File diff suppressed because it is too large
+ 796 - 798
models/control_to_EPN.mvc


+ 9 - 11
models/environment_PW.mvc

@@ -1,15 +1,13 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleClassDiagrams Environment_PW{
-    SimpleAttribute Boolean {}
-    SimpleAttribute Natural{}
-    SimpleAttribute String{}
+SimpleAttribute Boolean {}
+SimpleAttribute Natural{}
+SimpleAttribute String{}
 
 
-    Class Group {}
-    Class Event {
-        initial : Boolean
-        name : String
-    }
-
-    Association Contains (Group, Event) {}
+Class Group {}
+Class Event {
+    initial : Boolean
+    name : String
 }
 }
+
+Association Contains (Group, Event) {}

+ 21 - 23
models/environment_model.mvc

@@ -1,27 +1,25 @@
-Environment_PW environment_model_PW {
-    PW_Environment/Group {
-        PW_Environment/Event {
-            name = "cmdUp"
-            initial = False
-        }
-        PW_Environment/Event {
-            name = "cmdNeutral"
-            initial = True
-        }
-        PW_Environment/Event {
-            name = "cmdDown"
-            initial = False
-        }
+PW_Environment/Group {
+    PW_Environment/Event {
+        name = "cmdUp"
+        initial = False
     }
     }
+    PW_Environment/Event {
+        name = "cmdNeutral"
+        initial = True
+    }
+    PW_Environment/Event {
+        name = "cmdDown"
+        initial = False
+    }
+}
 
 
-    PW_Environment/Group {
-        PW_Environment/Event {
-            name = "objPresent"
-            initial = False
-        }
-        PW_Environment/Event {
-            name = "no_objPresent"
-            initial = True
-        }
+PW_Environment/Group {
+    PW_Environment/Event {
+        name = "objPresent"
+        initial = False
+    }
+    PW_Environment/Event {
+        name = "no_objPresent"
+        initial = True
     }
     }
 }
 }

+ 117 - 119
models/environment_to_EPN.mvc

@@ -2,128 +2,126 @@ include "primitives.alh"
 include "modelling.alh"
 include "modelling.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
-A B {
-    Composite schedule {
-        {Contains} Success success {}
-        {Contains} Failure failure {}
-        {Contains} ForAll create_ports {
-            LHS {
-                Pre_PW_Environment/Event {
-                    label = "1"
-                }
-            }
-            RHS {
-                Post_PW_Environment/Event cp_evt {
-                    label = "1"
-                }
-                Post_Encapsulated_PetriNet/Place cp_place {
-                    label = "2"
-                    value_name = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["1"], "name")!
-                        $
-                    value_tokens = $
-                        Integer function value(model : Element, name : String, mapping : Element):
-                            Boolean initial
-                            initial = read_attribute(model, mapping["1"], "initial")
-                            if (initial):
-                                return 1!
-                            else:
-                                return 0!
-                        $
-                }
-                Post_Encapsulated_PetriNet/Port cp_port {
-                    label = "3"
-                    value_name = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return string_join("environment/", read_attribute(model, mapping["1"], "name"))!
-                        $
-                }
-                Post_ENV2EPN_link (cp_evt, cp_place) {
-                    label = "4"
-                }
-                Post_Encapsulated_PetriNet/PortPlace (cp_port, cp_place) {
-                    label = "5"
-                }
+Composite schedule {
+    {Contains} Success success {}
+    {Contains} Failure failure {}
+    {Contains} ForAll create_ports {
+        LHS {
+            Pre_PW_Environment/Event {
+                label = "1"
             }
             }
         }
         }
-        {Contains} ForAll create_switches {
-            LHS {
-                Pre_PW_Environment/Group pre_grp {
-                    label = "1"
-                }
-                Pre_PW_Environment/Event pre_evt_a {
-                    label = "2"
-                }
-                Pre_PW_Environment/Event pre_evt_b {
-                    label = "3"
-                }
-                Pre_PW_Environment/Contains (pre_grp, pre_evt_a) {
-                    label = "4"
-                }
-                Pre_PW_Environment/Contains (pre_grp, pre_evt_b) {
-                    label = "5"
-                }
-                Pre_Encapsulated_PetriNet/Place pre_place_a {
-                    label = "8"
-                }
-                Pre_Encapsulated_PetriNet/Place pre_place_b {
-                    label = "9"
-                }
-                Pre_ENV2EPN_link (pre_evt_a, pre_place_a) {
-                    label = "6"
-                }
-                Pre_ENV2EPN_link (pre_evt_b, pre_place_b) {
-                    label = "7"
-                }
-            }
-            RHS {
-                Post_PW_Environment/Group post_grp {
-                    label = "1"
-                }
-                Post_PW_Environment/Event post_evt_a {
-                    label = "2"
-                }
-                Post_PW_Environment/Event post_evt_b {
-                    label = "3"
-                }
-                Post_PW_Environment/Contains (post_grp, post_evt_a) {
-                    label = "4"
-                }
-                Post_PW_Environment/Contains (post_grp, post_evt_b) {
-                    label = "5"
-                }
-                Post_Encapsulated_PetriNet/Place post_place_a {
-                    label = "8"
-                }
-                Post_Encapsulated_PetriNet/Place post_place_b {
-                    label = "9"
-                }
-                Post_Encapsulated_PetriNet/Transition post_transition {
-                    label = "12"
-                    value_name = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return string_join(string_join(read_attribute(model, mapping["2"], "name"), " -> "), read_attribute(model, mapping["3"], "name"))!
-                        $
-                }
-                Post_Encapsulated_PetriNet/P2T (post_place_a, post_transition) {
-                    label = "10"
-                }
-                Post_Encapsulated_PetriNet/T2P (post_transition, post_place_b) {
-                    label = "11"
-                }
-                Post_ENV2EPN_link (post_evt_a, post_place_a) {
-                    label = "6"
-                }
-                Post_ENV2EPN_link (post_evt_b, post_place_b) {
-                    label = "7"
-                }
+        RHS {
+            Post_PW_Environment/Event cp_evt {
+                label = "1"
+            }
+            Post_Encapsulated_PetriNet/Place cp_place {
+                label = "2"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["1"], "name")!
+                    $
+                value_tokens = $
+                    Integer function value(model : Element, name : String, mapping : Element):
+                        Boolean initial
+                        initial = read_attribute(model, mapping["1"], "initial")
+                        if (initial):
+                            return 1!
+                        else:
+                            return 0!
+                    $
+            }
+            Post_Encapsulated_PetriNet/Port cp_port {
+                label = "3"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return string_join("environment/", read_attribute(model, mapping["1"], "name"))!
+                    $
+            }
+            Post_ENV2EPN_link (cp_evt, cp_place) {
+                label = "4"
+            }
+            Post_Encapsulated_PetriNet/PortPlace (cp_port, cp_place) {
+                label = "5"
+            }
+        }
+    }
+    {Contains} ForAll create_switches {
+        LHS {
+            Pre_PW_Environment/Group pre_grp {
+                label = "1"
+            }
+            Pre_PW_Environment/Event pre_evt_a {
+                label = "2"
+            }
+            Pre_PW_Environment/Event pre_evt_b {
+                label = "3"
+            }
+            Pre_PW_Environment/Contains (pre_grp, pre_evt_a) {
+                label = "4"
+            }
+            Pre_PW_Environment/Contains (pre_grp, pre_evt_b) {
+                label = "5"
+            }
+            Pre_Encapsulated_PetriNet/Place pre_place_a {
+                label = "8"
+            }
+            Pre_Encapsulated_PetriNet/Place pre_place_b {
+                label = "9"
+            }
+            Pre_ENV2EPN_link (pre_evt_a, pre_place_a) {
+                label = "6"
+            }
+            Pre_ENV2EPN_link (pre_evt_b, pre_place_b) {
+                label = "7"
+            }
+        }
+        RHS {
+            Post_PW_Environment/Group post_grp {
+                label = "1"
+            }
+            Post_PW_Environment/Event post_evt_a {
+                label = "2"
+            }
+            Post_PW_Environment/Event post_evt_b {
+                label = "3"
+            }
+            Post_PW_Environment/Contains (post_grp, post_evt_a) {
+                label = "4"
+            }
+            Post_PW_Environment/Contains (post_grp, post_evt_b) {
+                label = "5"
+            }
+            Post_Encapsulated_PetriNet/Place post_place_a {
+                label = "8"
+            }
+            Post_Encapsulated_PetriNet/Place post_place_b {
+                label = "9"
+            }
+            Post_Encapsulated_PetriNet/Transition post_transition {
+                label = "12"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return string_join(string_join(read_attribute(model, mapping["2"], "name"), " -> "), read_attribute(model, mapping["3"], "name"))!
+                    $
+            }
+            Post_Encapsulated_PetriNet/P2T (post_place_a, post_transition) {
+                label = "10"
+            }
+            Post_Encapsulated_PetriNet/T2P (post_transition, post_place_b) {
+                label = "11"
+            }
+            Post_ENV2EPN_link (post_evt_a, post_place_a) {
+                label = "6"
+            }
+            Post_ENV2EPN_link (post_evt_b, post_place_b) {
+                label = "7"
             }
             }
         }
         }
     }
     }
-    Initial (schedule, create_ports) {}
-    OnSuccess (create_ports, create_switches) {}
-    OnSuccess (create_switches, success) {}
-    OnFailure (create_ports, failure) {}
-    OnFailure (create_switches, failure) {}
 }
 }
+Initial (schedule, create_ports) {}
+OnSuccess (create_ports, create_switches) {}
+OnSuccess (create_switches, success) {}
+OnFailure (create_ports, failure) {}
+OnFailure (create_switches, failure) {}

+ 3 - 5
models/initialize.mvc

@@ -1,6 +1,4 @@
-PetriNets_RAM initialize {
-    Composite schedule {
-        {Contains} Success success {}
-    }
-    Initial (schedule, success) {}
+Composite schedule {
+    {Contains} Success success {}
 }
 }
+Initial (schedule, success) {}

+ 62 - 64
models/matches.mvc

@@ -2,76 +2,74 @@ include "primitives.alh"
 include "modelling.alh"
 include "modelling.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
-A B {
-    Composite schedule {
-        {Contains} Failure failure {}
-        {Contains} Success success {}
-        {Contains} Query query {
-            LHS {
-                Pre_Query/Place {
-                    label = "2"
-                }
-                Pre_ReachabilityGraph/Place {
-                    label = "3"
-                }
-
-                constraint = $
-                    Boolean function constraint(host_model : Element, mapping : Element):
-                        Boolean names_match
-                        Boolean tokens_match
-                        names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
-                        tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
-                        return bool_and(names_match, tokens_match)!
-                    $
+Composite schedule {
+    {Contains} Failure failure {}
+    {Contains} Success success {}
+    {Contains} Query query {
+        LHS {
+            Pre_Query/Place {
+                label = "2"
+            }
+            Pre_ReachabilityGraph/Place {
+                label = "3"
             }
             }
+
+            constraint = $
+                Boolean function constraint(host_model : Element, mapping : Element):
+                    Boolean names_match
+                    Boolean tokens_match
+                    names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
+                    tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
+                    return bool_and(names_match, tokens_match)!
+                $
         }
         }
-        {Contains} ForAll match {
-            LHS {
-                Pre_Query/Place {
-                    label = "2"
-                }
-                Pre_ReachabilityGraph/Place pre_3 {
-                    label = "3"
-                }
-                Pre_ReachabilityGraph/State pre_4 {
-                    label = "4"
-                }
-                Pre_ReachabilityGraph/Contains (pre_4, pre_3) {
-                    label = "5"
-                }
+    }
+    {Contains} ForAll match {
+        LHS {
+            Pre_Query/Place {
+                label = "2"
+            }
+            Pre_ReachabilityGraph/Place pre_3 {
+                label = "3"
+            }
+            Pre_ReachabilityGraph/State pre_4 {
+                label = "4"
+            }
+            Pre_ReachabilityGraph/Contains (pre_4, pre_3) {
+                label = "5"
+            }
 
 
-                constraint = $
-                    Boolean function constraint(host_model : Element, mapping : Element):
-                        Boolean names_match
-                        Boolean tokens_match
-                        names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
-                        tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
-                        return bool_and(names_match, tokens_match)!
+            constraint = $
+                Boolean function constraint(host_model : Element, mapping : Element):
+                    Boolean names_match
+                    Boolean tokens_match
+                    names_match = value_eq(read_attribute(host_model, mapping["2"], "name"), read_attribute(host_model, mapping["3"], "name"))
+                    tokens_match = value_eq(read_attribute(host_model, mapping["2"], "tokens"), read_attribute(host_model, mapping["3"], "tokens"))
+                    return bool_and(names_match, tokens_match)!
+                $
+        }
+        RHS {
+            Post_Query/Place {
+                label = "2"
+            }
+            Post_ReachabilityGraph/Place post_3{
+                label = "3"
+            }
+            Post_ReachabilityGraph/State post_4{
+                label = "4"
+                value_error = $
+                    Boolean function value (model : Element, name : String, mapping : Element):
+                        return True!
                     $
                     $
             }
             }
-            RHS {
-                Post_Query/Place {
-                    label = "2"
-                }
-                Post_ReachabilityGraph/Place post_3{
-                    label = "3"
-                }
-                Post_ReachabilityGraph/State post_4{
-                    label = "4"
-                    value_error = $
-                        Boolean function value (model : Element, name : String, mapping : Element):
-                            return True!
-                        $
-                }
-                Post_ReachabilityGraph/Contains (post_4, post_3){
-                    label = "5"
-                }
+            Post_ReachabilityGraph/Contains (post_4, post_3){
+                label = "5"
             }
             }
         }
         }
     }
     }
-    Initial (schedule, query) {}
-    OnSuccess (query, match) {}
-    OnFailure (query, failure) {}
-    OnSuccess (match, success) {}
-    OnFailure (match, failure) {}
 }
 }
+Initial (schedule, query) {}
+OnSuccess (query, match) {}
+OnFailure (query, failure) {}
+OnSuccess (match, success) {}
+OnFailure (match, failure) {}

+ 58 - 63
models/my_pn.mvc

@@ -1,63 +1,58 @@
-import models/PetriNets_Design as PetriNets
-
-PetriNets pn {
-    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
-    }
-}
-
-export pn to models/pn
+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
+}
+

+ 31 - 33
models/petrinet_ports.mvc

@@ -1,39 +1,37 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleClassDiagrams PetriNetsPorts {
-    SimpleAttribute Natural{
-        constraint = $
-            String function constraint(model : Element, name : String):
-                if (is_physical_int(model["model"][name])):
-                    return "OK"!
-                else:
-                    return "Natural has non-integer value"!
-            $
-    }
-
-    SimpleAttribute String{
-        constraint = $
-            String function constraint(model : Element, name : String):
-                if (is_physical_string(model["model"][name])):
-                    return "OK"!
-                else:
-                    return "String has non-string value"!
-            $
-    }
+SimpleAttribute Natural{
+    constraint = $
+        String function constraint(model : Element, name : String):
+            if (is_physical_int(model["model"][name])):
+                return "OK"!
+            else:
+                return "Natural has non-integer value"!
+        $
+}
 
 
-    SimpleAttribute Boolean {}
+SimpleAttribute String{
+    constraint = $
+        String function constraint(model : Element, name : String):
+            if (is_physical_string(model["model"][name])):
+                return "OK"!
+            else:
+                return "String has non-string value"!
+        $
+}
 
 
-    Class Named {
-        name : String
-    }
-    Class Place : Named {
-        tokens : Natural
-    }
-    Class Transition : Named {}
-    Class Port : Named {}
+SimpleAttribute Boolean {}
 
 
-    Association P2T (Place, Transition) {}
-    Association T2P (Transition, Place) {}
-    Association PortPlace (Port, Place) {}
-    Association Related (Port, Port) {}
+Class Named {
+    name : String
 }
 }
+Class Place : Named {
+    tokens : Natural
+}
+Class Transition : Named {}
+Class Port : Named {}
+
+Association P2T (Place, Transition) {}
+Association T2P (Transition, Place) {}
+Association PortPlace (Port, Place) {}
+Association Related (Port, Port) {}

+ 14 - 20
models/petrinets.mvc

@@ -1,22 +1,16 @@
-import models/SimpleClassDiagrams as SimpleClassDiagrams
+SimpleAttribute Natural {}
+SimpleAttribute String {}
 
 
-SimpleClassDiagrams PetriNets_Design{
-    SimpleAttribute Natural {}
-    SimpleAttribute String {}
-
-    Class Place {
-        tokens : Natural
-        name : String
-    }
-    Class Transition {
-        name : String
-    }
-    Association P2T (Place, Transition) {
-        weight : Natural
-    }
-    Association T2P (Transition, Place) {
-        weight : Natural
-    }
+Class Place {
+    tokens : Natural
+    name : String
+}
+Class Transition {
+    name : String
+}
+Association P2T (Place, Transition) {
+    weight : Natural
+}
+Association T2P (Transition, Place) {
+    weight : Natural
 }
 }
-
-export PetriNets_Design to models/PetriNets_Design

+ 14 - 16
models/plant_PW.mvc

@@ -1,19 +1,17 @@
-A B{
-    SimpleAttribute TriState {}
-    SimpleAttribute String {}
-    SimpleAttribute Boolean {}
+SimpleAttribute TriState {}
+SimpleAttribute String {}
+SimpleAttribute Boolean {}
 
 
-    Class State {
-        name : String
-        isInitial : Boolean
-    }
-    Class ErrorState : State {}
-    Class NormalState : State {}
+Class State {
+    name : String
+    isInitial : Boolean
+}
+Class ErrorState : State {}
+Class NormalState : State {}
 
 
-    Association Transition (State, State) {
-        objPresent : TriState
-    }
-    Association OnUp : Transition (State, State) {}
-    Association OnDown : Transition (State, State) {}
-    Association OnNeutral : Transition (State, State) {}
+Association Transition (State, State) {
+    objPresent : TriState
 }
 }
+Association OnUp : Transition (State, State) {}
+Association OnDown : Transition (State, State) {}
+Association OnNeutral : Transition (State, State) {}

+ 101 - 103
models/plant_model.mvc

@@ -1,107 +1,105 @@
-B C{
-    PW_Plant/NormalState lt {
-        name = "low_top"
-        isInitial = False
-    }
-    PW_Plant/NormalState mt {
-        name = "medium_top"
-        isInitial = False
-    }
-    PW_Plant/NormalState ht {
-        name = "high_top"
-        isInitial = False
-    }
-    PW_Plant/NormalState lm {
-        name = "low_mid"
-        isInitial = False
-    }
-    PW_Plant/ErrorState mm {
-        name = "medium_mid"
-        isInitial = False
-    }
-    PW_Plant/ErrorState hm {
-        name = "high_mid"
-        isInitial = False
-    }
-    PW_Plant/NormalState lb {
-        name = "low_bottom"
-        isInitial = False
-    }
-    PW_Plant/NormalState mb {
-        name = "medium_bottom"
-        isInitial = False
-    }
-    PW_Plant/NormalState hb {
-        name = "high_bottom"
-        isInitial = True
-    }
+PW_Plant/NormalState lt {
+    name = "low_top"
+    isInitial = False
+}
+PW_Plant/NormalState mt {
+    name = "medium_top"
+    isInitial = False
+}
+PW_Plant/NormalState ht {
+    name = "high_top"
+    isInitial = False
+}
+PW_Plant/NormalState lm {
+    name = "low_mid"
+    isInitial = False
+}
+PW_Plant/ErrorState mm {
+    name = "medium_mid"
+    isInitial = False
+}
+PW_Plant/ErrorState hm {
+    name = "high_mid"
+    isInitial = False
+}
+PW_Plant/NormalState lb {
+    name = "low_bottom"
+    isInitial = False
+}
+PW_Plant/NormalState mb {
+    name = "medium_bottom"
+    isInitial = False
+}
+PW_Plant/NormalState hb {
+    name = "high_bottom"
+    isInitial = True
+}
 
 
-    PW_Plant/OnUp (hb, mb) {
-        objPresent = "*"
-    }
-    PW_Plant/OnUp (mb, lb) {
-        objPresent = "*"
-    }
-    PW_Plant/OnUp (lb, lm) {
-        objPresent = "*"
-    }
-    PW_Plant/OnUp (lm, lt) {
-        objPresent = "N"
-    }
-    PW_Plant/OnUp (lm, mm) {
-        objPresent = "Y"
-    }
-    PW_Plant/OnUp (mm, hm) {
-        objPresent = "Y"
-    }
-    PW_Plant/OnUp (lt, mt) {
-        objPresent = "*"
-    }
-    PW_Plant/OnUp (mt, ht) {
-        objPresent = "*"
-    }
+PW_Plant/OnUp (hb, mb) {
+    objPresent = "*"
+}
+PW_Plant/OnUp (mb, lb) {
+    objPresent = "*"
+}
+PW_Plant/OnUp (lb, lm) {
+    objPresent = "*"
+}
+PW_Plant/OnUp (lm, lt) {
+    objPresent = "N"
+}
+PW_Plant/OnUp (lm, mm) {
+    objPresent = "Y"
+}
+PW_Plant/OnUp (mm, hm) {
+    objPresent = "Y"
+}
+PW_Plant/OnUp (lt, mt) {
+    objPresent = "*"
+}
+PW_Plant/OnUp (mt, ht) {
+    objPresent = "*"
+}
 
 
-    PW_Plant/OnDown (ht, mt) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (mt, lt) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (lt, lm) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (hm, mm) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (mm, lm) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (lm, lb) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (lb, mb) {
-        objPresent = "*"
-    }
-    PW_Plant/OnDown (mb, hb) {
-        objPresent = "*"
-    }
+PW_Plant/OnDown (ht, mt) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (mt, lt) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (lt, lm) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (hm, mm) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (mm, lm) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (lm, lb) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (lb, mb) {
+    objPresent = "*"
+}
+PW_Plant/OnDown (mb, hb) {
+    objPresent = "*"
+}
 
 
-    PW_Plant/OnNeutral (hb, mb) {
-        objPresent = "*"
-    }
-    PW_Plant/OnNeutral (mb, lb) {
-        objPresent = "*"
-    }
-    PW_Plant/OnNeutral (mm, lm) {
-        objPresent = "*"
-    }
-    PW_Plant/OnNeutral (hm, mm) {
-        objPresent = "*"
-    }
-    PW_Plant/OnNeutral (ht, mt) {
-        objPresent = "*"
-    }
-    PW_Plant/OnNeutral (mt, lt) {
-        objPresent = "*"
-    }
+PW_Plant/OnNeutral (hb, mb) {
+    objPresent = "*"
+}
+PW_Plant/OnNeutral (mb, lb) {
+    objPresent = "*"
+}
+PW_Plant/OnNeutral (mm, lm) {
+    objPresent = "*"
+}
+PW_Plant/OnNeutral (hm, mm) {
+    objPresent = "*"
+}
+PW_Plant/OnNeutral (ht, mt) {
+    objPresent = "*"
+}
+PW_Plant/OnNeutral (mt, lt) {
+    objPresent = "*"
 }
 }

File diff suppressed because it is too large
+ 704 - 706
models/plant_to_EPN.mvc


+ 226 - 228
models/pm_req_analyse.mvc

@@ -1,229 +1,227 @@
-ProcessModel analyse_requirements {
-    Start start {}
-    Finish finish {}
-
-    Exec revise_req {
-        name = "revise_req"
-    }
-    Exec make_initial_models {
-        name = "make_initial_models"
-    }
-
-    Fork fork1 {}
-
-    Exec revise_plant {
-        name = "revise_plant"
-    }
-    Exec revise_environment {
-        name = "revise_environment"
-    }
-    Exec revise_control {
-        name = "revise_control"
-    }
-    Exec revise_query {
-        name = "revise_query"
-    }
-    Exec revise_architecture {
-        name = "revise_architecture"
-    }
-
-    Exec plant_to_EPN {
-        name = "plant_to_EPN"
-    }
-    Exec environment_to_EPN {
-        name = "environment_to_EPN"
-    }
-
-    Exec control_to_EPN {
-        name = "control_to_EPN"
-    }
-
-    Join join2 {}
-
-    Exec combine_EPN {
-        name = "combine_EPN"
-    }
-
-    Exec EPN_to_PN {
-        name = "EPN_to_PN"
-    }
-
-    Exec analyse {
-        name = "reachability"
-    }
-
-    Join join3 {}
-
-    Exec match {
-        name = "match"
-    }
-
-    Exec bfs {
-        name = "bfs"
-    }
-
-    Decision found {}
-
-    Data req {
-        name = "requirements"
-        type = "Requirements"
-    }
-    Data plant_model {
-        name = "plant_model"
-        type = "PW_Plant"
-    }
-    Data environment_model {
-        name = "environment_model"
-        type = "PW_Environment"
-    }
-    Data control_model {
-        name = "control_model"
-        type = "PW_Control"
-    }
-    Data plant_EPN {
-        name = "plant_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data control_EPN {
-        name = "control_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data environment_EPN {
-        name = "environment_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data merged_EPN {
-        name = "merged_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data pn {
-        name = "pn"
-        type = "PetriNet"
-    }
-    Data reachability_graph {
-        name = "reachability"
-        type = "ReachabilityGraph"
-    }
-    Data query {
-        name = "query"
-        type = "Query"
-    }
-    Data architecture {
-        name = "architecture"
-        type = "Architecture"
-    }
-
-    Next (start, make_initial_models) {}
-    Next (make_initial_models, revise_req) {}
-    Next (revise_req, fork1) {}
-    Next (fork1, revise_plant) {}
-    Next (fork1, revise_environment) {}
-    Next (fork1, revise_control) {}
-    Next (fork1, revise_query) {}
-    Next (fork1, revise_architecture) {}
-    Next (revise_plant, plant_to_EPN) {}
-    Next (revise_environment, environment_to_EPN) {}
-    Next (revise_control, control_to_EPN) {}
-    Next (plant_to_EPN, join2) {}
-    Next (environment_to_EPN, join2) {}
-    Next (control_to_EPN, join2) {}
-    Next (revise_architecture, join2) {}
-    Next (join2, combine_EPN) {}
-    Next (combine_EPN, analyse) {}
-    Next (analyse, join3) {}
-    Next (revise_query, join3) {}
-    Next (join3, match) {}
-    Next (match, found) {}
-    Then (found, bfs) {}
-    Next (bfs, fork1) {}
-    Else (found, finish) {}
-
-    Consumes (revise_req, req) {
-    }
-    Produces (revise_req, req) {
-    }
-
-    Produces (make_initial_models, plant_model) {
-    }
-    Produces (make_initial_models, environment_model) {
-    }
-    Produces (make_initial_models, control_model) {
-    }
-    Produces (make_initial_models, query) {
-    }
-    Produces (make_initial_models, architecture) {
-    }
-    Produces (make_initial_models, req) {
-    }
-
-    Consumes (revise_plant, req) {
-    }
-    Consumes (revise_environment, req) {
-    }
-    Consumes (revise_control, req) {
-    }
-    Consumes (revise_query, req) {
-    }
-    Consumes (revise_architecture, req) {
-    }
-
-    Consumes (revise_plant, plant_model) {
-    }
-    Consumes (revise_environment, environment_model) {
-    }
-    Consumes (revise_control, control_model) {
-    }
-    Consumes (revise_query, query) {
-    }
-    Consumes (revise_architecture, architecture) {
-    }
-    Produces (revise_plant, plant_model) {
-    }
-    Produces (revise_control, control_model) {
-    }
-    Produces (revise_environment, environment_model) {
-    }
-    Produces (revise_query, query) {
-    }
-    Produces (revise_architecture, architecture) {
-    }
-
-    Consumes (plant_to_EPN, plant_model) {
-    }
-    Produces (plant_to_EPN, plant_EPN) {
-    }
-    Consumes (environment_to_EPN, environment_model) {
-    }
-    Produces (environment_to_EPN, environment_EPN) {
-    }
-    Consumes (control_to_EPN, control_model) {
-    }
-    Produces (control_to_EPN, control_EPN) {
-    }
-
-    Consumes (combine_EPN, plant_EPN) {
-    }
-    Consumes (combine_EPN, environment_EPN) {
-    }
-    Consumes (combine_EPN, control_EPN) {
-    }
-    Consumes (combine_EPN, architecture) {
-    }
-    Produces (combine_EPN, pn) {
-    }
-
-    Consumes (analyse, pn) {
-    }
-    Produces (analyse, reachability_graph) {
-    }
-
-    Consumes (match, reachability_graph) {
-    }
-    Consumes (match, query) {
-    }
-    Produces (match, reachability_graph) {
-    }
-
-    Consumes (bfs, reachability_graph) {
-    }
+Start start {}
+Finish finish {}
+
+Exec revise_req {
+    name = "revise_req"
+}
+Exec make_initial_models {
+    name = "make_initial_models"
+}
+
+Fork fork1 {}
+
+Exec revise_plant {
+    name = "revise_plant"
+}
+Exec revise_environment {
+    name = "revise_environment"
+}
+Exec revise_control {
+    name = "revise_control"
+}
+Exec revise_query {
+    name = "revise_query"
+}
+Exec revise_architecture {
+    name = "revise_architecture"
+}
+
+Exec plant_to_EPN {
+    name = "plant_to_EPN"
+}
+Exec environment_to_EPN {
+    name = "environment_to_EPN"
+}
+
+Exec control_to_EPN {
+    name = "control_to_EPN"
+}
+
+Join join2 {}
+
+Exec combine_EPN {
+    name = "combine_EPN"
+}
+
+Exec EPN_to_PN {
+    name = "EPN_to_PN"
+}
+
+Exec analyse {
+    name = "reachability"
+}
+
+Join join3 {}
+
+Exec match {
+    name = "match"
+}
+
+Exec bfs {
+    name = "bfs"
+}
+
+Decision found {}
+
+Data req {
+    name = "requirements"
+    type = "Requirements"
+}
+Data plant_model {
+    name = "plant_model"
+    type = "PW_Plant"
+}
+Data environment_model {
+    name = "environment_model"
+    type = "PW_Environment"
+}
+Data control_model {
+    name = "control_model"
+    type = "PW_Control"
+}
+Data plant_EPN {
+    name = "plant_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data control_EPN {
+    name = "control_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data environment_EPN {
+    name = "environment_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data merged_EPN {
+    name = "merged_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data pn {
+    name = "pn"
+    type = "PetriNet"
+}
+Data reachability_graph {
+    name = "reachability"
+    type = "ReachabilityGraph"
+}
+Data query {
+    name = "query"
+    type = "Query"
+}
+Data architecture {
+    name = "architecture"
+    type = "Architecture"
+}
+
+Next (start, make_initial_models) {}
+Next (make_initial_models, revise_req) {}
+Next (revise_req, fork1) {}
+Next (fork1, revise_plant) {}
+Next (fork1, revise_environment) {}
+Next (fork1, revise_control) {}
+Next (fork1, revise_query) {}
+Next (fork1, revise_architecture) {}
+Next (revise_plant, plant_to_EPN) {}
+Next (revise_environment, environment_to_EPN) {}
+Next (revise_control, control_to_EPN) {}
+Next (plant_to_EPN, join2) {}
+Next (environment_to_EPN, join2) {}
+Next (control_to_EPN, join2) {}
+Next (revise_architecture, join2) {}
+Next (join2, combine_EPN) {}
+Next (combine_EPN, analyse) {}
+Next (analyse, join3) {}
+Next (revise_query, join3) {}
+Next (join3, match) {}
+Next (match, found) {}
+Then (found, bfs) {}
+Next (bfs, fork1) {}
+Else (found, finish) {}
+
+Consumes (revise_req, req) {
+}
+Produces (revise_req, req) {
+}
+
+Produces (make_initial_models, plant_model) {
+}
+Produces (make_initial_models, environment_model) {
+}
+Produces (make_initial_models, control_model) {
+}
+Produces (make_initial_models, query) {
+}
+Produces (make_initial_models, architecture) {
+}
+Produces (make_initial_models, req) {
+}
+
+Consumes (revise_plant, req) {
+}
+Consumes (revise_environment, req) {
+}
+Consumes (revise_control, req) {
+}
+Consumes (revise_query, req) {
+}
+Consumes (revise_architecture, req) {
+}
+
+Consumes (revise_plant, plant_model) {
+}
+Consumes (revise_environment, environment_model) {
+}
+Consumes (revise_control, control_model) {
+}
+Consumes (revise_query, query) {
+}
+Consumes (revise_architecture, architecture) {
+}
+Produces (revise_plant, plant_model) {
+}
+Produces (revise_control, control_model) {
+}
+Produces (revise_environment, environment_model) {
+}
+Produces (revise_query, query) {
+}
+Produces (revise_architecture, architecture) {
+}
+
+Consumes (plant_to_EPN, plant_model) {
+}
+Produces (plant_to_EPN, plant_EPN) {
+}
+Consumes (environment_to_EPN, environment_model) {
+}
+Produces (environment_to_EPN, environment_EPN) {
+}
+Consumes (control_to_EPN, control_model) {
+}
+Produces (control_to_EPN, control_EPN) {
+}
+
+Consumes (combine_EPN, plant_EPN) {
+}
+Consumes (combine_EPN, environment_EPN) {
+}
+Consumes (combine_EPN, control_EPN) {
+}
+Consumes (combine_EPN, architecture) {
+}
+Produces (combine_EPN, pn) {
+}
+
+Consumes (analyse, pn) {
+}
+Produces (analyse, reachability_graph) {
+}
+
+Consumes (match, reachability_graph) {
+}
+Consumes (match, query) {
+}
+Produces (match, reachability_graph) {
+}
+
+Consumes (bfs, reachability_graph) {
 }
 }

+ 227 - 229
models/pm_req_analyse_debug.mvc

@@ -1,256 +1,254 @@
-ProcessModel analyse_requirements {
-    Start start {}
-    Finish finish {}
+Start start {}
+Finish finish {}
 
 
-    Exec revise_req {
-        name = "revise_req"
-    }
-    Exec make_initial_models {
-        name = "make_initial_models"
-    }
-
-    Fork fork1 {}
+Exec revise_req {
+    name = "revise_req"
+}
+Exec make_initial_models {
+    name = "make_initial_models"
+}
 
 
-    Exec revise_plant {
-        name = "revise_plant"
-    }
-    Exec revise_environment {
-        name = "revise_environment"
-    }
-    Exec revise_control {
-        name = "revise_control"
-    }
-    Exec revise_query {
-        name = "revise_query"
-    }
-    Exec revise_architecture {
-        name = "revise_architecture"
-    }
+Fork fork1 {}
 
 
-    Exec plant_to_EPN {
-        name = "plant_to_EPN"
-    }
-    Exec print_plant_EPN{
-        name = "epn_print"
-    }
-    Exec environment_to_EPN {
-        name = "environment_to_EPN"
-    }
-    Exec print_env_EPN{
-        name = "epn_print"
-    }
+Exec revise_plant {
+    name = "revise_plant"
+}
+Exec revise_environment {
+    name = "revise_environment"
+}
+Exec revise_control {
+    name = "revise_control"
+}
+Exec revise_query {
+    name = "revise_query"
+}
+Exec revise_architecture {
+    name = "revise_architecture"
+}
 
 
-    Exec control_to_EPN {
-        name = "control_to_EPN"
-    }
-    Exec print_control_EPN{
-        name = "epn_print"
-    }
+Exec plant_to_EPN {
+    name = "plant_to_EPN"
+}
+Exec print_plant_EPN{
+    name = "epn_print"
+}
+Exec environment_to_EPN {
+    name = "environment_to_EPN"
+}
+Exec print_env_EPN{
+    name = "epn_print"
+}
 
 
-    Join join2 {}
+Exec control_to_EPN {
+    name = "control_to_EPN"
+}
+Exec print_control_EPN{
+    name = "epn_print"
+}
 
 
-    Exec combine_EPN {
-        name = "combine_EPN"
-    }
+Join join2 {}
 
 
-    Exec print_pn {
-        name = "pn_print"
-    }
+Exec combine_EPN {
+    name = "combine_EPN"
+}
 
 
-    Exec EPN_to_PN {
-        name = "EPN_to_PN"
-    }
+Exec print_pn {
+    name = "pn_print"
+}
 
 
-    Exec analyse {
-        name = "reachability"
-    }
+Exec EPN_to_PN {
+    name = "EPN_to_PN"
+}
 
 
-    Join join3 {}
+Exec analyse {
+    name = "reachability"
+}
 
 
-    Exec match {
-        name = "match"
-    }
+Join join3 {}
 
 
-    Exec bfs {
-        name = "bfs"
-    }
+Exec match {
+    name = "match"
+}
 
 
-    Decision found {}
+Exec bfs {
+    name = "bfs"
+}
 
 
-    Data req {
-        name = "requirements"
-        type = "Requirements"
-    }
-    Data plant_model {
-        name = "plant_model"
-        type = "PW_Plant"
-    }
-    Data environment_model {
-        name = "environment_model"
-        type = "PW_Environment"
-    }
-    Data control_model {
-        name = "control_model"
-        type = "PW_Control"
-    }
-    Data plant_EPN {
-        name = "plant_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data control_EPN {
-        name = "control_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data environment_EPN {
-        name = "environment_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data merged_EPN {
-        name = "merged_EPN"
-        type = "Encapsulated_PetriNet"
-    }
-    Data pn {
-        name = "pn"
-        type = "PetriNet"
-    }
-    Data reachability_graph {
-        name = "reachability"
-        type = "ReachabilityGraph"
-    }
-    Data query {
-        name = "query"
-        type = "Query"
-    }
-    Data architecture {
-        name = "architecture"
-        type = "Architecture"
-    }
+Decision found {}
 
 
-    Next (start, make_initial_models) {}
-    Next (make_initial_models, revise_req) {}
-    Next (revise_req, fork1) {}
-    Next (fork1, revise_plant) {}
-    Next (fork1, revise_environment) {}
-    Next (fork1, revise_control) {}
-    Next (fork1, revise_query) {}
-    Next (fork1, revise_architecture) {}
-    Next (revise_plant, plant_to_EPN) {}
-    Next (revise_environment, environment_to_EPN) {}
-    Next (revise_control, control_to_EPN) {}
-    Next (plant_to_EPN, print_plant_EPN) {}
-    Next (print_plant_EPN, join2) {}
-    Next (environment_to_EPN, print_env_EPN) {}
-    Next (print_env_EPN, join2) {}
-    Next (control_to_EPN, print_control_EPN) {}
-    Next (print_control_EPN, join2) {}
-    Next (revise_architecture, join2) {}
-    Next (join2, combine_EPN) {}
-    Next (combine_EPN, print_pn) {}
-    Next (print_pn, analyse) {}
-    Next (analyse, join3) {}
-    Next (revise_query, join3) {}
-    Next (join3, match) {}
-    Next (match, found) {}
-    Then (found, bfs) {}
-    Next (bfs, fork1) {}
-    Else (found, finish) {}
+Data req {
+    name = "requirements"
+    type = "Requirements"
+}
+Data plant_model {
+    name = "plant_model"
+    type = "PW_Plant"
+}
+Data environment_model {
+    name = "environment_model"
+    type = "PW_Environment"
+}
+Data control_model {
+    name = "control_model"
+    type = "PW_Control"
+}
+Data plant_EPN {
+    name = "plant_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data control_EPN {
+    name = "control_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data environment_EPN {
+    name = "environment_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data merged_EPN {
+    name = "merged_EPN"
+    type = "Encapsulated_PetriNet"
+}
+Data pn {
+    name = "pn"
+    type = "PetriNet"
+}
+Data reachability_graph {
+    name = "reachability"
+    type = "ReachabilityGraph"
+}
+Data query {
+    name = "query"
+    type = "Query"
+}
+Data architecture {
+    name = "architecture"
+    type = "Architecture"
+}
 
 
-    Consumes (revise_req, req) {
-    }
-    Produces (revise_req, req) {
-    }
+Next (start, make_initial_models) {}
+Next (make_initial_models, revise_req) {}
+Next (revise_req, fork1) {}
+Next (fork1, revise_plant) {}
+Next (fork1, revise_environment) {}
+Next (fork1, revise_control) {}
+Next (fork1, revise_query) {}
+Next (fork1, revise_architecture) {}
+Next (revise_plant, plant_to_EPN) {}
+Next (revise_environment, environment_to_EPN) {}
+Next (revise_control, control_to_EPN) {}
+Next (plant_to_EPN, print_plant_EPN) {}
+Next (print_plant_EPN, join2) {}
+Next (environment_to_EPN, print_env_EPN) {}
+Next (print_env_EPN, join2) {}
+Next (control_to_EPN, print_control_EPN) {}
+Next (print_control_EPN, join2) {}
+Next (revise_architecture, join2) {}
+Next (join2, combine_EPN) {}
+Next (combine_EPN, print_pn) {}
+Next (print_pn, analyse) {}
+Next (analyse, join3) {}
+Next (revise_query, join3) {}
+Next (join3, match) {}
+Next (match, found) {}
+Then (found, bfs) {}
+Next (bfs, fork1) {}
+Else (found, finish) {}
+
+Consumes (revise_req, req) {
+}
+Produces (revise_req, req) {
+}
 
 
-    Produces (make_initial_models, plant_model) {
-    }
-    Produces (make_initial_models, environment_model) {
-    }
-    Produces (make_initial_models, control_model) {
-    }
-    Produces (make_initial_models, query) {
-    }
-    Produces (make_initial_models, architecture) {
-    }
-    Produces (make_initial_models, req) {
-    }
+Produces (make_initial_models, plant_model) {
+}
+Produces (make_initial_models, environment_model) {
+}
+Produces (make_initial_models, control_model) {
+}
+Produces (make_initial_models, query) {
+}
+Produces (make_initial_models, architecture) {
+}
+Produces (make_initial_models, req) {
+}
 
 
-    Consumes (revise_plant, req) {
-    }
-    Consumes (revise_environment, req) {
-    }
-    Consumes (revise_control, req) {
-    }
-    Consumes (revise_query, req) {
-    }
-    Consumes (revise_architecture, req) {
-    }
+Consumes (revise_plant, req) {
+}
+Consumes (revise_environment, req) {
+}
+Consumes (revise_control, req) {
+}
+Consumes (revise_query, req) {
+}
+Consumes (revise_architecture, req) {
+}
 
 
-    Consumes (revise_plant, plant_model) {
-    }
-    Consumes (revise_environment, environment_model) {
-    }
-    Consumes (revise_control, control_model) {
-    }
-    Consumes (revise_query, query) {
-    }
-    Consumes (revise_architecture, architecture) {
-    }
-    Produces (revise_plant, plant_model) {
-    }
-    Produces (revise_control, control_model) {
-    }
-    Produces (revise_environment, environment_model) {
-    }
-    Produces (revise_query, query) {
-    }
-    Produces (revise_architecture, architecture) {
-    }
+Consumes (revise_plant, plant_model) {
+}
+Consumes (revise_environment, environment_model) {
+}
+Consumes (revise_control, control_model) {
+}
+Consumes (revise_query, query) {
+}
+Consumes (revise_architecture, architecture) {
+}
+Produces (revise_plant, plant_model) {
+}
+Produces (revise_control, control_model) {
+}
+Produces (revise_environment, environment_model) {
+}
+Produces (revise_query, query) {
+}
+Produces (revise_architecture, architecture) {
+}
 
 
-    Consumes (plant_to_EPN, plant_model) {
-    }
-    Produces (plant_to_EPN, plant_EPN) {
-    }
-    Consumes (environment_to_EPN, environment_model) {
-    }
-    Produces (environment_to_EPN, environment_EPN) {
-    }
-    Consumes (control_to_EPN, control_model) {
-    }
-    Produces (control_to_EPN, control_EPN) {
-    }
+Consumes (plant_to_EPN, plant_model) {
+}
+Produces (plant_to_EPN, plant_EPN) {
+}
+Consumes (environment_to_EPN, environment_model) {
+}
+Produces (environment_to_EPN, environment_EPN) {
+}
+Consumes (control_to_EPN, control_model) {
+}
+Produces (control_to_EPN, control_EPN) {
+}
 
 
-    Consumes (combine_EPN, plant_EPN) {
-    }
-    Consumes (combine_EPN, environment_EPN) {
-    }
-    Consumes (combine_EPN, control_EPN) {
-    }
-    Consumes (combine_EPN, architecture) {
-    }
-    Produces (combine_EPN, pn) {
-    }
+Consumes (combine_EPN, plant_EPN) {
+}
+Consumes (combine_EPN, environment_EPN) {
+}
+Consumes (combine_EPN, control_EPN) {
+}
+Consumes (combine_EPN, architecture) {
+}
+Produces (combine_EPN, pn) {
+}
 
 
-    Consumes (analyse, pn) {
-    }
-    Produces (analyse, reachability_graph) {
-    }
+Consumes (analyse, pn) {
+}
+Produces (analyse, reachability_graph) {
+}
 
 
-    Consumes (match, reachability_graph) {
-    }
-    Consumes (match, query) {
-    }
-    Produces (match, reachability_graph) {
-    }
+Consumes (match, reachability_graph) {
+}
+Consumes (match, query) {
+}
+Produces (match, reachability_graph) {
+}
 
 
-    Consumes (bfs, reachability_graph) {
-    }
+Consumes (bfs, reachability_graph) {
+}
 
 
-    Consumes (print_pn, pn) {
-    }
+Consumes (print_pn, pn) {
+}
 
 
-    Consumes (print_plant_EPN, plant_EPN){
-    }
-    Consumes (print_control_EPN, control_EPN){
-    }
-    Consumes (print_env_EPN, environment_EPN){
-    }
+Consumes (print_plant_EPN, plant_EPN){
+}
+Consumes (print_control_EPN, control_EPN){
+}
+Consumes (print_env_EPN, environment_EPN){
 }
 }

+ 7 - 9
models/query.mvc

@@ -2,14 +2,12 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 include "modelling.alh"
 include "modelling.alh"
 
 
-SimpleClassDiagrams Query {
-    SimpleAttribute String {}
-    SimpleAttribute Natural {}
+SimpleAttribute String {}
+SimpleAttribute Natural {}
 
 
-    Class Place {
-        name : String
-        tokens : Natural
-        lower_cardinality = 1
-        upper_cardinality = 1
-    }
+Class Place {
+    name : String
+    tokens : Natural
+    lower_cardinality = 1
+    upper_cardinality = 1
 }
 }

+ 3 - 5
models/query_model.mvc

@@ -1,6 +1,4 @@
-A B {
-    Query/Place high_mid {
-        name = "high_mid"
-        tokens = 1
-    }
+Query/Place high_mid {
+    name = "high_mid"
+    tokens = 1
 }
 }

+ 51 - 53
models/reachability_graph.mvc

@@ -2,63 +2,61 @@ include "primitives.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 include "modelling.alh"
 include "modelling.alh"
 
 
-SimpleClassDiagrams ReachabilityGraph {
-    SimpleAttribute String {}
-    SimpleAttribute Natural {}
-    SimpleAttribute Boolean {}
+SimpleAttribute String {}
+SimpleAttribute Natural {}
+SimpleAttribute Boolean {}
 
 
-    Class State {
-        name : String
-        error : Boolean
-    }
-    Class InitialState : State {
-        lower_cardinality = 1
-        upper_cardinality = 1
-    }
-
-    Class Place {
-        name : String
-        tokens : Natural
-    }
-    Association Transition (State, State) {
-        name : String
-    }
-    Association Contains (State, Place) {}
+Class State {
+    name : String
+    error : Boolean
+}
+Class InitialState : State {
+    lower_cardinality = 1
+    upper_cardinality = 1
+}
 
 
-    GlobalConstraint {
-        global_constraint = $
-            String function constraint(model : Element):
-                Element states
-                Element places
-                String state
-                String place
-                Element expected
-                Element got
+Class Place {
+    name : String
+    tokens : Natural
+}
+Association Transition (State, State) {
+    name : String
+}
+Association Contains (State, Place) {}
 
 
-                states = allInstances(model, "State")
+GlobalConstraint {
+    global_constraint = $
+        String function constraint(model : Element):
+            Element states
+            Element places
+            String state
+            String place
+            Element expected
+            Element got
 
 
-                if (read_nr_out(states) > 0):
-                    expected = create_node()
-                    state = set_pop(states)
-                    places = allAssociationDestinations(model, state, "Contains")
-                    while (read_nr_out(places)):
-                        place = set_pop(places)
-                        set_add(expected, read_attribute(model, place, "name"))
-                else:
-                    return "OK"!
-                
-                while (read_nr_out(states) > 0):
-                    got = create_node()
-                    state = set_pop(states)
-                    places = allAssociationDestinations(model, state, "Contains")
-                    while (read_nr_out(places)):
-                        place = set_pop(places)
-                        set_add(got, read_attribute(model, place, "name"))
+            states = allInstances(model, "State")
 
 
-                    if (bool_not(set_equality(got, expected))):
-                        return "States don't all agree on the set of places"!
-                
+            if (read_nr_out(states) > 0):
+                expected = create_node()
+                state = set_pop(states)
+                places = allAssociationDestinations(model, state, "Contains")
+                while (read_nr_out(places)):
+                    place = set_pop(places)
+                    set_add(expected, read_attribute(model, place, "name"))
+            else:
                 return "OK"!
                 return "OK"!
-            $
-    }
+            
+            while (read_nr_out(states) > 0):
+                got = create_node()
+                state = set_pop(states)
+                places = allAssociationDestinations(model, state, "Contains")
+                while (read_nr_out(places)):
+                    place = set_pop(places)
+                    set_add(got, read_attribute(model, place, "name"))
+
+                if (bool_not(set_equality(got, expected))):
+                    return "States don't all agree on the set of places"!
+            
+            return "OK"!
+        $
 }
 }

+ 56 - 58
models/reachabilitygraph_print.mvc

@@ -2,70 +2,68 @@ include "primitives.alh"
 include "modelling.alh"
 include "modelling.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
-ReachabilityGraph_RAM reachabilitygraph_print {
-    Composite schedule {
-        {Contains} Success success {}
-        {Contains} Failure failure {}
-        {Contains} ForAll print_states {
-            LHS {
-                Pre_ReachabilityGraph/State {
-                    label = "0"
-                }
+Composite schedule {
+    {Contains} Success success {}
+    {Contains} Failure failure {}
+    {Contains} ForAll print_states {
+        LHS {
+            Pre_ReachabilityGraph/State {
+                label = "0"
             }
             }
-            RHS {
-                Post_ReachabilityGraph/State {
-                    label = "0"
-                    action = $
-                        Void function action(model : Element, name : String, mapping : Element):
-                            Element dict_values
-                            Element all_values
-                            String place
-                            dict_values = create_node()
-                            all_values = allAssociationDestinations(model, name, "ReachabilityGraph/Contains")
-                            while (read_nr_out(all_values) > 0):
-                                place = set_pop(all_values)
-                                dict_add(dict_values, read_attribute(model, place, "name"), read_attribute(model, place, "tokens"))
-                            output((cast_v2s(read_attribute(model, name, "name")) + ": ") + dict_to_string(dict_values))
-                            return!
-                        $
-                }
+        }
+        RHS {
+            Post_ReachabilityGraph/State {
+                label = "0"
+                action = $
+                    Void function action(model : Element, name : String, mapping : Element):
+                        Element dict_values
+                        Element all_values
+                        String place
+                        dict_values = create_node()
+                        all_values = allAssociationDestinations(model, name, "ReachabilityGraph/Contains")
+                        while (read_nr_out(all_values) > 0):
+                            place = set_pop(all_values)
+                            dict_add(dict_values, read_attribute(model, place, "name"), read_attribute(model, place, "tokens"))
+                        output((cast_v2s(read_attribute(model, name, "name")) + ": ") + dict_to_string(dict_values))
+                        return!
+                    $
             }
             }
         }
         }
+    }
 
 
-        {Contains} ForAll print_transitions {
-            LHS {
-                Pre_ReachabilityGraph/State pre_s1 {
-                    label = "0"
-                }
-                Pre_ReachabilityGraph/State pre_s2 {
-                    label = "1"
-                }
-                Pre_ReachabilityGraph/Transition (pre_s1, pre_s2){
-                    label = "2"
-                }
+    {Contains} ForAll print_transitions {
+        LHS {
+            Pre_ReachabilityGraph/State pre_s1 {
+                label = "0"
+            }
+            Pre_ReachabilityGraph/State pre_s2 {
+                label = "1"
             }
             }
-            RHS {
-                Post_ReachabilityGraph/State post_s1 {
-                    label = "0"
-                }
-                Post_ReachabilityGraph/State post_s2 {
-                    label = "1"
-                }
-                Post_ReachabilityGraph/Transition (post_s1, post_s2) {
-                    label = "2"
-                    action = $
-                        Void function action(model : Element, name : String, mapping : Element):
-                            output((((cast_v2s(read_attribute(model, mapping["0"], "name")) + " --[") + cast_v2s(read_attribute(model, name, "name"))) + "]--> ") + cast_v2s(read_attribute(model, mapping["1"], "name")))
-                            return!
-                        $
-                }
+            Pre_ReachabilityGraph/Transition (pre_s1, pre_s2){
+                label = "2"
+            }
+        }
+        RHS {
+            Post_ReachabilityGraph/State post_s1 {
+                label = "0"
+            }
+            Post_ReachabilityGraph/State post_s2 {
+                label = "1"
+            }
+            Post_ReachabilityGraph/Transition (post_s1, post_s2) {
+                label = "2"
+                action = $
+                    Void function action(model : Element, name : String, mapping : Element):
+                        output((((cast_v2s(read_attribute(model, mapping["0"], "name")) + " --[") + cast_v2s(read_attribute(model, name, "name"))) + "]--> ") + cast_v2s(read_attribute(model, mapping["1"], "name")))
+                        return!
+                    $
             }
             }
         }
         }
     }
     }
-
-    Initial (schedule, print_states) {}
-    OnSuccess (print_states, print_transitions) {}
-    OnFailure (print_states, failure) {}
-    OnSuccess (print_transitions, success) {}
-    OnFailure (print_transitions, success) {}
 }
 }
+
+Initial (schedule, print_states) {}
+OnSuccess (print_states, print_transitions) {}
+OnFailure (print_states, failure) {}
+OnSuccess (print_transitions, success) {}
+OnFailure (print_transitions, success) {}

+ 21 - 23
models/requirements.mvc

@@ -1,27 +1,25 @@
 include "primitives.alh"
 include "primitives.alh"
 
 
-SimpleClassDiagrams Requirements{
-    SimpleAttribute String{
-        constraint = $
-            String function constraint_String(model : Element, name : String):
-                if (is_physical_string(model["model"][name])):
-                    return "OK"!
-                else:
-                    return "String has non-string value"!
-            $
-    }
+SimpleAttribute String{
+    constraint = $
+        String function constraint_String(model : Element, name : String):
+            if (is_physical_string(model["model"][name])):
+                return "OK"!
+            else:
+                return "String has non-string value"!
+        $
+}
 
 
-    Class UseCase {
-        name : String
-        scope : String
-        level : String
-        actors : String
-        preconditions : String
-        postconditions : String
-        main_success_scenario : String
-        alternative_scenario : String
-        alternate_scenario_misuse: String
-        special_requirements : String
-        technology : String
-    }
+Class UseCase {
+    name : String
+    scope : String
+    level : String
+    actors : String
+    preconditions : String
+    postconditions : String
+    main_success_scenario : String
+    alternative_scenario : String
+    alternate_scenario_misuse: String
+    special_requirements : String
+    technology : String
 }
 }

+ 4 - 6
models/requirements_model.mvc

@@ -1,7 +1,5 @@
-Requirements req {
-    Requirements/UseCase {
-        name = "Raise passenger window"
-        scope = "System-wide"
-        postconditions = "Window has stopped."
-    }
+Requirements/UseCase {
+    name = "Raise passenger window"
+    scope = "System-wide"
+    postconditions = "Window has stopped."
 }
 }

+ 10 - 12
models/trace.mvc

@@ -1,15 +1,13 @@
-SCD TraceLanguage{
-    SimpleAttribute String {}
-    SimpleAttribute Float {}
+SimpleAttribute String {}
+SimpleAttribute Float {}
 
 
-    Class Signal {
-        name : String
-    }
-
-    Class Point {
-        x : Float
-        y : Float
-    }
+Class Signal {
+    name : String
+}
 
 
-    Association contains (Signal, Point) {}
+Class Point {
+    x : Float
+    y : Float
 }
 }
+
+Association contains (Signal, Point) {}

+ 121 - 123
models/trace_example.mvc

@@ -1,124 +1,122 @@
-TraceLanguage trace {
-    Signal signal_x {
-        name = "position"
-    }
-
-    Point px_0 {
-        x = 0.0
-        y = 0.0
-    }
-
-    Point px_1 {
-        x = 1.0
-        y = 0.5
-    }
-
-    Point px_2 {
-        x = 2.0
-        y = 2.0
-    }
-
-    Point px_3 {
-        x = 3.0
-        y = 4.5
-    }
-
-    Point px_4 {
-        x = 4.0
-        y = 8.0
-    }
-
-    Point px_5 {
-        x = 5.0
-        y = 12.5
-    }
-
-    contains (signal_x, px_0) {}
-    contains (signal_x, px_1) {}
-    contains (signal_x, px_2) {}
-    contains (signal_x, px_3) {}
-    contains (signal_x, px_4) {}
-    contains (signal_x, px_5) {}
-
-    Signal signal_v {
-        name = "velocity"
-    }
-
-    Point pv_0 {
-        x = 0.0
-        y = 0.0
-    }
-
-    Point pv_1 {
-        x = 1.0
-        y = 1.0
-    }
-
-    Point pv_2 {
-        x = 2.0
-        y = 2.0
-    }
-
-    Point pv_3 {
-        x = 3.0
-        y = 3.0
-    }
-
-    Point pv_4 {
-        x = 4.0
-        y = 4.0
-    }
-
-    Point pv_5 {
-        x = 5.0
-        y = 5.0
-    }
-
-    contains (signal_v, pv_0) {}
-    contains (signal_v, pv_1) {}
-    contains (signal_v, pv_2) {}
-    contains (signal_v, pv_3) {}
-    contains (signal_v, pv_4) {}
-    contains (signal_v, pv_5) {}
-
-    Signal signal_a {
-        name = "acceleration"
-    }
-
-    Point pa_0 {
-        x = 0.0
-        y = 1.0
-    }
-
-    Point pa_1 {
-        x = 1.0
-        y = 1.0
-    }
-
-    Point pa_2 {
-        x = 2.0
-        y = 1.0
-    }
-
-    Point pa_3 {
-        x = 3.0
-        y = 1.0
-    }
-
-    Point pa_4 {
-        x = 4.0
-        y = 1.0
-    }
-
-    Point pa_5 {
-        x = 5.0
-        y = 1.0
-    }
-
-    contains (signal_a, pa_0) {}
-    contains (signal_a, pa_1) {}
-    contains (signal_a, pa_2) {}
-    contains (signal_a, pa_3) {}
-    contains (signal_a, pa_4) {}
-    contains (signal_a, pa_5) {}
+Signal signal_x {
+    name = "position"
 }
 }
+
+Point px_0 {
+    x = 0.0
+    y = 0.0
+}
+
+Point px_1 {
+    x = 1.0
+    y = 0.5
+}
+
+Point px_2 {
+    x = 2.0
+    y = 2.0
+}
+
+Point px_3 {
+    x = 3.0
+    y = 4.5
+}
+
+Point px_4 {
+    x = 4.0
+    y = 8.0
+}
+
+Point px_5 {
+    x = 5.0
+    y = 12.5
+}
+
+contains (signal_x, px_0) {}
+contains (signal_x, px_1) {}
+contains (signal_x, px_2) {}
+contains (signal_x, px_3) {}
+contains (signal_x, px_4) {}
+contains (signal_x, px_5) {}
+
+Signal signal_v {
+    name = "velocity"
+}
+
+Point pv_0 {
+    x = 0.0
+    y = 0.0
+}
+
+Point pv_1 {
+    x = 1.0
+    y = 1.0
+}
+
+Point pv_2 {
+    x = 2.0
+    y = 2.0
+}
+
+Point pv_3 {
+    x = 3.0
+    y = 3.0
+}
+
+Point pv_4 {
+    x = 4.0
+    y = 4.0
+}
+
+Point pv_5 {
+    x = 5.0
+    y = 5.0
+}
+
+contains (signal_v, pv_0) {}
+contains (signal_v, pv_1) {}
+contains (signal_v, pv_2) {}
+contains (signal_v, pv_3) {}
+contains (signal_v, pv_4) {}
+contains (signal_v, pv_5) {}
+
+Signal signal_a {
+    name = "acceleration"
+}
+
+Point pa_0 {
+    x = 0.0
+    y = 1.0
+}
+
+Point pa_1 {
+    x = 1.0
+    y = 1.0
+}
+
+Point pa_2 {
+    x = 2.0
+    y = 1.0
+}
+
+Point pa_3 {
+    x = 3.0
+    y = 1.0
+}
+
+Point pa_4 {
+    x = 4.0
+    y = 1.0
+}
+
+Point pa_5 {
+    x = 5.0
+    y = 1.0
+}
+
+contains (signal_a, pa_0) {}
+contains (signal_a, pa_1) {}
+contains (signal_a, pa_2) {}
+contains (signal_a, pa_3) {}
+contains (signal_a, pa_4) {}
+contains (signal_a, pa_5) {}

+ 125 - 127
models/trace_mapper.mvc

@@ -2,140 +2,138 @@ include "primitives.alh"
 include "modelling.alh"
 include "modelling.alh"
 include "object_operations.alh"
 include "object_operations.alh"
 
 
-A B {
-    Composite schedule {
-        {Contains} Success success {}
+Composite schedule {
+    {Contains} Success success {}
 
 
-        {Contains} ForAll render_dataset {
-            LHS {
-                Pre_Trace/Signal {
-                    label = "0"
-                }
-            }
-            RHS {
-                Post_Trace/Signal post_ds_0 {
-                    label = "0"
-                }
-                Post_MM_rendered_plot/Plot post_ds_1 {
-                    label = "1"
-                    value_title = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["0"], "name")!
-                        $
-                    value_legend = $
-                        Boolean function value(model : Element, name : String, mapping : Element):
-                            return False!
-                        $
-                }
-                Post_MM_rendered_plot/Dataset post_ds_2 {
-                    label = "2"
-                    value_legend = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "signal"!
-                        $
-                    value_color = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "blue"!
-                        $
-                    value_linestyle = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "solid"!
-                        $
-                }
-                Post_TracabilityPlot (post_ds_0, post_ds_2) {
-                    label = "3"
-                }
-                Post_MM_rendered_plot/XAxis post_ds_4 {
-                    label = "4"
-                    value_name = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "time"!
-                        $
-                    value_unit = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "seconds"!
-                        $
-                }
-                Post_MM_rendered_plot/YAxis post_ds_5 {
-                    label = "5"
-                    value_name = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "signal"!
-                        $
-                    value_unit = $
-                        String function value(model : Element, name : String, mapping : Element):
-                            return "power"!
-                        $
-                }
-                Post_MM_rendered_plot/x (post_ds_1, post_ds_4) {
-                    label = "6"
-                }
-                Post_MM_rendered_plot/y (post_ds_1, post_ds_5) {
-                    label = "7"
-                }
-                Post_MM_rendered_plot/data (post_ds_1, post_ds_2) {
-                    label = "8"
-                }
+    {Contains} ForAll render_dataset {
+        LHS {
+            Pre_Trace/Signal {
+                label = "0"
             }
             }
         }
         }
+        RHS {
+            Post_Trace/Signal post_ds_0 {
+                label = "0"
+            }
+            Post_MM_rendered_plot/Plot post_ds_1 {
+                label = "1"
+                value_title = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["0"], "name")!
+                    $
+                value_legend = $
+                    Boolean function value(model : Element, name : String, mapping : Element):
+                        return False!
+                    $
+            }
+            Post_MM_rendered_plot/Dataset post_ds_2 {
+                label = "2"
+                value_legend = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "signal"!
+                    $
+                value_color = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "blue"!
+                    $
+                value_linestyle = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "solid"!
+                    $
+            }
+            Post_TracabilityPlot (post_ds_0, post_ds_2) {
+                label = "3"
+            }
+            Post_MM_rendered_plot/XAxis post_ds_4 {
+                label = "4"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "time"!
+                    $
+                value_unit = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "seconds"!
+                    $
+            }
+            Post_MM_rendered_plot/YAxis post_ds_5 {
+                label = "5"
+                value_name = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "signal"!
+                    $
+                value_unit = $
+                    String function value(model : Element, name : String, mapping : Element):
+                        return "power"!
+                    $
+            }
+            Post_MM_rendered_plot/x (post_ds_1, post_ds_4) {
+                label = "6"
+            }
+            Post_MM_rendered_plot/y (post_ds_1, post_ds_5) {
+                label = "7"
+            }
+            Post_MM_rendered_plot/data (post_ds_1, post_ds_2) {
+                label = "8"
+            }
+        }
+    }
 
 
-        {Contains} ForAll render_points {
-            LHS {
-                Pre_Trace/Signal pre_p_0 {
-                    label = "0"
-                }
-                Pre_Trace/Point pre_p_1 {
-                    label = "1"
-                }
-                Pre_MM_rendered_plot/Dataset pre_p_2 {
-                    label = "2"
-                }
-                Pre_TracabilityPlot (pre_p_0, pre_p_2) {
-                    label = "3"
-                }
-                Pre_Trace/contains (pre_p_0, pre_p_1) {
-                    label = "4"
-                }
-            }
-            RHS {
-                Post_Trace/Signal post_p_0 {
-                    label = "0"
-                }
-                Post_Trace/Point post_p_1 {
-                    label = "1"
-                }
-                Post_MM_rendered_plot/Dataset post_p_2 {
-                    label = "2"
-                }
-                Post_TracabilityPlot (post_p_0, post_p_2) {
-                    label = "3"
-                }
-                Post_Trace/contains (post_p_0, post_p_1) {
-                    label = "4"
-                }
-                Post_MM_rendered_plot/Datapoint post_p_5 {
-                    label = "5"
-                    value_x = $
-                        Float function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["1"], "x")!
-                        $
-                    value_y = $
-                        Float function value(model : Element, name : String, mapping : Element):
-                            return read_attribute(model, mapping["1"], "y")!
-                        $
-                }
-                Post_MM_rendered_plot/point (post_p_2, post_p_5) {
-                    label = "6"
-                }
+    {Contains} ForAll render_points {
+        LHS {
+            Pre_Trace/Signal pre_p_0 {
+                label = "0"
+            }
+            Pre_Trace/Point pre_p_1 {
+                label = "1"
+            }
+            Pre_MM_rendered_plot/Dataset pre_p_2 {
+                label = "2"
+            }
+            Pre_TracabilityPlot (pre_p_0, pre_p_2) {
+                label = "3"
+            }
+            Pre_Trace/contains (pre_p_0, pre_p_1) {
+                label = "4"
+            }
+        }
+        RHS {
+            Post_Trace/Signal post_p_0 {
+                label = "0"
+            }
+            Post_Trace/Point post_p_1 {
+                label = "1"
+            }
+            Post_MM_rendered_plot/Dataset post_p_2 {
+                label = "2"
+            }
+            Post_TracabilityPlot (post_p_0, post_p_2) {
+                label = "3"
+            }
+            Post_Trace/contains (post_p_0, post_p_1) {
+                label = "4"
+            }
+            Post_MM_rendered_plot/Datapoint post_p_5 {
+                label = "5"
+                value_x = $
+                    Float function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["1"], "x")!
+                    $
+                value_y = $
+                    Float function value(model : Element, name : String, mapping : Element):
+                        return read_attribute(model, mapping["1"], "y")!
+                    $
+            }
+            Post_MM_rendered_plot/point (post_p_2, post_p_5) {
+                label = "6"
             }
             }
         }
         }
     }
     }
+}
 
 
-    Initial (schedule, render_dataset) {}
+Initial (schedule, render_dataset) {}
 
 
-    OnSuccess (render_dataset, render_points) {}
-    OnFailure (render_dataset, failure) {}
+OnSuccess (render_dataset, render_points) {}
+OnFailure (render_dataset, failure) {}
 
 
-    OnSuccess (render_points, success) {}
-    OnFailure (render_points, failure) {}
-}
+OnSuccess (render_points, success) {}
+OnFailure (render_points, failure) {}