window_sa.BASE.sa 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import PowerWindowModel
  2. module Window_SA
  3. semantic adaptation window_sa
  4. for fmu window
  5. /*
  6. No need to have input ports declared for this model.
  7. Every input port of the original FMU will be automatically assumed to be an input port of the adapted FMU.
  8. Having no input ports declaration is equivalent to having this:
  9. input ports reaction_force (N) -> reaction_force (N),
  10. displacement (rad) -> displacement (rad),
  11. speed (rad/s) -> speed (rad/s);
  12. If the units are not declared, then they are assumed to be equal and brought from the scenario description.
  13. Remark: If there is an input port which is dangling, but is not declared here, then it will be assumed to be forwarded.
  14. */
  15. /*
  16. Declares two output ports, and specified how height is mapped to disp.
  17. Here, the units need to be specified, so that the conversion can take place.
  18. The units of disp can be either obtained from the scenario, or specified explicitly here.
  19. */
  20. output ports height (m) -> disp (cm), tau;
  21. /*
  22. There are alternatives ways that this can be interpreted:
  23. disp := arbitrary_function(height) * 100 or arbitrary_function(height * 100) (they are not necessarily equal)
  24. We pick the first one, so what we have is this:
  25. aux_var := arbitrary_function(height);
  26. disp := aux_var*100; // This part never has to be coded.
  27. */
  28. in rules {
  29. true -> { } --> {
  30. /*
  31. No declaration is equivalent to this:
  32. window.reaction_force := window_sa.reaction_force;
  33. window.displacement := displacement;
  34. window.speed := speed;
  35. all input ports have to be prefix in this situation:
  36. if (speed != speed) {
  37. then world ends
  38. }
  39. */
  40. };
  41. }
  42. out rules {
  43. true -> { } --> {
  44. tau := -reaction_torque;
  45. };
  46. }