Przeglądaj źródła

Added first iteration of CBD runtime; added multiplicities

Yentl Van Tendeloo 8 lat temu
rodzic
commit
b6f7817198
2 zmienionych plików z 139 dodań i 11 usunięć
  1. 44 11
      integration/code/cbd_design.mvc
  2. 95 0
      integration/code/cbd_runtime.mvc

+ 44 - 11
integration/code/cbd_design.mvc

@@ -12,35 +12,68 @@ SCD CausalBlockDiagrams{
     }
 
     Class Block{
-        output : Block
+        output : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Class ConstantBlock{
-        value : Float
+        value : Float {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Class AdditionBlock{
-        input1 : Block
-        input2 : Block
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        input2 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Class NegatorBlock{
-        input1 : Block
-        input2 : Block
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        input2 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Class MultiplyBlock{
-        input1 : Block
-        input2 : Block
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        input2 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Class InverseBlock{
-        input : Block
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Class DelayBlock{
-        input : Block
-        initial : Block
+        input : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        initial : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
     }
 
     Inheritance (ConstantBlock, Block){}

+ 95 - 0
integration/code/cbd_runtime.mvc

@@ -0,0 +1,95 @@
+import models/SimpleClassDiagrams as SCD
+include "primitives.alh"
+
+SCD CausalBlockDiagrams{
+    Class Float {
+        $
+            if (bool_not(is_physical_float(self))):
+                return "Float has no float value"!
+            else:
+                return "OK"!
+         $
+    }
+
+    Class Block{
+        output : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        signal : Float {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Class ConstantBlock{
+        value : Float {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Class AdditionBlock{
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        input2 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Class NegatorBlock{
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        input2 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Class MultiplyBlock{
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        input2 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Class InverseBlock{
+        input1 : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Class DelayBlock{
+        input : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        initial : Block {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+        memory : Float {
+            target_lower_multiplicity = 1
+            target_upper_multiplicity = 1
+        }
+    }
+
+    Inheritance (ConstantBlock, Block){}
+    Inheritance (AdditionBlock, Block){}
+    Inheritance (NegatorBlock, Block){}
+    Inheritance (MultiplyBlock, Block){}
+    Inheritance (InverseBlock, Block){}
+    Inheritance (DelayBlock, Block){}
+}
+
+export CausalBlockDiagrams to models/CausalBlockDiagrams