simulation_options.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. /*
  2. * This file is part of OpenModelica.
  3. *
  4. * Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC),
  5. * c/o Linköpings universitet, Department of Computer and Information Science,
  6. * SE-58183 Linköping, Sweden.
  7. *
  8. * All rights reserved.
  9. *
  10. * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
  11. * GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
  12. * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
  13. * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
  14. * ACCORDING TO RECIPIENTS CHOICE.
  15. *
  16. * The OpenModelica software and the OSMC (Open Source Modelica Consortium)
  17. * Public License (OSMC-PL) are obtained from OSMC, either from the above
  18. * address, from the URLs: http://www.openmodelica.org or
  19. * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica
  20. * distribution. GNU version 3 is obtained from:
  21. * http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from:
  22. * http://www.opensource.org/licenses/BSD-3-Clause.
  23. *
  24. * This program is distributed WITHOUT ANY WARRANTY; without even the implied
  25. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS
  26. * EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE
  27. * CONDITIONS OF OSMC-PL.
  28. *
  29. */
  30. #include "simulation_options.h"
  31. const char *FLAG_NAME[FLAG_MAX+1] = {
  32. "FLAG_UNKNOWN",
  33. /* FLAG_ABORT_SLOW */ "abortSlowSimulation",
  34. /* FLAG_ALARM */ "alarm",
  35. /* FLAG_CLOCK */ "clock",
  36. /* FLAG_CPU */ "cpu",
  37. /* FLAG_CSV_OSTEP */ "csvOstep",
  38. /* FLAG_DAE_MODE */ "daeMode",
  39. /* FLAG_DELTA_X_LINEARIZE */ "deltaXLinearize",
  40. /* FLAG_DELTA_X_SOLVER */ "deltaXSolver",
  41. /* FLAG_EMBEDDED_SERVER */ "embeddedServer",
  42. /* FLAG_EMIT_PROTECTED */ "emit_protected",
  43. /* FLAG_F */ "f",
  44. /* FLAG_HELP */ "help",
  45. /* FLAG_IDA_MAXERRORTESTFAIL */ "idaMaxErrorTestFails",
  46. /* FLAG_IDA_MAXNONLINITERS */ "idaMaxNonLinIters",
  47. /* FLAG_IDA_MAXCONVFAILS */ "idaMaxConvFails",
  48. /* FLAG_IDA_NONLINCONVCOEF */ "idaNonLinConvCoef",
  49. /* FLAG_IDA_LS */ "idaLS",
  50. /* FLAG_IDAS */ "idaSensitivity",
  51. /* FLAG_IGNORE_HIDERESULT */ "ignoreHideResult",
  52. /* FLAG_IIF */ "iif",
  53. /* FLAG_IIM */ "iim",
  54. /* FLAG_IIT */ "iit",
  55. /* FLAG_ILS */ "ils",
  56. /* FLAG_INITIAL_STEP_SIZE */ "initialStepSize",
  57. /* FLAG_INPUT_CSV */ "csvInput",
  58. /* FLAG_INPUT_FILE */ "exInputFile",
  59. /* FLAG_INPUT_FILE_STATES */ "stateFile",
  60. /* FLAG_IPOPT_HESSE*/ "ipopt_hesse",
  61. /* FLAG_IPOPT_INIT*/ "ipopt_init",
  62. /* FLAG_IPOPT_JAC*/ "ipopt_jac",
  63. /* FLAG_IPOPT_MAX_ITER */ "ipopt_max_iter",
  64. /* FLAG_IPOPT_WARM_START */ "ipopt_warm_start",
  65. /* FLAG_JACOBIAN */ "jacobian",
  66. /* FLAG_L */ "l",
  67. /* FLAG_L_DATA_RECOVERY */ "l_datarec",
  68. /* FLAG_LOG_FORMAT */ "logFormat",
  69. /* FLAG_LS */ "ls",
  70. /* FLAG_LS_IPOPT */ "ls_ipopt",
  71. /* FLAG_LSS */ "lss",
  72. /* FLAG_LSS_MAX_DENSITY */ "lssMaxDensity",
  73. /* FLAG_LSS_MIN_SIZE */ "lssMinSize",
  74. /* FLAG_LV */ "lv",
  75. /* FLAG_MAX_BISECTION_ITERATIONS */ "mbi",
  76. /* FLAG_MAX_EVENT_ITERATIONS */ "mei",
  77. /* FLAG_MAX_ORDER */ "maxIntegrationOrder",
  78. /* FLAG_MAX_STEP_SIZE */ "maxStepSize",
  79. /* FLAG_MEASURETIMEPLOTFORMAT */ "measureTimePlotFormat",
  80. /* FLAG_NEWTON_FTOL */ "newtonFTol",
  81. /* FLAG_NEWTON_XTOL */ "newtonXTol",
  82. /* FLAG_NEWTON_STRATEGY */ "newton",
  83. /* FLAG_NLS */ "nls",
  84. /* FLAG_NLS_INFO */ "nlsInfo",
  85. /* FLAG_NLS_LS */ "nlsLS",
  86. /* FLAG_NOEMIT */ "noemit",
  87. /* FLAG_NOEQUIDISTANT_GRID */ "noEquidistantTimeGrid",
  88. /* FLAG_NOEQUIDISTANT_OUT_FREQ*/ "noEquidistantOutputFrequency",
  89. /* FLAG_NOEQUIDISTANT_OUT_TIME*/ "noEquidistantOutputTime",
  90. /* FLAG_NOEVENTEMIT */ "noEventEmit",
  91. /* FLAG_NO_RESTART */ "noRestart",
  92. /* FLAG_NO_ROOTFINDING */ "noRootFinding",
  93. /* FLAG_NO_SUPPRESS_ALG */ "noSuppressAlg",
  94. /* FLAG_OPTDEBUGEJAC */ "optDebugJac",
  95. /* FLAG_OPTIMIZER_NP */ "optimizerNP",
  96. /* FLAG_OPTIMIZER_TGRID */ "optimizerTimeGrid",
  97. /* FLAG_OUTPUT */ "output",
  98. /* FLAG_OVERRIDE */ "override",
  99. /* FLAG_OVERRIDE_FILE */ "overrideFile",
  100. /* FLAG_PORT */ "port",
  101. /* FLAG_R */ "r",
  102. /* FLAG_RT */ "rt",
  103. /* FLAG_S */ "s",
  104. /* FLAG_SOLVER_STEPS */ "steps",
  105. /* FLAG_UP_HESSIAN */ "keepHessian",
  106. /* FLAG_W */ "w",
  107. "FLAG_MAX"
  108. };
  109. const char *FLAG_DESC[FLAG_MAX+1] = {
  110. "unknown",
  111. /* FLAG_ABORT_SLOW */ "aborts if the simulation chatters",
  112. /* FLAG_ALARM */ "aborts after the given number of seconds (0 disables)",
  113. /* FLAG_CLOCK */ "selects the type of clock to use -clock=RT, -clock=CYC or -clock=CPU",
  114. /* FLAG_CPU */ "dumps the cpu-time into the result file",
  115. /* FLAG_CSV_OSTEP */ "value specifies csv-files for debuge values for optimizer step",
  116. /* FLAG_DAE_MODE */ "flag to let the integrator use daeResiduals",
  117. /* FLAG_DELTA_X_LINEARIZE */ "value specifies the delta x value for numerical differentiation used by linearization. The default value is 1e-5.",
  118. /* FLAG_DELTA_X_SOLVER */ "value specifies the delta x value for numerical differentiation used by integrator. The default values is sqrt(DBL_EPSILON).",
  119. /* FLAG_EMBEDDED_SERVER */ "enables an embedded server. Valid values: none, opc-da [broken], opc-ua [experimental], or the path to a shared object.",
  120. /* FLAG_EMIT_PROTECTED */ "emits protected variables to the result-file",
  121. /* FLAG_F */ "value specifies a new setup XML file to the generated simulation code",
  122. /* FLAG_HELP */ "get detailed information that specifies the command-line flag",
  123. /* FLAG_IDA_MAXERRORTESTFAIL */ "value specifies the maximum number of error test failures in attempting one step. The default value is 7.",
  124. /* FLAG_IDA_MAXNONLINITERS */ "value specifies the maximum number of nonlinear solver iterations at one step. The default value is 3.",
  125. /* FLAG_IDA_MAXCONVFAILS */ "value specifies the maximum number of nonlinear solver convergence failures at one step. The default value is 10.",
  126. /* FLAG_IDA_NONLINCONVCOEF */ "value specifies the safety factor in the nonlinear convergence test. The default value is 0.33.",
  127. /* FLAG_IDA_LS */ "selects the linear solver used by ida",
  128. /* FLAG_IDAS */ "flag to add sensitivity information to the result files",
  129. /* FLAG_IGNORE_HIDERESULT */ "ignore HideResult=true annotation",
  130. /* FLAG_IIF */ "value specifies an external file for the initialization of the model",
  131. /* FLAG_IIM */ "value specifies the initialization method",
  132. /* FLAG_IIT */ "[double] value specifies a time for the initialization of the model",
  133. /* FLAG_ILS */ "[int] default: 1",
  134. /* FLAG_INITIAL_STEP_SIZE */ "value specifies an initial stepsize for the dassl solver",
  135. /* FLAG_INPUT_CSV */ "value specifies an csv-file with inputs for the simulation/optimization of the model",
  136. /* FLAG_INPUT_FILE */ "value specifies an external file with inputs for the simulation/optimization of the model",
  137. /* FLAG_INPUT_FILE_STATES */ "value specifies an file with states start values for the optimization of the model",
  138. /* FLAG_IPOPT_HESSE */ "value specifies the hessian for Ipopt",
  139. /* FLAG_IPOPT_INIT */ "value specifies the initial guess for optimization",
  140. /* FLAG_IPOPT_JAC */ "value specifies the jacobian for Ipopt",
  141. /* FLAG_IPOPT_MAX_ITER */ "value specifies the max number of iteration for ipopt",
  142. /* FLAG_IPOPT_WARM_START */ "value specifies lvl for a warm start in ipopt: 1,2,3,...",
  143. /* FLAG_JACOBIAN */ "selects the type of the jacobians that is used for the integrator.\n jacobian=[coloredNumerical (default) |numerical|internalNumerical|coloredSymbolical|symbolical].",
  144. /* FLAG_L */ "value specifies a time where the linearization of the model should be performed",
  145. /* FLAG_L_DATA_RECOVERY */ "emit data recovery matrices with model linearization",
  146. /* FLAG_LOG_FORMAT */ "value specifies the log format of the executable. -logFormat=text (default), -logFormat=xml or -logFormat=xmltcp",
  147. /* FLAG_LS */ "value specifies the linear solver method (default: lapack, totalpivot (fallback))",
  148. /* FLAG_LS_IPOPT */ "value specifies the linear solver method for ipopt",
  149. /* FLAG_LSS */ "value specifies the linear sparse solver method (default: umfpack)",
  150. /* FLAG_LSS_MAX_DENSITY */ "[double (default 0.2)] value specifies the maximum density for using a linear sparse solver",
  151. /* FLAG_LSS_MIN_SIZE */ "[int (default 4001)] value specifies the minimum system size for using a linear sparse solver",
  152. /* FLAG_LV */ "[string list] value specifies the logging level",
  153. /* FLAG_MAX_BISECTION_ITERATIONS */ "[int (default 0)] value specifies the maximum number of bisection iterations for state event detection or zero for default behavior",
  154. /* FLAG_MAX_EVENT_ITERATIONS */ "[int (default 20)] value specifies the maximum number of event iterations",
  155. /* FLAG_MAX_ORDER */ "value specifies maximum integration order, used by dassl solver",
  156. /* FLAG_MAX_STEP_SIZE */ "value specifies maximum absolute step size, used by dassl solver",
  157. /* FLAG_MEASURETIMEPLOTFORMAT */ "value specifies the output format of the measure time functionality",
  158. /* FLAG_NEWTON_FTOL */ "[double (default 1e-12)] tolerance respecting residuals for updating solution vector in Newton solver",
  159. /* FLAG_NEWTON_XTOL */ "[double (default 1e-12)] tolerance respecting newton correction (delta_x) for updating solution vector in Newton solver",
  160. /* FLAG_NEWTON_STRATEGY */ "value specifies the damping strategy for the newton solver",
  161. /* FLAG_NLS */ "value specifies the nonlinear solver",
  162. /* FLAG_NLS_INFO */ "outputs detailed information about solving process of non-linear systems into csv files.",
  163. /* FLAG_NLS_LS */ "value specifies the linear solver used by the non-linear solver",
  164. /* FLAG_NOEMIT */ "do not emit any results to the result file",
  165. /* FLAG_NOEQUIDISTANT_GRID */ "stores results not in equidistant time grid as given by stepSize or numberOfIntervals, instead the variable step size of dassl is used.",
  166. /* FLAG_NOEQUIDISTANT_OUT_FREQ*/ "value controls the output frequency in noEquidistantTimeGrid mode",
  167. /* FLAG_NOEQUIDISTANT_OUT_TIME*/ "value controls the output time point in noEquidistantOutputTime mode",
  168. /* FLAG_NOEVENTEMIT */ "do not emit event points to the result file",
  169. /* FLAG_NO_RESTART */ "flag deactivates the restart of dassl/ida after an event is performed.",
  170. /* FLAG_NO_ROOTFINDING */ "flag deactivates the internal root finding procedure of dassl/ida.",
  171. /* FLAG_NO_SUPPRESS_ALG */ "flag to not suppress algebraic variables in the local error test of ida solver in daeMode",
  172. /* FLAG_OPTDEBUGEJAC */ "value specifies the number of iter from the dyn. optimization, which will be debuge, creating *csv and *py file",
  173. /* FLAG_OPTIMIZER_NP */ "value specifies the number of points in a subinterval",
  174. /* FLAG_OPTIMIZER_TGRID */ "value specifies external file with time points.",
  175. /* FLAG_OUTPUT */ "output the variables a, b and c at the end of the simulation to the standard output",
  176. /* FLAG_OVERRIDE */ "override the variables or the simulation settings in the XML setup file",
  177. /* FLAG_OVERRIDE_FILE */ "will override the variables or the simulation settings in the XML setup file with the values from the file",
  178. /* FLAG_PORT */ "value specifies the port for simulation status (default disabled)",
  179. /* FLAG_R */ "value specifies a new result file than the default Model_res.mat",
  180. /* FLAG_RT */ "value specifies the scaling factor for real-time synchronization (0 disables)",
  181. /* FLAG_S */ "value specifies the solver",
  182. /* FLAG_SOLVER_STEPS */ "dumps the number of integration steps into the result file",
  183. /* FLAG_UP_HESSIAN */ "value specifies the number of steps, which keep hessian matrix constant",
  184. /* FLAG_W */ "shows all warnings even if a related log-stream is inactive",
  185. "FLAG_MAX"
  186. };
  187. const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
  188. "unknown",
  189. /* FLAG_ABORT_SLOW */
  190. " Aborts if the simulation chatters.",
  191. /* FLAG_ALARM */
  192. " Aborts after the given number of seconds (default=0 disables the alarm).",
  193. /* FLAG_CLOCK */
  194. " Selects the type of clock to use. Valid options include:\n\n"
  195. " * RT (monotonic real-time clock)\n"
  196. " * CYC (cpu cycles measured with RDTSC)\n"
  197. " * CPU (process-based CPU-time)",
  198. /* FLAG_CPU */
  199. " Dumps the cpu-time into the result file using the variable named $cpuTime",
  200. /* FLAG_CSV_OSTEP */
  201. " Value specifies csv-files for debuge values for optimizer step",
  202. /* FLAG_DAE_MODE */
  203. " Enables daeMode simulation if the model was compiled with the omc flag --daeMode and the IDA integrator is used.",
  204. /* FLAG_DELTA_X_LINEARIZE */
  205. "value specifies the delta x value for numerical differentiation used by linearization. The default value is sqrt(DBL_EPSILON*2e1).",
  206. /* FLAG_DELTA_X_SOLVER */
  207. "value specifies the delta x value for numerical differentiation used by integrator. The default values is sqrt(DBL_EPSILON).",
  208. /* FLAG_EMBEDDED_SERVER */
  209. " Enables an embedded server. Valid values:\n\n"
  210. " * none - default, run without embedded server\n"
  211. " * opc-da - [broken] run with embedded OPC DA server (WIN32 only, uses proprietary OPC SC interface)\n"
  212. " * opc-ua - [experimental] run with embedded OPC UA server (TCP port 4841 for now; will have its own configuration option later)\n"
  213. " * filename - path to a shared object implementing the embedded server interface (requires access to internal OMC data-structures if you want to read or write data)",
  214. /* FLAG_EMIT_PROTECTED */
  215. " Emits protected variables to the result-file.",
  216. /* FLAG_F */
  217. " Value specifies a new setup XML file to the generated simulation code.\n",
  218. /* FLAG_HELP */
  219. " Get detailed information that specifies the command-line flag\n"
  220. " For example, -help=f prints detailed information for command-line flag f.",
  221. /* FLAG_IDA_MAXERRORTESTFAIL */
  222. " value specifies the maximum number of error test failures in attempting one step. The default value is 7.",
  223. /* FLAG_IDA_MAXNONLINITERS */
  224. " value specifies the maximum number of nonlinear solver iterations at one step. The default value is 3.",
  225. /* FLAG_IDA_MAXCONVFAILS */
  226. " value specifies the maximum number of nonlinear solver convergence failures at one step. The default value is 10.",
  227. /* FLAG_IDA_NONLINCONVCOEF */
  228. " value specifies the safety factor in the nonlinear convergence test. The default value is 0.33.",
  229. /* FLAG_IDA_LS */
  230. " Value specifies the linear solver of the IDA integrator. Valid values:\n\n"
  231. " * klu - default, fast sparse linear solver\n"
  232. " * dense - dense linear solver, sundials default method\n"
  233. " * spgmr - sparse iterative linear solver based on generalized minimal residual method, convergance is not guaranteed, sundials method\n"
  234. " * spbcg - sparse iterative linear solver based on biconjugate gradient method, convergance is not guaranteed, sundials method\n"
  235. " * spgmr - sparse iterative linear solver based on transpose free quasi-minimal residual method, convergance is not guaranteed, sundials method\n",
  236. /* FLAG_IDAS */
  237. " Enables sensitivity analysis with respect to parameters if the model is compiled with omc flag --calculateSensitivities.",
  238. /* FLAG_IGNORE_HIDERESULT */
  239. " Emits also variables with HideResult=true annotation.",
  240. /* FLAG_IIF */
  241. " Value specifies an external file for the initialization of the model.",
  242. /* FLAG_IIM */
  243. " Value specifies the initialization method.\n Following options are available: 'symbolic' (default) and 'none'.",
  244. /* FLAG_IIT */
  245. " Value [Real] specifies a time for the initialization of the model.",
  246. /* FLAG_ILS */
  247. " Value specifies the number of steps for homotopy method (required: -iim=symbolic).\n"
  248. " The value is an Integer with default value 1.",
  249. /* FLAG_INITIAL_STEP_SIZE */
  250. " Value specifies an initial stepsize for the dassl solver.",
  251. /* FLAG_INPUT_CSV */
  252. " Value specifies an csv-file with inputs for the simulation/optimization of the model",
  253. /* FLAG_INPUT_FILE */
  254. " Value specifies an external file with inputs for the simulation/optimization of the model.",
  255. /* FLAG_INPUT_FILE_STATES */
  256. " Value specifies an file with states start values for the optimization of the model.",
  257. /* FLAG_IPOPT_HESSE */
  258. " Value specifies the hessematrix for Ipopt(OMC, BFGS, const).",
  259. /* FLAG_IPOPT_INIT */
  260. " Value specifies the initial guess for optimization (sim, const).",
  261. /* FLAG_IPOPT_JAC */
  262. " Value specifies the jacobian for Ipopt(SYM, NUM, NUMDENSE).",
  263. /* FLAG_IPOPT_MAX_ITER */
  264. " Value specifies the max number of iteration for ipopt.",
  265. /* FLAG_IPOPT_WARM_START */
  266. " Value specifies lvl for a warm start in ipopt: 1,2,3,...",
  267. /* FLAG_JACOBIAN */
  268. " Selects the type of the Jacobian that is used for the integrator:\n\n"
  269. " * coloredNumerical (colored numerical Jacobian, the default).\n"
  270. " * internalNumerical (internal dassl numerical Jacobian).\n"
  271. " * coloredSymbolical (colored symbolical Jacobian. Only usable if the simulation is compiled with --generateSymbolicJacobian or --generateSymbolicLinearization.\n"
  272. " * numerical - numerical Jacobian.\n\n"
  273. " * symbolical - symbolical Jacobian. Only usable if the simulation is compiled with --generateSymbolicJacobian or --generateSymbolicLinearization.",
  274. /* FLAG_L */
  275. " Value specifies a time where the linearization of the model should be performed.",
  276. /* FLAG_L_DATA_RECOVERY */
  277. " Emit data recovery matrices with model linearization.",
  278. /* FLAG_LOG_FORMAT */
  279. " Value specifies the log format of the executable:\n\n"
  280. " * text (default)\n"
  281. " * xml\n"
  282. " * xmltcp (required -port flag)",
  283. /* FLAG_LS */
  284. " Value specifies the linear solver method",
  285. /* FLAG_LS_IPOPT */
  286. " Value specifies the linear solver method for Ipopt, default mumps.\n"
  287. " Note: Use if you build ipopt with other linear solver like ma27",
  288. /* FLAG_LSS */
  289. " Value specifies the linear sparse solver method",
  290. /* FLAG_LSS_MAX_DENSITY */
  291. " Value specifies the maximum density for using a linear sparse solver.\n"
  292. " The value is a Double with default value 0.2.",
  293. /* FLAG_LSS_MIN_SIZE */
  294. " Value specifies the minimum system size for using a linear sparse solver.\n"
  295. " The value is an Integer with default value 4001.",
  296. /* FLAG_LV */
  297. " Value (a comma-separated String list) specifies which logging levels to\n"
  298. " enable. Multiple options can be enabled at the same time.",
  299. /* FLAG_MAX_BISECTION_ITERATIONS */
  300. " value specifies the maximum number of bisection iterations for state event\n"
  301. " detection or zero for default behavior",
  302. /* FLAG_MAX_EVENT_ITERATIONS */
  303. " Value specifies the maximum number of event iterations.\n"
  304. " The value is an Integer with default value 20.",
  305. /* FLAG_MAX_ORDER */
  306. " Value specifies maximum integration order, used by dassl solver.",
  307. /* FLAG_MAX_STEP_SIZE */
  308. " Value specifies maximum absolute step size, used by dassl solver.",
  309. /* FLAG_MEASURETIMEPLOTFORMAT */
  310. " Value specifies the output format of the measure time functionality\n\n"
  311. " * svg\n"
  312. " * jpg\n"
  313. " * ps\n"
  314. " * gif\n"
  315. " * ...",
  316. /* FLAG_NEWTON_FTOL */
  317. " Tolerance respecting residuals for updating solution vector in Newton solver."
  318. " Solution is accepted if the (scaled) 2-norm of the residuals is smaller than the tolerance newtonFTol and the (scaled) newton correction (delta_x) is smaller than the tolerance newtonXTol."
  319. " The value is a Double with default value 1e-12.",
  320. /* FLAG_NEWTON_XTOL */
  321. " Tolerance respecting newton correction (delta_x) for updating solution vector in Newton solver."
  322. " Solution is accepted if the (scaled) 2-norm of the residuals is smaller than the tolerance newtonFTol and the (scaled) newton correction (delta_x) is smaller than the tolerance newtonXTol."
  323. " The value is a Double with default value 1e-12.",
  324. /* FLAG_NEWTON_STRATEGY */
  325. " Value specifies the damping strategy for the newton solver.",
  326. /* FLAG_NLS */
  327. " Value specifies the nonlinear solver:\n\n"
  328. " * hybrid\n"
  329. " * kinsol\n"
  330. " * newton\n"
  331. " * mixed",
  332. /* FLAG_NLS_INFO */
  333. " Outputs detailed information about solving process of non-linear systems into csv files.",
  334. /* FLAG_NLS_LS */
  335. " Value specifies the linear solver used by the non-linear solver:\n * totalpivot\n * lapack (default)\n * klu",
  336. /* FLAG_NOEMIT */
  337. " Do not emit any results to the result file.",
  338. /* FLAG_NOEQUIDISTANT_GRID */
  339. " Output the internal steps given by dassl instead of interpolating results\n"
  340. " into an equidistant time grid as given by stepSize or numberOfIntervals.",
  341. /* FLAG_NOEQUIDISTANT_OUT_FREQ*/
  342. " Integer value n controls the output frequency in noEquidistantTimeGrid mode\n"
  343. " and outputs every n-th time step",
  344. /* FLAG_NOEQUIDISTANT_OUT_TIME*/
  345. " Real value timeValue controls the output time point in noEquidistantOutputTime\n"
  346. " mode and outputs every time>=k*timeValue, where k is an integer",
  347. /* FLAG_NOEVENTEMIT */
  348. " Do not emit event points to the result file.",
  349. /* FLAG_NO_RESTART */
  350. " Deactivates the restart of dassl/ida after an event is performed.",
  351. /* FLAG_NO_ROOTFINDING */
  352. " Deactivates the internal root finding procedure of dassl/ida solver.",
  353. /* FLAG_NO_SUPPRESS_ALG */
  354. " flag to not suppress algebraic variables in the local error test of the ida solver in daeMode.\n"
  355. " In general, the use of this option is discouraged when solving DAE systems of index 1,\n"
  356. " whereas it is generally encouraged for systems of index 2 or more.",
  357. /* FLAG_OPTDEBUGEJAC */
  358. " Value specifies the number of itereations from the dynamic optimization, which\n"
  359. " will be debugged, creating .csv and .py files.",
  360. /* FLAG_OPTIMIZER_NP */
  361. " Value specifies the number of points in a subinterval.\n"
  362. " Currently supports numbers 1 and 3.",
  363. /* FLAG_OPTIMIZER_TGRID */
  364. " Value specifies external file with time points.",
  365. /* FLAG_OUTPUT */
  366. " Output the variables a, b and c at the end of the simulation to the standard\n"
  367. " output: time = value, a = value, b = value, c = value",
  368. /* FLAG_OVERRIDE */
  369. " Override the variables or the simulation settings in the XML setup file\n"
  370. " For example: var1=start1,var2=start2,par3=start3,startTime=val1,stopTime=val2",
  371. /* FLAG_OVERRIDE_FILE */
  372. " Will override the variables or the simulation settings in the XML setup file\n"
  373. " with the values from the file.\n"
  374. " Note that: -overrideFile CANNOT be used with -override.\n"
  375. " Use when variables for -override are too many.\n"
  376. " overrideFileName contains lines of the form: var1=start1",
  377. /* FLAG_PORT */
  378. " Value specifies the port for simulation status (default disabled).",
  379. /* FLAG_R */
  380. " Value specifies the name of the output result file.\n"
  381. " The default file-name is based on the model name and output format.\n"
  382. " For example: Model_res.mat.",
  383. /* FLAG_RT */
  384. " Value specifies the scaling factor for real-time synchronization (0 disables).\n"
  385. " A value > 1 means the simulation takes a longer time to simulate.\n",
  386. /* FLAG_S */
  387. " Value specifies the solver (integration method).",
  388. /* FLAG_SOLVER_STEPS */
  389. " dumps the number of integration steps into the result file",
  390. /* FLAG_UP_HESSIAN */
  391. " Value specifies the number of steps, which keep hessian matrix constant.",
  392. /* FLAG_W */
  393. " Shows all warnings even if a related log-stream is inactive.",
  394. "FLAG_MAX"
  395. };
  396. const int FLAG_TYPE[FLAG_MAX] = {
  397. FLAG_TYPE_UNKNOWN,
  398. /* FLAG_ABORT_SLOW */ FLAG_TYPE_FLAG,
  399. /* FLAG_ALARM */ FLAG_TYPE_OPTION,
  400. /* FLAG_CLOCK */ FLAG_TYPE_OPTION,
  401. /* FLAG_CPU */ FLAG_TYPE_FLAG,
  402. /* FLAG_CSV_OSTEP */ FLAG_TYPE_OPTION,
  403. /* FLAG_DAE_SOLVING */ FLAG_TYPE_FLAG,
  404. /* FLAG_DELTA_X_LINEARIZE */ FLAG_TYPE_OPTION,
  405. /* FLAG_DELTA_X_SOLVER */ FLAG_TYPE_OPTION,
  406. /* FLAG_EMBEDDED_SERVER */ FLAG_TYPE_OPTION,
  407. /* FLAG_EMIT_PROTECTED */ FLAG_TYPE_FLAG,
  408. /* FLAG_F */ FLAG_TYPE_OPTION,
  409. /* FLAG_HELP */ FLAG_TYPE_OPTION,
  410. /* FLAG_IDA_MAXERRORTESTFAIL */ FLAG_TYPE_OPTION,
  411. /* FLAG_IDA_MAXNONLINITERS */ FLAG_TYPE_OPTION,
  412. /* FLAG_IDA_MAXCONVFAILS */ FLAG_TYPE_OPTION,
  413. /* FLAG_IDA_NONLINCONVCOEF */ FLAG_TYPE_OPTION,
  414. /* FLAG_IDA_LS */ FLAG_TYPE_OPTION,
  415. /* FLAG_IDAS */ FLAG_TYPE_FLAG,
  416. /* FLAG_IGNORE_HIDERESULT */ FLAG_TYPE_FLAG,
  417. /* FLAG_IIF */ FLAG_TYPE_OPTION,
  418. /* FLAG_IIM */ FLAG_TYPE_OPTION,
  419. /* FLAG_IIT */ FLAG_TYPE_OPTION,
  420. /* FLAG_ILS */ FLAG_TYPE_OPTION,
  421. /* FLAG_INITIAL_STEP_SIZE */ FLAG_TYPE_OPTION,
  422. /* FLAG_INPUT_CSV */ FLAG_TYPE_OPTION,
  423. /* FLAG_INPUT_FILE */ FLAG_TYPE_OPTION,
  424. /* FLAG_INPUT_FILE_STATES */ FLAG_TYPE_OPTION,
  425. /* FLAG_IPOPT_HESSE */ FLAG_TYPE_OPTION,
  426. /* FLAG_IPOPT_INIT */ FLAG_TYPE_OPTION,
  427. /* FLAG_IPOPT_JAC */ FLAG_TYPE_OPTION,
  428. /* FLAG_IPOPT_MAX_ITER */ FLAG_TYPE_OPTION,
  429. /* FLAG_IPOPT_WARM_START */ FLAG_TYPE_OPTION,
  430. /* FLAG_JACOBIAN */ FLAG_TYPE_OPTION,
  431. /* FLAG_L */ FLAG_TYPE_OPTION,
  432. /* FLAG_L_DATA_RECOVERY */ FLAG_TYPE_FLAG,
  433. /* FLAG_LOG_FORMAT */ FLAG_TYPE_OPTION,
  434. /* FLAG_LS */ FLAG_TYPE_OPTION,
  435. /* FLAG_LS_IPOPT */ FLAG_TYPE_OPTION,
  436. /* FLAG_LSS */ FLAG_TYPE_OPTION,
  437. /* FLAG_LSS_MAX_DENSITY */ FLAG_TYPE_OPTION,
  438. /* FLAG_LSS_MIN_SIZE */ FLAG_TYPE_OPTION,
  439. /* FLAG_LV */ FLAG_TYPE_OPTION,
  440. /* FLAG_MAX_BISECTION_ITERATIONS */ FLAG_TYPE_OPTION,
  441. /* FLAG_MAX_EVENT_ITERATIONS */ FLAG_TYPE_OPTION,
  442. /* FLAG_MAX_ORDER */ FLAG_TYPE_OPTION,
  443. /* FLAG_MAX_STEP_SIZE */ FLAG_TYPE_OPTION,
  444. /* FLAG_MEASURETIMEPLOTFORMAT */ FLAG_TYPE_OPTION,
  445. /* FLAG_NEWTON_FTOL */ FLAG_TYPE_OPTION,
  446. /* FLAG_NEWTON_XTOL */ FLAG_TYPE_OPTION,
  447. /* FLAG_NEWTON_STRATEGY */ FLAG_TYPE_OPTION,
  448. /* FLAG_NLS */ FLAG_TYPE_OPTION,
  449. /* FLAG_NLS_INFO */ FLAG_TYPE_FLAG,
  450. /* FLAG_NLS_LS */ FLAG_TYPE_OPTION,
  451. /* FLAG_NOEMIT */ FLAG_TYPE_FLAG,
  452. /* FLAG_NOEQUIDISTANT_GRID*/ FLAG_TYPE_FLAG,
  453. /* FLAG_NOEQUIDISTANT_OUT_FREQ*/ FLAG_TYPE_OPTION,
  454. /* FLAG_NOEQUIDISTANT_OUT_TIME*/ FLAG_TYPE_OPTION,
  455. /* FLAG_NO_RESTART */ FLAG_TYPE_FLAG,
  456. /* FLAG_NO_ROOTFINDING */ FLAG_TYPE_FLAG,
  457. /* FLAG_NO_SUPPRESS_ALG */ FLAG_TYPE_FLAG,
  458. /* FLAG_NOEVENTEMIT */ FLAG_TYPE_FLAG,
  459. /* FLAG_OPTDEBUGEJAC */ FLAG_TYPE_OPTION,
  460. /* FLAG_OPTIZER_NP */ FLAG_TYPE_OPTION,
  461. /* FLAG_OPTIZER_TGRID */ FLAG_TYPE_OPTION,
  462. /* FLAG_OUTPUT */ FLAG_TYPE_OPTION,
  463. /* FLAG_OVERRIDE */ FLAG_TYPE_OPTION,
  464. /* FLAG_OVERRIDE_FILE */ FLAG_TYPE_OPTION,
  465. /* FLAG_PORT */ FLAG_TYPE_OPTION,
  466. /* FLAG_R */ FLAG_TYPE_OPTION,
  467. /* FLAG_RT */ FLAG_TYPE_OPTION,
  468. /* FLAG_S */ FLAG_TYPE_OPTION,
  469. /* FLAG_SOLVER_STEPS */ FLAG_TYPE_FLAG,
  470. /* FLAG_UP_HESSIAN */ FLAG_TYPE_OPTION,
  471. /* FLAG_W */ FLAG_TYPE_FLAG
  472. };
  473. const char *SOLVER_METHOD_NAME[S_MAX] = {
  474. "unknown",
  475. "euler",
  476. "rungekutta",
  477. "dassl",
  478. "optimization",
  479. "radau5",
  480. "radau3",
  481. "impeuler",
  482. "trapezoid",
  483. "lobatto4",
  484. "lobatto6",
  485. "symEuler",
  486. "symEulerSsc",
  487. "heun",
  488. "ida",
  489. "rungekutta_ssc",
  490. "qss"
  491. };
  492. const char *SOLVER_METHOD_DESC[S_MAX] = {
  493. "unknown",
  494. "euler - Explicit Euler (order 1)",
  495. "rungekutta - Runge-Kutta (fixed step, order 4)",
  496. "dassl - BDF solver with colored numerical jacobian, with interval root finding - default",
  497. "optimization - Special solver for dynamic optimization",
  498. "radau5 - Radau IIA with 3 points, \"Implicit Runge-Kutta\", order 5 [sundial/kinsol needed]",
  499. "radau3 - Radau IIA with 2 points, \"Implicit Runge-Kutta\", order 3 [sundial/kinsol needed]",
  500. "impeuler - Implicit Euler (actually Radau IIA, order 1) [sundial/kinsol needed]",
  501. "trapezoid - Trapezoidal rule (actually Lobatto IIA with 2 points) [sundial/kinsol needed]",
  502. "lobatto4 - Lobatto IIA with 3 points, order 4 [sundial/kinsol needed]",
  503. "lobatto6 - Lobatto IIA with 4 points, order 6 [sundial/kinsol needed]",
  504. "symEuler - symbolic implicit euler, [compiler flag +symEuler needed]",
  505. "symEulerSsc - symbolic implicit euler with step-size control, [compiler flag +symEuler needed]",
  506. "heun - Heun's method (Runge-Kutta fixed step, order 2)",
  507. "ida - Sundials ida solver",
  508. "rungekutta_ssc - Runge-Kutta (with step size control, see. Novikov (2016), Solving Stiff Systems of ODEs...)",
  509. "qss - A QSS solver [experimental]"
  510. };
  511. const char *INIT_METHOD_NAME[IIM_MAX] = {
  512. "unknown",
  513. "none",
  514. "symbolic"
  515. };
  516. const char *INIT_METHOD_DESC[IIM_MAX] = {
  517. "unknown",
  518. "sets all variables to their start values and skips the initialization process",
  519. "solves the initialization problem symbolically - default"
  520. };
  521. const char *LS_NAME[LS_MAX+1] = {
  522. "LS_UNKNOWN",
  523. /* LS_LAPACK */ "lapack",
  524. #if !defined(OMC_MINIMAL_RUNTIME)
  525. /* LS_LIS */ "lis",
  526. #endif
  527. /* LS_KLU */ "klu",
  528. /* LS_UMFPACK */ "umfpack",
  529. /* LS_TOTALPIVOT */ "totalpivot",
  530. /* LS_DEFAULT */ "default",
  531. "LS_MAX"
  532. };
  533. const char *LS_DESC[LS_MAX+1] = {
  534. "unknown",
  535. /* LS_LAPACK */ "method using lapack LU factorization",
  536. #if !defined(OMC_MINIMAL_RUNTIME)
  537. /* LS_LIS */ "method using iterativ solver Lis",
  538. #endif
  539. /* LS_KLU */ "method using klu sparse linear solver",
  540. /* LS_UMFPACK */ "method using umfpack sparse linear solver",
  541. /* LS_TOTALPIVOT */ "method using a total pivoting LU factorization for underdetermination systems",
  542. /* LS_DEFAULT */ "default method - lapack with total pivoting as fallback",
  543. "LS_MAX"
  544. };
  545. const char *LSS_NAME[LS_MAX+1] = {
  546. "LS_UNKNOWN",
  547. #if !defined(OMC_MINIMAL_RUNTIME)
  548. /* LS_LIS */ "lis",
  549. #endif
  550. /* LS_KLU */ "klu",
  551. /* LS_UMFPACK */ "umfpack",
  552. "LSS_MAX"
  553. };
  554. const char *LSS_DESC[LS_MAX+1] = {
  555. "unknown",
  556. #if !defined(OMC_MINIMAL_RUNTIME)
  557. /* LS_LIS */ "method using iterativ solver Lis",
  558. #endif
  559. /* LS_KLU */ "method using klu sparse linear solver",
  560. /* LS_UMFPACK */ "method using umfpack sparse linear solver",
  561. "LSS_MAX"
  562. };
  563. const char *NLS_NAME[NLS_MAX+1] = {
  564. "NLS_UNKNOWN",
  565. #if !defined(OMC_MINIMAL_RUNTIME)
  566. /* NLS_HYBRID */ "hybrid",
  567. /* NLS_KINSOL */ "kinsol",
  568. /* NLS_NEWTON */ "newton",
  569. #endif
  570. /* NLS_HOMOTOPY */ "homotopy",
  571. #if !defined(OMC_MINIMAL_RUNTIME)
  572. /* NLS_MIXED */ "mixed",
  573. #endif
  574. "NLS_MAX"
  575. };
  576. const char *NLS_DESC[NLS_MAX+1] = {
  577. "unknown",
  578. #if !defined(OMC_MINIMAL_RUNTIME)
  579. /* NLS_HYBRID */ "Modification of the Powell hybrid method from minpack - former default solver",
  580. /* NLS_KINSOL */ "sundials/kinsol - prototype implementation",
  581. /* NLS_NEWTON */ "Newton Raphson - prototype implementation",
  582. #endif
  583. /* NLS_HOMOTOPY */ "Damped Newton solver if failing case fixed-point and Newton homotopies are tried.",
  584. #if !defined(OMC_MINIMAL_RUNTIME)
  585. /* NLS_MIXED */ "Mixed strategy. First the homotopy solver is tried and then as fallback the hybrid solver.",
  586. #endif
  587. "NLS_MAX"
  588. };
  589. const char *NEWTONSTRATEGY_NAME[NEWTON_MAX+1] = {
  590. "NEWTON_UNKNOWN",
  591. /* NEWTON_DAMPED */ "damped",
  592. /* NEWTON_DAMPED2 */ "damped2",
  593. /* NEWTON_DAMPED_LS */ "damped_ls",
  594. /* NEWTON_DAMPED_BT */ "damped_bt",
  595. /* NEWTON_PURE */ "pure",
  596. "NEWTON_MAX"
  597. };
  598. const char *NEWTONSTRATEGY_DESC[NEWTON_MAX+1] = {
  599. "unknown",
  600. /* NEWTON_DAMPED */ "Newton with a damping strategy",
  601. /* NEWTON_DAMPED2 */ "Newton with a damping strategy 2",
  602. /* NEWTON_DAMPED_LS */ "Newton with a damping line search",
  603. /* NEWTON_DAMPED_BT */ "Newton with a damping backtracking and a minimum search via golden ratio method",
  604. /* NEWTON_PURE */ "Newton without damping strategy",
  605. "NEWTON_MAX"
  606. };
  607. const char *JACOBIAN_METHOD[JAC_MAX+1] = {
  608. "unknown",
  609. "coloredNumerical",
  610. "coloredSymbolical",
  611. "internalNumerical",
  612. "numerical",
  613. "symbolical",
  614. "kluSparse",
  615. "JAC_MAX"
  616. };
  617. const char *JACOBIAN_METHOD_DESC[JAC_MAX+1] = {
  618. "unknown",
  619. "colored numerical jacobian - default.",
  620. "colored symbolic jacobian - needs omc compiler flags +generateSymbolicJacobian or +generateSymbolicLinearization.",
  621. "internal numerical jacobian.",
  622. "numerical jacobian.",
  623. "symbolic jacobian - needs omc compiler flags +generateSymbolicJacobian or +generateSymbolicLinearization.",
  624. "sparse jacobian for KLU",
  625. "JAC_MAX"
  626. };
  627. const char *IDA_LS_METHOD[IDA_LS_MAX+1] = {
  628. "unknown",
  629. "dense",
  630. "klu",
  631. "spgmr",
  632. "spbcg",
  633. "sptfqmr",
  634. "IDA_LS_MAX"
  635. };
  636. const char *IDA_LS_METHOD_DESC[IDA_LS_MAX+1] = {
  637. "unknown",
  638. "ida internal dense method",
  639. "ida use sparse direct solver KLU",
  640. "ida generalized minimal residual method. Iterativ method",
  641. "ida Bi-CGStab. Iterativ method",
  642. "ida TFQMR. Iterativ method",
  643. "IDA_LS_MAX"
  644. };
  645. const char *NLS_LS_METHOD[NLS_LS_MAX+1] = {
  646. "unknown",
  647. "totalpivot",
  648. "lapack",
  649. "klu",
  650. "NLS_LS_MAX"
  651. };
  652. const char *NLS_LS_METHOD_DESC[NLS_LS_MAX+1] = {
  653. "unknown",
  654. "internal total pivot implementation. Solve in some case even under-determined systems.",
  655. "use external lapack implementation.",
  656. "use klu direct sparse solver.",
  657. "NLS_LS_MAX"
  658. };