userdefs.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #ifndef USERDEFS_H
  2. #define USERDEFS_H
  3. /* userdefs.h
  4. *
  5. * To include user defined definitions.
  6. *
  7. * Version: 1.1 1999-01-20 Dag Bruck Added documentation of RootFinder_,
  8. * EventIterate_ and PrintEvent_.
  9. * 1.3 1999-03-03 Dag Bruck Moved major parts from userfunc.c.
  10. *
  11. */
  12. /*
  13. * Copyright (C) 1998-2001 Dynasim AB.
  14. * All rights reserved.
  15. *
  16. */
  17. /* Set the following constants as needed, if defaults are not ok. */
  18. /* Root finder available in integration algorithm. */
  19. /* #define RootFinder_ 1 */
  20. /* Event iteration: 1 = Iterate for consistent conditions after event.
  21. 0 = Propagate event next time. */
  22. /* #define EventIterate_ 1 */
  23. /* Print events etc in Matlab window. */
  24. /* Note: This is now [5.1] a set of flags. Corresponding to field debug in dsin.txt */
  25. /* #define PrintEvent_ ((1<<1)|(1<<2)) */
  26. /* Try LU factorizaton: 1 = Try an LU-factorization for solving linear systems*/
  27. /* 0 = Do not try to LU-factorize */
  28. /* If the LU-factorizations fails or is not attempted we will use QR-factorization*/
  29. /* to solve the system in the least squares sense. */
  30. /* It seems as though LU-factorization often fails and we thus never attempt to LU-factorize*/
  31. #if 0
  32. #if defined(DYMOLA_DSPACE)
  33. #define TryLUFactorization_ 0
  34. #else
  35. #define TryLUFactorization_ EventIterate_
  36. #endif
  37. #else
  38. #define TryLUFactorization_ 0
  39. #endif
  40. /* EquilibMatrix_: 1 = Perform row and column equilibrization before LU/QR-decomposition */
  41. /* 0 = Do not perform it */
  42. /* Equilibrization implies a small performance hit, but improves the result for badly scaled systems*/
  43. /* #define EquilibMatrix_ 1 */
  44. /* LargeEPS_ Is the upper bound for event epsilon during event iterations */
  45. /* Adaptively increasing event epsilon is used to get past some nasty non-linearities */
  46. /* If LargeEPS_ is smaller than event epsilon it has no effect */
  47. /* #define LargeEPS_ 1e-2 */
  48. /* SlowIter_ Increasing event epsilon is only during problems with event iterations */
  49. /* SlowIter_ determines how many event iterations that should be attempted before concluding that*/
  50. /* the iterations are converging slowly and attempting to increase event epsilon (up to LargeEPS_).*/
  51. /* If it smaller than the MaxIter_ no attempt will be made. */
  52. /* #define SlowIter_ 5 */
  53. /* GenerateSimulinkTiming: To get timing of the entire simulation in simulink */
  54. /* Useful for timing purposes */
  55. /* Uncomment the define to activate it */
  56. /* #define GenerateSimulinkTiming */
  57. /* Aim for high accuracy in non-linear solver */
  58. /* Uncomment the following line to only get an accuracy comparable to the */
  59. /* tolerance in the non-linear solver. Normally we try to ensure that the */
  60. /* error is also less than the event epsilon in order to avoid chattering */
  61. /* This takes additional time, but is sometimes necessary in order to */
  62. /* avoid numerical chattering */
  63. /* */
  64. /* #define DymolaAimForHighAccuracy_ 0 */
  65. /* DymolaNoGuard_ */
  66. /* Uncomment to use faster div, asin, etc */
  67. /* The faster versions does not generate errors for illegal values */
  68. /* and can thus cause substantial problems, if the model is evaluated */
  69. /* for values that are outside of the legal ranges */
  70. /* */
  71. /* #define DymolaNoGuard_ 1 */
  72. /* DymolaNewJacobian_ */
  73. /* Uncomment the following line to not recompute Jacobians for every */
  74. /* non-linear system of equations, when a new solution procedure is started */
  75. /* */
  76. /* #define DymolaNewJacobian_ 0 */
  77. /* For timing */
  78. /* DymolaPrecisionTiming_ */
  79. /* Several timing related ones, all activated by one switch */
  80. /* They give more reliable timing It only works with Visual C++/Gcc and using IA32 */
  81. /* You have to specify processor unless operating at maximum frequency on P4*/
  82. /* #define DymolaPrecisionTiming_ 1*/
  83. /* Timing group: Uncomment the following line to deactivate interrupts during execution
  84. of model code */
  85. /* It gives more reliable timing, but has some other drawbacks*/
  86. /* It only works with Visual C++/Gcc and using IA32 */
  87. /* DANGER: It does CRASH under some operating systems after Windows 98, */
  88. /* due to privileged instructions. */
  89. /* #define DymolaUninterruptedTimers_ 1*/
  90. /* Uncomment the following line to use processor instruction counter */
  91. /* #define DymolaUseRDTSC_ 1*/
  92. /* Uncomment the following line to set processor frequency in Hz*/
  93. /* Not needed if operating at maximum frequency on P4 or later */
  94. /* #define DymolaUseRDTSCFrequency_ 1.6e9 */
  95. /* Set to 0 to use auto-detection (for P4 or later and maximum frequency) */
  96. /* Automatically remove computation of auxiliary variables that are not used */
  97. /* in the rest of the model (not even with pre as discrete variable). */
  98. /* These variables are normally only useful for plotting */
  99. /* Auxiliaries are not useful in Simulink, and not useful if not stored inside Dymola */
  100. /* Note: For historic reasons this is always done on dSpace */
  101. /* #define DymolaAutoRemoveAuxiliaries_ 1 */
  102. /* For limiting number of non-linear iterations */
  103. /* No effect if 0 or larger than 8 */
  104. /* #define DymolaNonLinearIterations_ 3 */
  105. /* Uncomment the following to allow global optimization for Visual C++ */
  106. /* Note that Visual C++ does not work well for large models with global optimization.
  107. (The compilations take a very long time).*/
  108. /* The possibilities are:
  109. 0 - forbid (default)
  110. 1 - allow
  111. 2 - require */
  112. /* #define DymolaGlobalOptimizations_ 2 */
  113. #endif