GenerateResultInNonDymosim.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (C) 2003 Dynasim AB.
  3. * All rights reserved.
  4. *
  5. */
  6. #ifndef GenerateResultInNonDymosim_HEADER
  7. #define GenerateResultInNonDymosim_HEADER
  8. /* #define GenerateResultInNonDymosim_DT 0.01
  9. To limit result file size.
  10. */
  11. /* Calling sequence:
  12. // DeclarePhase0();
  13. SetDeclarePhase(0,...); //Reset.
  14. declare_(...); // Normal call of declare. Not needed
  15. // DeclarePhase1(...);
  16. SetDeclarePhase(1,...); //Init
  17. declare_(...);
  18. SetDeclarePhase(2,...);
  19. // DeclarePhase3(...);
  20. SetDeclarePhase(3,...); //Open file
  21. declare_(...);
  22. SetDeclarePhase(4,...);
  23. SetDeclarePhase(5,...); //Store constants
  24. declare_(...)
  25. SetDeclarePhase(6,...);
  26. for(...) {
  27. // DeclarePhase7(...);
  28. SetDeclarePhase(7,...); // Store non-constants
  29. declare_(...)
  30. SetDeclarePhase(8,...);
  31. }
  32. // DeclarePhase9();
  33. SetDeclarePhase(9,...);
  34. The arguments to SetDeclarePhase should be the same except the first one.
  35. The routine use local variables during each call of declare from even to odd.
  36. But no non-local storage remains between the groups.
  37. */
  38. #include <stdlib.h>
  39. #include <stdio.h>
  40. #include <math.h>
  41. #include <dsblock.h>
  42. #include "atraj.h"
  43. struct DeclarePhaseTemp {
  44. int declarePhase_;
  45. int countConst_,countAlias_,countNonConst_;
  46. int *(offsets_[7]);
  47. int **baseoffsets_;
  48. float* resultPart_;
  49. const double* (pointers_[7]);
  50. char const** trajNames_;
  51. char const** trajDesc_;
  52. int* trajInfo_;
  53. int infoCount_;
  54. char* isPublicW_;
  55. char* isPublicX_;
  56. char* isPublicXD_;
  57. char* isPublicP_;
  58. };
  59. struct DeclarePhase {
  60. struct Atrajectory traj;
  61. AmatData nameData,descData,infoData,data1,data2;
  62. int totalInfoCount;
  63. int* (baseoffsets[7]);
  64. const char* filePath;
  65. AmatPutFile file;
  66. int openedFile;
  67. int createdTraj;
  68. double lastTime;
  69. int counter;
  70. struct DeclarePhaseTemp temp;
  71. };
  72. void DeclarePhase0(void**cuser);
  73. void DeclarePhase1(struct DeclarePhase*phase);
  74. void DeclarePhase3(struct DeclarePhase*phase,double startTime,double stopTime,
  75. const double*parameters,const double*states,
  76. const double*derivatives,
  77. const double*outputs,
  78. const double*inputs,
  79. const double*auxiliary);
  80. void DeclarePhase7(struct DeclarePhase*phase,double time,double tEnd,
  81. const double*parameters,const double*states,
  82. const double*derivatives,
  83. const double*outputs,
  84. const double*inputs,
  85. const double*auxiliary);
  86. void DeclarePhase9(struct DeclarePhase*phase);
  87. #endif