window_sa.BASE_canonical.sa 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. semantic adaptation reactive mealy WindowSA windowSA
  2. at "./path/to/WindowSA.fmu"
  3. for inner fmu Window window
  4. at "test_input/single_folder_spec/window/Window.fmu"
  5. with input ports Real displacement(rad), Real speed (rad/s), Real reaction_force (N)
  6. with output ports Real height (cm), Real reaction_torque (N.m)
  7. input ports Real displacement ( rad ) , Real speed ( rad / s ) , Real reaction_force ( N )
  8. output ports Real disp (m) , Real tau (N)
  9. param Real INIT_DISPLACEMENT := 0.0 , Real INIT_SPEED := 0.0 , Real INIT_REACTION_FORCE := 0.0 , Real INIT_HEIGHT := 0.0 , Real INIT_REACTION_TORQUE := 0.0 ;
  10. control rules {
  11. var H_window := do_step ( window , t , H ) ;
  12. return min ( H_window ) ; }
  13. in var Real stored__displacement := INIT_DISPLACEMENT , Real stored__speed := INIT_SPEED , Real stored__reaction_force := INIT_REACTION_FORCE ;
  14. in rules {
  15. true -> {
  16. stored__speed := windowSA . speed ;
  17. stored__reaction_force := windowSA . reaction_force ;
  18. stored__displacement := windowSA . displacement ; } --> {
  19. window . speed := stored__speed ;
  20. window . displacement := stored__displacement ;
  21. window . reaction_force := stored__reaction_force ; } ; }
  22. out var Real stored__reaction_torque := INIT_REACTION_TORQUE , Real stored__height := INIT_HEIGHT ;
  23. out rules {
  24. true -> {
  25. stored__reaction_torque := window . reaction_torque ;
  26. stored__height := window . height ; } --> {
  27. windowSA . disp := stored__height / 100.0 ;
  28. windowSA.tau := -stored__reaction_torque;
  29. };
  30. }