test1.sa 916 B

1234567891011121314151617181920212223242526272829
  1. semantic adaptation TEST
  2. for discrete event
  3. input ports x[1 .. 2] (kg.m/s 2), y, z
  4. output ports a, b, c
  5. extract directionalderivative
  6. {= (signal-signal[prev]) / h }
  7. {
  8. def firstorder(s) {
  9. var temp;
  10. temp = s-s[prev];
  11. return temp / h;
  12. }
  13. return firstorder(x);
  14. }
  15. in rules with zero crossing tolerance = 0.001, no hold { // for CT to inner DE
  16. not x[prev]+3 > 2+2*floor(y[now]+round(8.2)) and y < 4 -> todo --> todo;
  17. x >! 2 with tolerance = 0.0001 -> "high" --> no hold; // means condition -> IN action -> UPDATE IN action
  18. x >! 1 or x <! 2 -> "low" --> no hold;
  19. x <! 1 -> "off"; // i.e., no hold is the default
  20. otherwise(x) -> null --> zero order hold;
  21. quantize(y, "off", 1, "low", 2, "high") --> no hold;
  22. quantize(z, ="event"+floor(z + 0.5)) --> no hold;
  23. quantize(z, ="event"+round(z)) --> no hold;
  24. quantize z every 2 offset 1 --> no hold;
  25. }
  26. //out rules with buffer[10] {}
  27. out rules {}
  28. control rules {}