cbd_design.mvc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import models/SimpleClassDiagrams as SCD
  2. include "primitives.alh"
  3. SCD CausalBlockDiagrams{
  4. Class Float {
  5. $
  6. if (bool_not(is_physical_float(self))):
  7. return "Natural has no float value"!
  8. else:
  9. return "OK"!
  10. $
  11. }
  12. Class Block{
  13. output : Block {
  14. target_lower_multiplicity = 1
  15. target_upper_multiplicity = 1
  16. }
  17. }
  18. Class ConstantBlock{
  19. value : Float {
  20. target_lower_multiplicity = 1
  21. target_upper_multiplicity = 1
  22. }
  23. }
  24. Class AdditionBlock{
  25. input1 : Block {
  26. target_lower_multiplicity = 1
  27. target_upper_multiplicity = 1
  28. }
  29. input2 : Block {
  30. target_lower_multiplicity = 1
  31. target_upper_multiplicity = 1
  32. }
  33. }
  34. Class NegatorBlock{
  35. input1 : Block {
  36. target_lower_multiplicity = 1
  37. target_upper_multiplicity = 1
  38. }
  39. input2 : Block {
  40. target_lower_multiplicity = 1
  41. target_upper_multiplicity = 1
  42. }
  43. }
  44. Class MultiplyBlock{
  45. input1 : Block {
  46. target_lower_multiplicity = 1
  47. target_upper_multiplicity = 1
  48. }
  49. input2 : Block {
  50. target_lower_multiplicity = 1
  51. target_upper_multiplicity = 1
  52. }
  53. }
  54. Class InverseBlock{
  55. input1 : Block {
  56. target_lower_multiplicity = 1
  57. target_upper_multiplicity = 1
  58. }
  59. }
  60. Class DelayBlock{
  61. input : Block {
  62. target_lower_multiplicity = 1
  63. target_upper_multiplicity = 1
  64. }
  65. initial : Block {
  66. target_lower_multiplicity = 1
  67. target_upper_multiplicity = 1
  68. }
  69. }
  70. Inheritance (ConstantBlock, Block){}
  71. Inheritance (AdditionBlock, Block){}
  72. Inheritance (NegatorBlock, Block){}
  73. Inheritance (MultiplyBlock, Block){}
  74. Inheritance (InverseBlock, Block){}
  75. Inheritance (DelayBlock, Block){}
  76. }
  77. export CausalBlockDiagrams to models/CausalBlockDiagrams