result.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Internal header file for result generation. */
  2. #ifndef result_h
  3. #define result_h
  4. #include "types.h"
  5. /* For code export STORE_RESULT shall no be set */
  6. #ifndef STORE_RESULT
  7. /* empty for source code provided in FMUs */
  8. #define result_setup(c)
  9. #define result_teardown(c)
  10. #define result_sample(c, f)
  11. #define result_flush(c)
  12. #else
  13. /* ----------------- function delcarations ----------------- */
  14. /**
  15. * Setup. Calls result_sample once to get a sample point at start time.
  16. *
  17. * @param comp the FMI component
  18. */
  19. void result_setup(Component* comp);
  20. /**
  21. * Teardown. Calls result_sample to get a sample at stop time if necessary. Calls result_flush if necessary.
  22. *
  23. * @param comp the FMI component
  24. */
  25. void result_teardown(Component* comp);
  26. /**
  27. * Checks if the last sample time is not too close to the current and if not, sample the output.
  28. * For FMI 1.0, the sample is output on result file immediately.
  29. * For FMI >= 2.0, where time can be backed up due to possibility to set/get state, the sample is buffered
  30. * until result_flush is called or the maximum buffer size is exceeded during a call to result_sample.
  31. *
  32. * @param comp the FMI component
  33. * @param force whether the sample should be forced (set to fmiTrue for event, when duplicate samples at same time desired)
  34. */
  35. void result_sample(Component* comp, FMIBoolean force);
  36. /**
  37. * Output he values in the result buffer on file and resets the buffer.
  38. *
  39. * @param comp the FMI component
  40. */
  41. void result_flush(Component* comp);
  42. #endif /* STORE_RESULT */
  43. #endif /* result_h */