windowSA.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef SRC_WINDOWSA_H
  2. #define SRC_WINDOWSA_H
  3. #include "SemanticAdaptation.h"
  4. #include <memory>
  5. #include "Fmu.h"
  6. using namespace std;
  7. using namespace fmi2;
  8. namespace adaptation
  9. {
  10. #define WINDOWDISPLACEMENT 0
  11. #define WINDOWFRICTION 1
  12. #define WINDOWHEIGHT 2
  13. #define WINDOWREACTION_FORCE 3
  14. #define WINDOWREACTION_TORQUE 4
  15. #define WINDOWSPEED 5
  16. #define WINDOWV 6
  17. #define WINDOWB 7
  18. #define WINDOWR 8
  19. #define WINDOWSAREACTION_FORCE 0
  20. #define WINDOWSADISPLACEMENT 1
  21. #define WINDOWSASPEED 2
  22. #define WINDOWSADISP 3
  23. #define WINDOWSATAU 4
  24. class WindowSA : public SemanticAdaptation<WindowSA>, public enable_shared_from_this<WindowSA>
  25. {
  26. public:
  27. WindowSA(shared_ptr<string> resourceLocation, const fmi2CallbackFunctions* functions);
  28. void initialize();
  29. virtual ~WindowSA();
  30. void setFmiValue(fmi2ValueReference id, int value);
  31. void setFmiValue(fmi2ValueReference id, bool value);
  32. void setFmiValue(fmi2ValueReference id, double value);
  33. void setFmiValue(fmi2ValueReference id, string value);
  34. int getFmiValueInteger(fmi2ValueReference id);
  35. bool getFmiValueBoolean(fmi2ValueReference id);
  36. double getFmiValueReal(fmi2ValueReference id);
  37. string getFmiValueString(fmi2ValueReference id);
  38. private:
  39. WindowSA* getRuleThis();
  40. /*in rules*/
  41. bool in_rule_condition1();
  42. void in_rule_body1();
  43. void in_rule_flush1();
  44. bool in_rule_condition2();
  45. void in_rule_body2();
  46. void in_rule_flush2();
  47. bool in_rule_condition3();
  48. void in_rule_body3();
  49. void in_rule_flush3();
  50. shared_ptr<list<Rule<WindowSA>>> createInputRules();;
  51. /*out rules*/
  52. bool out_rule_condition1();
  53. void out_rule_body1();
  54. void out_rule_flush1();
  55. bool out_rule_condition2();
  56. void out_rule_body2();
  57. void out_rule_flush2();
  58. shared_ptr<list<Rule<WindowSA>>> createOutputRules();;
  59. void executeInternalControlFlow(double h, double dt);;
  60. shared_ptr<FmuComponent> window;
  61. double reaction_force;
  62. bool isSetreaction_force;
  63. double displacement;
  64. bool isSetdisplacement;
  65. double speed;
  66. bool isSetspeed;
  67. double disp;
  68. double tau;
  69. double stored_window_reaction_torque;
  70. double stored_window_height;
  71. double stored_windowsa_reaction_force;
  72. double stored_windowsa_displacement;
  73. double stored_windowsa_speed;
  74. };
  75. }