my_petrinet_with_MM_and_constraints.mvc 871 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import models/SimpleClassDiagrams as SCD
  2. include "primitives.alh"
  3. SCD PetriNets{
  4. Class Natural {
  5. $
  6. if (bool_not(is_physical_int(self))):
  7. return "Natural has no integer value"!
  8. elif (integer_lt(self, 0)):
  9. return "Natural does not have a positive or zero value"!
  10. else:
  11. return "OK"!
  12. $
  13. }
  14. Class Place{
  15. tokens : Natural
  16. }
  17. Class Transition{}
  18. Association P2T (Place, Transition) {
  19. weight : Natural
  20. }
  21. Association T2P (Transition, Place) {
  22. weight : Natural
  23. }
  24. }
  25. PetriNets my_petrinet {
  26. Place p1 {
  27. tokens = 1
  28. }
  29. Place p2 {
  30. tokens = 3
  31. }
  32. Transition t1 {}
  33. P2T (p1, t1) {
  34. weight = 1
  35. }
  36. T2P (t1, p2) {
  37. weight = 2
  38. }
  39. }
  40. export my_petrinet to models/my_petrinet