cbd_runtime.mvc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import models/SimpleClassDiagrams as SCD
  2. include "primitives.alh"
  3. SCD CausalBlockDiagrams_Runtime{
  4. Class Float {
  5. $
  6. if (bool_not(is_physical_float(self))):
  7. return "Float has no float value"!
  8. else:
  9. return "OK"!
  10. $
  11. }
  12. Class Boolean {
  13. $
  14. if (bool_not(is_physical_boolean(self))):
  15. return "Boolean has no bool value"!
  16. else:
  17. return "OK"!
  18. $
  19. }
  20. Class Natural {
  21. $
  22. if (bool_not(is_physical_int(self))):
  23. return "Natural has no integer value at " + name!
  24. elif (integer_lt(self, 0)):
  25. return "Natural does not have a positive or zero value at " + name!
  26. else:
  27. return "OK"!
  28. $
  29. }
  30. Class Block{
  31. signal : Float {
  32. target_lower_cardinality = 1
  33. target_upper_cardinality = 1
  34. }
  35. }
  36. Class ConstantBlock{
  37. value : Float {
  38. target_lower_cardinality = 1
  39. target_upper_cardinality = 1
  40. }
  41. }
  42. Class AdditionBlock{}
  43. Class NegatorBlock{}
  44. Class MultiplyBlock{}
  45. Class InverseBlock{}
  46. Class DelayBlock{
  47. memory : Float {
  48. target_lower_cardinality = 1
  49. target_upper_cardinality = 1
  50. }
  51. }
  52. Class Time{
  53. lower_cardinality = 1
  54. upper_cardinality = 1
  55. current_time : Natural {
  56. target_lower_cardinality = 1
  57. target_upper_cardinality = 1
  58. }
  59. termination_time : Natural {
  60. target_lower_cardinality = 1
  61. target_upper_cardinality = 1
  62. }
  63. }
  64. Class Schedule {
  65. lower_cardinality = 1
  66. }
  67. Association LinkedBlock(Schedule, Block){
  68. target_lower_cardinality = 0
  69. target_upper_cardinality = 1
  70. }
  71. Association NextSchedule(Schedule, Schedule){
  72. target_lower_cardinality = 0
  73. target_upper_cardinality = 1
  74. }
  75. Association Link(Block, Block){
  76. }
  77. Association InitialCondition(Block, DelayBlock){
  78. source_lower_cardinality = 0
  79. source_upper_cardinality = 1
  80. }
  81. Inheritance (ConstantBlock, Block){}
  82. Inheritance (AdditionBlock, Block){}
  83. Inheritance (NegatorBlock, Block){}
  84. Inheritance (MultiplyBlock, Block){}
  85. Inheritance (InverseBlock, Block){}
  86. Inheritance (DelayBlock, Block){}
  87. }
  88. export CausalBlockDiagrams_Runtime to models/CausalBlockDiagrams_Runtime