Coverage for pydelica/options/runtime.py: 96%

1 import pydantic

2 import typing

3

4

5 class RuntimeOptions(pydantic.BaseModel, validate_assignment=True, extra="forbid"):

6 """C Runtime Simulation Flags

7

8 https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/simulationflags.html

9

10 The relevant OM flag is shown in '[]' alongside parameter descriptions.

11

12 Attributes

13 ----------

14

15 abortSlowSimulation : bool, optional

16 Aborts if the simulation chatters (default False).

17

18 alarm : int, optional

19 Aborts after the given number of seconds (default=0 disables the alarm).

20

21 clock : Literal["RT", "CYC", "CPU"] | None, optional

22 Selects the type of clock to use. Valid options includes:

23 RT (monotonic real-time clock)

24 CYC (cpu cycles measured with RDTSC)

25 CPU (process-based CPU-time)

26

27 cpu : bool, optional

28 Dumps the cpu-time into the result file using the variable named $cpuTime (default False).

29

30 csvOstep : str | None, optional

31 Specifies csv-files for debug values for optimizer step (default None).

32

33 cvodeNonlinearSolverIteration : CV_ITER | None, optional

34 Nonlinear solver iteration for CVODE solver.

35 Default depends on option cvode_linear_multistep_method. Valid values:

36 CV_ITER.NEWTON - Newton iteration.

37 Advised to use together with argument cvode_linear_multistep_method=CV.BDF.

38 CV_ITER_FIXED_POINT - Fixed-Point iteration iteration.

39 Advised to use together with argument cvode_linear_multistep_method=CV.ADAMS.

40

41 cvodeLinearMultistepMethod : CV | None, optional

42 Linear multistep method for CVODE solver (default CV.BDF). Valid values:

43 CV.BDF - BDF linear multistep method for stiff problems.

44 Use together with argument cvode_non_linear_solver_iter=CV_ITER.NEWTON or None.

45

46 CV.ADAMS - Adams-Moulton linear multistep method for nonstiff problems.

47 Use together with argument cvode_non_linear_solver_iter=CV_ITER.FIXED_POINT or None.

48

49 cx : str | None, optional

50 Specifies a csv-file with inputs as correlation coefficient matrix Cx for DataReconciliation

51

52 daeMode : bool | None, optional

53 Enables daeMode simulation if the model was compiled with the omc flag --daeMode and ida method is used.

54

55 deltaXLinearize : float | None, optional

56 Specifies the delta x value for numerical differentiation used by linearization.

57 The default value is sqrt(DBL_EPSILON*2e1).

58

59 deltaXSolver : float | None, optional

60 Sspecifies the delta x value for numerical differentiation used by integration method.

61 The default values is sqrt(DBL_EPSILON).

62

63 embeddedServer : Literal["opc-da", "opc-ua"] | str | None, optional

64 Enables an embedded server. Valid values:

65 None - default, run without embedded server

66

67 opc-da - Run with embedded OPC DA server (WIN32 only, uses proprietary OPC SC interface)

68

69 opc-ua - Run with embedded OPC UA server (TCP port 4841 for now; will have its own configuration option later)

70

71 str - 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)

72

73 embeddedServerPort : int | None, optional

74 Sspecifies the port number used by the embedded server. The default value is 4841 if an embedded server is set.

75

76 mat_sync : int | None, optional

77 Syncs the mat file header after emitting every N time-points.

78

79 emit_protected : bool | None, optional

80 Emits protected variables to the result-file.

81

82 eps : int | None, optional

83 Specifies the number of convergence iteration to be performed for DataReconciliation.

84

85 f : str | None, optional

86 Specifies a new setup XML file to the generated simulation code.

87

88 homAdaptBend : float | None, optional

89 Maximum trajectory bending to accept the homotopy step.

90 Default of 0.5 means the corrector vector has to be smaller than half of the predictor vector.

91

92 homBacktraceStrategy : Literal["fix", "orthogonal"] | None, optional

93 Specifies the backtrace strategy in the homotopy corrector step. Valid values:

94

95 fix - default, go back to the path by fixing one coordinate

96

97 orthogonal - go back to the path in an orthogonal direction to the tangent vector

98

99 homHEps : float | None, optional

100 Tolerance respecting residuals for the homotopy H-function (default: 1e-5).

101 In the last step (lambda=1) newtonFTol is used as tolerance.

102

103 homMaxLambdaSteps : int | None, optional

104 Maximum lambda steps allowed to run the homotopy path (default: system size * 100).

105

106 homMaxNewtonSteps : int | None, optional

107 Maximum newton steps in the homotopy corrector step (default: 20).

108

109 homMaxTries : int | None, optional

110 Maximum number of tries for one homotopy lambda step (default: 10).

111

112 homNegStartDir : bool, optional

113 Start to run along the homotopy path in the negative direction.

114

115 If one direction fails, the other direction is always used as fallback option.

116

117 noHomotopyOnFirstTry : bool, optional

118 If the model contains the homotopy operator, directly use the homotopy method

119 to solve the initialization problem.

120

121 homTauDecFac : float, optional

122 Decrease homotopy step size tau by this factor if tau is

123 too big in the homotopy corrector step (default: 10.0).

124

125 homTauDecFacPredictor : float, optional

126 Decrease homotopy step size tau by this factor if tau

127 is too big in the homotopy predictor step (default: 2.0).

128

129 homTauIncFac : float, optional

130 Increase homotopy step size tau by this factor if tau

131 can be increased after the homotopy corrector step (default: 2.0).

132

133 homTauIncThreshold : float, optional

134 Increase the homotopy step size tau if homAdaptBend/bend > homTauIncThreshold (default: 10).

135

136 homTauMax : float, optional

137 Maximum homotopy step size tau for the homotopy process (default: 10).

138

139 homTauMin : float, optional

140 Minimum homotopy step size tau for the homotopy process (default: 1e-4).

141

142 homTauStart : float, optional

143 Homotopy step size tau at the beginning of the homotopy process (default: 0.2).

144

145 ils : int, optional

146 Specifies the number of steps for homotopy method (required: initialisation_method='symbolic').

147 The value is an Integer with default value 3.

148

149 idaMaxErrorTestFails : int, optional

150 Specifies the maximum number of error test failures in attempting one step.

151 The default value is 7.

152

153 idaMaxNonLinIters : int, optional

154 Specifies the maximum number of nonlinear solver iterations at one step.

155 The default value is 3.

156

157 idaMaxConvFails : int, optional

158 Specifies the maximum number of nonlinear solver convergence failures at one step.

159 The default value is 10.

160

161 idaNonLinConvCoef : float, optional

162 Specifies the safety factor in the nonlinear convergence test. The default value is 0.33.

163

164 idaLS : Literal["dense", "klu", "spgmr", "spbcg", "sptqmr"], optional

165 Specifies the linear solver of the ida integration method. Valid values:

166

167 dense (ida internal dense method.)

168

169 klu (ida use sparse direct solver KLU. (default))

170

171 spgmr (ida generalized minimal residual method. Iterative method)

172

173 spbcg (ida Bi-CGStab. Iterative method)

174

175 sptfqmr (ida TFQMR. Iterative method)

176

177 idaScaling : bool, optional [-idaScaling]

178 Enable scaling of the IDA solver.

179

180 idaSensitivity : bool, optional

181 Enables sensitivity analysis with respect to parameters if the

182 model is compiled with omc flag --calculateSensitivities.

183

184 ignoreHideResult : bool, optional [-ignoreHideResult]

185 Emits also variables with HideResult=true annotation.

186

187 iif : str, optional

188 Specifies an external file for the initialization of the model.

189

190 iim : Literal["none", "symbolic"], optional

191 Specifies the initialization method. Following options are available: 'symbolic' (default) and 'none'.

192

193 none (sets all variables to their start values and skips the initialization process)

194

195 symbolic (solves the initialization problem symbolically - default)

196

197 iit : float, optional

198 Specifies a time for the initialization of the model.

199

200 impRKOrder : int, optional

201 Specifies the integration order of the implicit Runge-Kutta method.

202 Valid values: 1 to 6. Default order is 5.

203

204 impRKLS : Literal["iterativ", "dense"], optional

205 Selects the linear solver of the integration methods impeuler, trapezoid and imprungekuta:

206

207 iterativ - default, sparse iterativ linear solver with fallback case to dense solver

208

209 dense - dense linear solver, SUNDIALS default method

210

211 initialStepSize : float, optional

212 Specifies an initial step size, used by the methods: dassl, ida, gbode

213

214 csvInput : str, optional

215 Specifies an csv-file with inputs for the simulation/optimization of the model

216

217 stateFile : str, optional

218 Specifies an file with states start values for the optimization of the model.

219

220 ipopt_hesse : str, optional

221 Specifies the hessematrix for Ipopt(OMC, BFGS, const).

222

223 ipopt_init : str, optional [-ipopt_init=value]

224 Specifies the initial guess for optimization (sim, const).

225

226 ipopt_jac : str, optional [-ipopt_jac=value]

227 Specifies the Jacobian for Ipopt(SYM, NUM, NUMDENSE).

228

229 ipopt_max_iter : int, optional

230 Specifies the max number of iteration for ipopt.

231

232 ipopt_warm_start : int, optional

233 Specifies lvl for a warm start in ipopt: 1,2,3,...

234

235 jacobian : Literal["coloredNumerical", "internalNumerical", "coloredSymbolical", "numerical", "symbolical"], optional

236 Select the calculation method for Jacobian used by the integration method:

237

238 coloredNumerical (Colored numerical Jacobian, which is default for dassl and ida. With option -idaLS=klu a sparse matrix is used.)

239

240 internalNumerical (Dense solver internal numerical Jacobian.)

241

242 coloredSymbolical (Colored symbolical Jacobian. Needs omc compiler flag --generateSymbolicJacobian. With option -idaLS=klu a sparse matrix is used.)

243

244 numerical (Dense numerical Jacobian.)

245

246 symbolical (Dense symbolical Jacobian. Needs omc compiler flag --generateSymbolicJacobian.)

247

248 jacobianThreads : int, optional

249 Specifies the number of threads for jacobian evaluation in dassl or ida. The value is an Integer with default value 1.

250

251 l : float, optional [-l=value]

252 Specifies a time where the linearization of the model should be performed.

253

254 l_datarec : bool, optional [-l_datarec]

255 Emit data recovery matrices with model linearization.

256

257 logFormat : Literal["text", "xml", "xmltcp"], optional

258 Specifies the log format of the executable:

259

260 text (default)

261

262 xml

263

264 xmltcp (required -port flag)

265

266 ls : Literal["lapack", "lis", "klu", "umfpack", "totalpivot", "default"], optional [-ls=value]

267 Specifies the linear solver method

268

269 lapack (method using LAPACK LU factorization)

270

271 lis (method using iterative solver Lis)

272

273 klu (method using KLU sparse linear solver)

274

275 umfpack (method using UMFPACK sparse linear solver)

276

277 totalpivot (method using a total pivoting LU factorization for underdetermination systems)

278

279 default (default method - LAPACK with total pivoting as fallback)

280

281 ls_ipopt : str, optional

282 Specifies the linear solver method for Ipopt, default mumps.

283 Note: Use if you build ipopt with other linear solver like ma27

284

285 lss : Literal["default", "lis", "klu", "umfpack"], optional [-lss=value]

286 Specifies the linear sparse solver method

287

288 default (the default sparse linear solver (or a dense solver if there is none available) )

289

290 lis (method using iterative solver Lis)

291

292 klu (method using klu sparse linear solver)

293

294 umfpack (method using umfpack sparse linear solver)

295

296 lssMaxDensity : float, optional

297 Specifies the maximum density for using a linear sparse solver. The value is a Double with default value 0.2.

298

299 lssMinSize : int, optional

300 Specifies the minimum system size for using a linear sparse solver. The value is an Integer with default value 1000.

301

302 lvMaxWarn : int, optional

303 Maximum number of times some repeating warnings are displayed. Default value 3.

304

305 lv_time : (float, float), optional

306 Specifies in which time interval logging is active.

307 Doesn't affect LOG_STDOUT, LOG_ASSERT, and LOG_SUCCESS, LOG_STATS, LOG_STATS_V.

308

309 lv_system : (int, ...), optional

310 List of equation indices (available in the transformational debugger)

311 for which solver logs are shown (by default logs for all systems are shown)

312

313 mbi : int, optional

314 Specifies the maximum number of bisection iterations for state event detection

315 or zero for default behavior

316

317 mei : int, optional

318 Specifies the maximum number of event iterations.

319 The value is an Integer with default value 20.

320

321 maxIntegrationOrder : int, optional

322 Specifies maximum integration order, used by the methods: dassl, ida.

323

324 maxStepSize : float, optional

325 Specifies maximum absolute step size, used by the methods: dassl, ida, gbode.

326

327 measureTimePlotFormat : Literal['svg', 'jpg', 'ps', 'gif'], optional

328 Specifies the output format of the measure time functionality

329

330 newtonDiagnostics : bool, optional

331 Implementation of "On the choice of initial guesses for the Newton-Raphson algorithm."

332 See: https://doi.org/10.1016/j.amc.2021.125991

333

334 newtonFTol : float, optional

335 Tolerance respecting residuals for updating solution vector in Newton solver.

336 Solution is accepted if the (scaled) 2-norm of the residuals is smaller than

337 the tolerance newtonFTol and the (scaled) newton correction (delta_x)

338 is smaller than the tolerance newtonXTol. The value is a Double with default value 1e-12.

339

340 newtonMaxStepFactor : float, optional

341 Maximum newton step factor mxnewtstep = maxStepFactor * norm2(xScaling). Used currently only by KINSOL.

342

343 newtonXTol : float, optional

344 Tolerance respecting newton correction (delta_x) for updating solution vector in Newton solver.

345 Solution is accepted if the (scaled) 2-norm of the residuals is smaller than

346 the tolerance newtonFTol and the (scaled) newton correction (delta_x) is

347 smaller than the tolerance newtonXTol. The value is a Double with default value 1e-12.

348

349 newton : Literal['damped', 'damped2', 'damped_ls', 'damped_bt'], optional

350 Specifies the damping strategy for the newton solver.

351

352 damped (Newton with a damping strategy)

353

354 damped2 (Newton with a damping strategy 2)

355

356 damped_ls (Newton with a damping line search)

357

358 damped_bt (Newton with a damping backtracking and a minimum search via golden ratio method)

359

360 pure (Newton without damping strategy)

361

362 nls : Literal['hybrid', 'kinsol', 'kinsol', 'newton', 'mixed', 'homotopy'], optional

363 Specifies the nonlinear solver:

364

365 hybrid (Modification of the Powell hybrid method from minpack - former default solver)

366

367 kinsol (SUNDIALS/KINSOL includes an interface to the sparse direct solver, KLU. See simulation option -nlsLS for more information.)

368

369 newton (Newton Raphson - prototype implementation)

370

371 mixed (Mixed strategy. First the homotopy solver is tried and then as fallback the hybrid solver.)

372

373 homotopy (Damped Newton solver if failing case fixed-point and Newton homotopies are tried.)

374

375

376 nlsInfo : bool, optional

377 Outputs detailed information about solving process of non-linear systems into csv files.

378

379 nlsLS : Literal['default', 'totalpivot', 'lapack', 'klu'], optional

380 Specifies the linear solver used by the non-linear solver:

381

382 default (chooses the nls linear solver based on which nls is being used.)

383

384 totalpivot (internal total pivot implementation. Solve in some case even under-determined systems.)

385

386 lapack (use external LAPACK implementation.)

387

388 klu (use KLU direct sparse solver. Only with KINSOL available.)

389

390 nlssMaxDensity : float, optional

391 specifies the maximum density for using a non-linear sparse solver.

392 The default value is 0.1

393

394 nlssMinSize : int, optional

395 Value specifies the minimum system size for using a non-linear sparse solver.

396 The value is an Integer with default value 1000.

397

398 noemit : bool, optional

399 Do not emit any results to the result file.

400

401 noEquidistantTimeGrid : bool, optional

402 Output the internal steps given by dassl/ida instead of interpolating results

403 into an equidistant time grid as given by stepSize or numberOfIntervals.

404

405 noEquidistantOutputFrequency : int, optional

406 Value 'n' controls the output frequency in noEquidistantTimeGrid mode

407 and outputs every n-th time step

408

409 noEquidistantOutputTime : float, optional

410 Value timeValue controls the output time point in noEquidistantOutputTime

411 mode and outputs every time>=k*timeValue, where k is an integer

412

413 noEventEmit : bool, optional

414 Do not emit event points to the result file.

415

416 noRestart : bool, optional

417 Disables the restart of the integration method after an event

418 is performed, used by the methods: dassl, ida

419

420 noRootFinding : bool, optional

421 Disables the internal root finding procedure of methods: dassl and ida.

422

423 noScaling : bool, optional

424 Disables scaling for the variables and the residuals in the algebraic nonlinear solver KINSOL.

425

426 noSuppressAlg : bool, optional

427 Flag to not suppress algebraic variables in the local error test of the ida solver in daeMode.

428 In general, the use of this option is discouraged when solving DAE systems of index 1,

429 whereas it is generally encouraged for systems of index 2 or more.

430

431 optDebugJac : int, optional

432 Value specifies the number of iterations from the dynamic optimization,

433 which will be debugged, creating .csv and .py files.

434

435 optimizerNP : Literal[1, 3], optional

436 Value specifies the number of points in a subinterval. Currently supports numbers 1 and 3.

437

438 optimizerTimeGrid : str, optional

439 Specifies external file with time points.

440

441 output : list[str], optional

442 Output the variables a, b and c at the end of the simulation to the standard output:

443 time = value, a = value, b = value, c = value

444

445 outputPath : str, optional

446 Specifies a path for writing the output files i.e., model_res.mat, model_prof.intdata, model_prof.realdata etc.

447

448 override : list[str], optional

449 Override the variables or the simulation settings in the XML setup file For example:

450 var1=start1,var2=start2,par3=start3,startTime=val1,stopTime=val2

451

452 overrideFile : str, optional

453 Will override the variables or the simulation settings in the XML setup file with the values from the file.

454 Note that: overrideFile CANNOT be used with override. Use when variables for -override are too many. overrideFileName contains lines of the form: var1=start1

455

456 port : int, optional

457 Specifies the port for simulation status (default disabled).

458

459 r : str, optional

460 Specifies the name of the output result file. The default file-name is based on the model name and output format. For example: Model_res.mat.

461

462 reconcile : bool, optional

463 Run the Data Reconciliation numerical computation algorithm for constrained equations

464

465 reconcileBoundaryConditions : bool, optional

466 Run the Data Reconciliation numerical computation algorithm for boundary condition equations

467

468 reconcileState : bool, optional

469 Run the State Estimation numerical computation algorithm for constrained equations

470

471 gbm : Literal[

472 "adams",

473 "expl_euler",

474 "impl_euler",

475 "trapezoid",

476 "sdirk2",

477 "sdirk3",

478 "esdirk2",

479 "esdirk3",

480 "esdirk4",

481 "radauIA2",

482 "radauIA3",

483 "radauIA4",

484 "radauIIA2",

485 "radauIIA3",

486 "radauIIA4",

487 "lobattoIIIA3",

488 "lobattoIIIA4",

489 "lobattoIIIB3",

490 "lobattoIIIB4",

491 "lobattoIIIC3",

492 "lobattoIIIC4",

493 "gauss2",

494 "gauss3",

495 "gauss4",

496 "gauss5",

497 "gauss6",

498 "merson",

499 "mersonSsc1",

500 "mersonSsc2",

501 "heun",

502 "fehlberg12",

503 "fehlberg45",

504 "fehlberg78",

505 "fehlbergSsc1",

506 "fehlbergSsc2",

507 "rk810",

508 "rk1012",

509 "rk1214",

510 "dopri45",

511 "dopriSsc1",

512 "dopriSsc2",

513 "tsit5",

514 "rungekutta",

515 "rungekuttaSsc"

516 ], optional

517 Specifies the chosen solver of solver gbode (single-rate, slow states integrator).

518

519 adams (Implicit multistep method of type Adams-Moulton (order 2))

520

521 expl_euler (Explizit Runge-Kutta Euler method (order 1))

522

523 impl_euler (Implizit Runge-Kutta Euler method (order 1))

524

525 trapezoid (Implicit Runge-Kutta trapezoid method (order 2))

526

527 sdirk2 (Singly-diagonal implicit Runge-Kutta (order 2))

528

529 sdirk3 (Singly-diagonal implicit Runge-Kutta (order 3))

530

531 esdirk2 (Explicit singly-diagonal implicit Runge-Kutta (order 2))

532

533 esdirk3 (Explicit singly-diagonal implicit Runge-Kutta (order 3))

534

535 esdirk4 (Explicit singly-diagonal implicit Runge-Kutta (order 4))

536

537 radauIA2 (Implicit Runge-Kutta method of Radau family IA (order 3))

538

539 radauIA3 (Implicit Runge-Kutta method of Radau family IA (order 5))

540

541 radauIA4 (Implicit Runge-Kutta method of Radau family IA (order 7))

542

543 radauIIA2 (Implicit Runge-Kutta method of Radau family IIA (order 3))

544

545 radauIIA3 (Implicit Runge-Kutta method of Radau family IIA (order 5))

546

547 radauIIA4 (Implicit Runge-Kutta method of Radau family IIA (order 7))

548

549 lobattoIIIA3 (Implicit Runge-Kutta method of Lobatto family IIIA (order 4))

550

551 lobattoIIIA4 (Implicit Runge-Kutta method of Lobatto family IIIA (order 6))

552

553 lobattoIIIB3 (Implicit Runge-Kutta method of Lobatto family IIIB (order 4))

554

555 lobattoIIIB4 (Implicit Runge-Kutta method of Lobatto family IIIB (order 6))

556

557 lobattoIIIC3 (Implicit Runge-Kutta method of Lobatto family IIIC (order 4))

558

559 lobattoIIIC4 (Implicit Runge-Kutta method of Lobatto family IIIC (order 6))

560

561 gauss2 (Implicit Runge-Kutta method of Gauss (order 4))

562

563 gauss3 (Implicit Runge-Kutta method of Gauss (order 6))

564

565 gauss4 (Implicit Runge-Kutta method of Gauss (order 8))

566

567 gauss5 (Implicit Runge-Kutta method of Gauss (order 10))

568

569 gauss6 (Implicit Runge-Kutta method of Gauss (order 12))

570

571 merson (Explicit Runge-Kutta Merson method (order 4))

572

573 mersonSsc1 (Explicit Runge-Kutta Merson method with large stability region (order 1))

574

575 mersonSsc2 (Explicit Runge-Kutta Merson method with large stability region (order 2))

576

577 heun (Explicit Runge-Kutta Heun method (order 2))

578

579 fehlberg12 (Explicit Runge-Kutta Fehlberg method (order 2))

580

581 fehlberg45 (Explicit Runge-Kutta Fehlberg method (order 5))

582

583 fehlberg78 (Explicit Runge-Kutta Fehlberg method (order 8))

584

585 fehlbergSsc1 (Explicit Runge-Kutta Fehlberg method with large stability region (order 1))

586

587 fehlbergSsc2 (Explicit Runge-Kutta Fehlberg method with large stability region (order 2))

588

589 rk810 (Explicit 8-10 Runge-Kutta method (order 10))

590

591 rk1012 (Explicit 10-12 Runge-Kutta method (order 12))

592

593 rk1214 (Explicit 12-14 Runge-Kutta method (order 14))

594

595 dopri45 (Explicit Runge-Kutta method Dormand-Prince (order 5))

596

597 dopriSsc1 (Explicit Runge-Kutta method Dormand-Prince with large stability region (order 1))

598

599 dopriSsc2 (Explicit Runge-Kutta method Dormand-Prince with large stability region (order 2))

600

601 tsit5 (Explicit Runge-Kutta method from Tsitouras (order 5))

602

603 rungekutta (Explicit classical Runge-Kutta method (order 4))

604

605 rungekuttaSsc (Explicit Runge-Kutta method with large stabiliy region (order 1))

606

607 gbctrl : Literal["i", "pi", "pid", "const"], optional

608 Step size control of solver gbode (single-rate, slow states integrator).

609

610 i (I controller for step size)

611

612 pi (PI controller for step size)

613

614 pid (PID controller for step size)

615

616 const (Constant step size)

617

618 gberr : Literal["default", "richardson", "embedded"], optional

619 Error estimation method for solver gbode (single-rate, slow states integrator) Possible values:

620

621 default - depending on the Runge-Kutta method

622

623 richardson - Richardson extrapolation

624

625 embedded - Embedded scheme

626

627 gbint : Literal["linear", "hermite", "hermite_a", "hermite_b", "hermite_errctrl", "dense_output", "dense_output_errctrl"], optional

628 Interpolation method of solver gbode (single-rate, slow states integrator).

629

630 linear (Linear interpolation (1st order))

631

632 hermite (Hermite interpolation (3rd order))

633

634 hermite_a (Hermite interpolation (only for left hand side))

635

636 hermite_b (Hermite interpolation (only for right hand side))

637

638 hermite_errctrl (Hermite interpolation with error control)

639

640 dense_output (use dense output formula for interpolation)

641

642 dense_output_errctrl (use dense output fomular with error control)

643

644 gbfm : Literal[

645 "adams",

646 "expl_euler",

647 "impl_euler",

648 "trapezoid",

649 "sdirk2",

650 "sdirk3",

651 "esdirk2",

652 "esdirk3",

653 "esdirk4",

654 "radauIA2",

655 "radauIA3",

656 "radauIA4",

657 "radauIIA2",

658 "radaulIIA3",

659 "radaulIIA4",

660 "lobattoIIIA3",

661 "lobattoIIIA4",

662 "lobattoIIIB3",

663 "lobattoIIIB4",

664 "lobattoIIIC3",

665 "lobattoIIIC4",

666 "gauss2",

667 "gauss3",

668 "gauss4",

669 "gauss5",

670 "gauss6",

671 "merson",

672 "mersonSsc1",

673 "mersonSsc2",

674 "heun",

675 "fehlberg12",

676 "fehlberg45",

677 "fehlberg78",

678 "fehlbergSsc1",

679 "fehlbergSsc2",

680 "rk810",

681 "rk1012",

682 "dopri45",

683 "dopriSsc1",

684 "dopriSsc2",

685 "tsit5",

686 "rungekutta",

687 "rungekuttaSsc",

688 ], optional

689 Specifies the chosen solver of solver gbode (multi-rate, fast states integrator). Current Restriction: Fully implicit (Gauss, Radau, Lobatto) RK methods are not supported, yet.

690

691 adams (Implicit multistep method of type Adams-Moulton (order 2))

692

693 expl_euler (Explizit Runge-Kutta Euler method (order 1))

694

695 impl_euler (Implizit Runge-Kutta Euler method (order 1))

696

697 trapezoid (Implicit Runge-Kutta trapezoid method (order 2))

698

699 sdirk2 (Singly-diagonal implicit Runge-Kutta (order 2))

700

701 sdirk3 (Singly-diagonal implicit Runge-Kutta (order 3))

702

703 esdirk2 (Explicit singly-diagonal implicit Runge-Kutta (order 2))

704

705 esdirk3 (Explicit singly-diagonal implicit Runge-Kutta (order 3))

706

707 esdirk4 (Explicit singly-diagonal implicit Runge-Kutta (order 4))

708

709 radauIA2 (Implicit Runge-Kutta method of Radau family IA (order 3))

710

711 radauIA3 (Implicit Runge-Kutta method of Radau family IA (order 5))

712

713 radauIA4 (Implicit Runge-Kutta method of Radau family IA (order 7))

714

715 radauIIA2 (Implicit Runge-Kutta method of Radau family IIA (order 3))

716

717 radauIIA3 (Implicit Runge-Kutta method of Radau family IIA (order 5))

718

719 radauIIA4 (Implicit Runge-Kutta method of Radau family IIA (order 7))

720

721 lobattoIIIA3 (Implicit Runge-Kutta method of Lobatto family IIIA (order 4))

722

723 lobattoIIIA4 (Implicit Runge-Kutta method of Lobatto family IIIA (order 6))

724

725 lobattoIIIB3 (Implicit Runge-Kutta method of Lobatto family IIIB (order 4))

726

727 lobattoIIIB4 (Implicit Runge-Kutta method of Lobatto family IIIB (order 6))

728

729 lobattoIIIC3 (Implicit Runge-Kutta method of Lobatto family IIIC (order 4))

730

731 lobattoIIIC4 (Implicit Runge-Kutta method of Lobatto family IIIC (order 6))

732

733 gauss2 (Implicit Runge-Kutta method of Gauss (order 4))

734

735 gauss3 (Implicit Runge-Kutta method of Gauss (order 6))

736

737 gauss4 (Implicit Runge-Kutta method of Gauss (order 8))

738

739 gauss5 (Implicit Runge-Kutta method of Gauss (order 10))

740

741 gauss6 (Implicit Runge-Kutta method of Gauss (order 12))

742

743 merson (Explicit Runge-Kutta Merson method (order 4))

744

745 mersonSsc1 (Explicit Runge-Kutta Merson method with large stability region (order 1))

746

747 mersonSsc2 (Explicit Runge-Kutta Merson method with large stability region (order 2))

748

749 heun (Explicit Runge-Kutta Heun method (order 2))

750

751 fehlberg12 (Explicit Runge-Kutta Fehlberg method (order 2))

752

753 fehlberg45 (Explicit Runge-Kutta Fehlberg method (order 5))

754

755 fehlberg78 (Explicit Runge-Kutta Fehlberg method (order 8))

756

757 fehlbergSsc1 (Explicit Runge-Kutta Fehlberg method with large stability region (order 1))

758

759 fehlbergSsc2 (Explicit Runge-Kutta Fehlberg method with large stability region (order 2))

760

761 rk810 (Explicit 8-10 Runge-Kutta method (order 10))

762

763 rk1012 (Explicit 10-12 Runge-Kutta method (order 12))

764

765 rk1214 (Explicit 12-14 Runge-Kutta method (order 14))

766

767 dopri45 (Explicit Runge-Kutta method Dormand-Prince (order 5))

768

769 dopriSsc1 (Explicit Runge-Kutta method Dormand-Prince with large stability region (order 1))

770

771 dopriSsc2 (Explicit Runge-Kutta method Dormand-Prince with large stability region (order 2))

772

773 tsit5 (Explicit Runge-Kutta method from Tsitouras (order 5))

774

775 rungekutta (Explicit classical Runge-Kutta method (order 4))

776

777 rungekuttaSsc (Explicit Runge-Kutta method with large stabiliy region (order 1))

778

779 gbfctrl : Literal["i", "pi", "pid", "const"], optional

780 Step size control of solver gbode (multi-rate, fast states integrator).

781

782 i (I controller for step size)

783

784 pi (PI controller for step size)

785

786 pid (PID controller for step size)

787

788 const (Constant step size)

789

790 gbferr : Literal["default", "richardson", "embedded"], optional

791 Error estimation method for solver gbode (multi-rate, fast states integrator) Possible values:

792

793 default - depending on the Runge-Kutta method

794

795 richardson - Richardson extrapolation

796

797 embedded - Embedded scheme

798

799 gbfint : Literal["linear", "hermite", "hermite_a", "hermite_b", "hermite_errctrl", "dense_output", "dense_output_errctrl"], optional

800 Interpolation method of solver gbode (multi-rate, fast states integrator).

801

802 linear (Linear interpolation (1st order))

803

804 hermite (Hermite interpolation (3rd order))

805

806 hermite_a (Hermite interpolation (only for left hand side))

807

808 hermite_b (Hermite interpolation (only for right hand side))

809

810 hermite_errctrl (Hermite interpolation with error control)

811

812 dense_output (use dense output formula for interpolation)

813

814 dense_output_errctrl (use dense output fomular with error control)

815

816 gbfnls : Literal["newton", "kinsol"], optional

817 Non-linear solver method of solver gbode (multi-rate, fast states integrator).

818

819 newton (Newton method, dense)

820

821 kinsol (SUNDIALS KINSOL: Inexact Newton, sparse)

822

823 gbratio : float, optional

824 Define percentage of states for the fast states selection of solver gbode (values from 0 to 1).

825

826 rt : float, optional

827 Value specifies the scaling factor for real-time synchronization (0 disables).

828 A value > 1 means the simulation takes a longer time to simulate.

829

830 s : Literal[

831 "euler",

832 "heun",

833 "rungekutta",

834 "impeuler",

835 "trapezoid",

836 "imprungekutta",

837 "gbode",

838 "irksco",

839 "dassl",

840 "ida",

841 "cvode",

842 "rungekuttaSsc",

843 "symSolver",

844 "symSolverSsc",

845 "qss",

846 "optimization"

847 ], optional

848 Specifies the integration method. For additional information see the User's Guide

849

850 euler - Euler - explicit, fixed step size, order 1

851

852 heun - Heun's method - explicit, fixed step, order 2

853

854 rungekutta - classical Runge-Kutta - explicit, fixed step, order 4

855

856 impeuler - Euler - implicit, fixed step size, order 1

857

858 trapezoid - trapezoidal rule - implicit, fixed step size, order 2

859

860 imprungekutta - Runge-Kutta methods based on Radau and Lobatto IIA - implicit, fixed step size, order 1-6(selected manually by flag -impRKOrder)

861

862 gbode - generic bi-rate ODE solver - implicit, explicit, step size control, arbitrary order

863

864 irksco - own developed Runge-Kutta solver - implicit, step size control, order 1-2

865

866 dassl - default solver - BDF method - implicit, step size control, order 1-5

867

868 ida - SUNDIALS IDA solver - BDF method with sparse linear solver - implicit, step size control, order 1-5

869

870 cvode - experimental implementation of SUNDIALS CVODE solver - BDF or Adams-Moulton method - step size control, order 1-12

871

872 rungekuttaSsc - Runge-Kutta based on Novikov (2016) - explicit, step size control, order 4-5 [experimental]

873

874 symSolver - symbolic inline Solver [compiler flag +symSolver needed] - fixed step size, order 1

875

876 symSolverSsc - symbolic implicit Euler with step size control [compiler flag +symSolver needed] - step size control, order 1

877

878 qss - A QSS solver [experimental]

879

880 optimization - Special solver for dynamic optimization

881

882 single : bool, optional

883 Output results in single precision (mat-format only).

884

885 steps : bool, optional

886 Dumps the number of integration steps into the result file.

887

888 steadyState : bool, optional

889 Aborts the simulation if steady state is reached.

890

891 steadyStateTol : float, optional

892 This relative tolerance is used to detect steady state: max(|d(x_i)/dt|/nominal(x_i)) < steadyStateTol

893

894 sx : str, optional

895 Value specifies an csv-file with inputs as covariance matrix Sx for DataReconciliation

896

897 keepHessian : bool, optional

898 Value specifies the number of steps, which keep Hessian matrix constant.

899

900 w : bool, optional

901 Shows all warnings even if a related log-stream is inactive.

902

903 parmodNumThreads : int, optional

904 Value specifies the number of threads for simulation using parmodauto. If not specified (or is 0) it will use the systems max number of threads.

905 Note that this option is ignored if the model is not compiled with --parmodauto

906

907 Logging Setup

908 -------------

909

910 LOG_STDOUT: bool, optional

911 this stream is active by default

912

913 LOG_ASSERT: bool, optional

914 this stream is active by default

915

916 LOG_DASSL: bool, optional

917 additional information about dassl solver

918

919 LOG_DASSL_STATES: bool, optional

920 outputs the states at every dassl call)

921

922 LOG_DEBUG: bool, optional

923 additional debug information

924

925 LOG_DELAY: bool, optional

926 debug information for delay operator

927

928 LOG_DIVISION: bool, optional

929 Log division by zero

930

931 LOG_DSS: bool, optional

932 outputs information about dynamic state selection

933

934 LOG_DSS_JAC: bool, optional

935 outputs jacobian of the dynamic state selection

936

937 LOG_DT: bool, optional

938 additional information about dynamic tearing

939

940 LOG_DT_CONS: bool, optional

941 additional information about dynamic tearing (local and global constraints)

942

943 LOG_EVENTS: bool, optional

944 additional information during event iteration

945

946 LOG_EVENTS_V: bool, optional

947 verbose logging of event system

948

949 LOG_GBODE: bool, optional

950 information about GBODE solver

951

952 LOG_GBODE_V: bool, optional

953 verbose information about GBODE solve

954

955 LOG_GBODE_NLS: bool, optional

956 log non-linear solver process of GBODE solver

957

958 LOG_GBODE_NLS_V: bool, optional

959 verbose log non-linear solver process of GBODE solver

960

961 LOG_GBODE_STATES: bool, optional

962 output states at every GBODE call

963

964 LOG_INIT: bool, optional

965 additional information during initialization

966

967 LOG_INIT_HOMOTOPY: bool, optional

968 log homotopy initialization

969

970 LOG_INIT_V: bool, optional

971 verbose information during initialization

972

973 LOG_IPOPT: bool, optional

974 information from Ipopt

975

976 LOG_IPOPT_FULL: bool, optional

977 more information from Ipopt

978

979 LOG_IPOPT_JAC: bool, optional

980 check jacobian matrix with Ipopt

981

982 LOG_IPOPT_HESSE: bool, optional

983 check hessian matrix with Ipopt

984

985 LOG_IPOPT_ERROR: bool, optional

986 print max error in the optimization

987

988 LOG_JAC: bool, optional

989 outputs the jacobian matrix used by ODE solvers

990

991 LOG_LS: bool, optional

992 logging for linear systems

993

994 LOG_LS_V: bool, optional

995 verbose logging of linear systems

996

997 LOG_MIXED: bool, optional

998 logging for mixed systems

999

1000 LOG_NLS: bool, optional

1001 logging for nonlinear systems

1002

1003 LOG_NLS_V: bool, optional

1004 verbose logging of nonlinear systems

1005

1006 LOG_NLS_HOMOTOPY: bool, optional

1007 logging of homotopy solver for nonlinear systems

1008

1009 LOG_NLS_JAC: bool, optional

1010 outputs the jacobian of nonlinear systems

1011

1012 LOG_NLS_JAC_TEST: bool, optional

1013 tests the analytical jacobian of nonlinear systems

1014

1015 LOG_NLS_NEWTON_DIAG: bool, optional

1016 Log Newton diagnostic

1017

1018 LOG_NLS_RES: bool, optional

1019 outputs every evaluation of the residual function

1020

1021 LOG_NLS_EXTRAPOLATE: bool, optional

1022 outputs debug information about extrapolate process

1023

1024 LOG_RES_INIT: bool, optional

1025 outputs residuals of the initialization

1026

1027 LOG_RT: bool, optional

1028 additional information regarding real-time processes

1029

1030 LOG_SIMULATION: bool, optional

1031 additional information about simulation process

1032

1033 LOG_SOLVER: bool, optional

1034 additional information about solver process

1035

1036 LOG_SOLVER_V: bool, optional

1037 verbose information about the integration process

1038

1039 LOG_SOLVER_CONTEXT: bool, optional

1040 context information during the solver process

1041

1042 LOG_SOTI: bool, optional

1043 final solution of the initialization

1044

1045 LOG_SPATIALDISTR: bool, optional

1046 logging of internal operations for spatialDistribution

1047

1048 LOG_STATS: bool, optional

1049 additional statistics about timer/events/solver

1050

1051 LOG_STATS_V: bool, optional

1052 additional statistics for LOG_STATS

1053

1054 LOG_SUCCESS: bool, optional

1055 this stream is active by default

1056

1057 LOG_SYNCHRONOUS: bool, optional

1058 log clocks and sub-clocks for synchronous features

1059

1060 LOG_ZEROCROSSINGS: bool, optional

1061 additional information about the zerocrossings

1062 """

1063

1064 abortSlowSimulation: bool = False

1065 alarm: pydantic.NonNegativeInt = 0

1066 clock: typing.Literal["RT", "CYC", "CPU"] | None = None

1067 cpu: bool = False

1068 csvOstep: pydantic.FilePath | None = None

1069 cvodeNonlinearSolverIteration: (

1070 typing.Literal["CV_ITER_NEWTON", "CV_ITER_FIXED_POINT"] | None

1071 ) = None

1072 cvodeLinearMultistepMethod: typing.Literal["CV_BDF", "CV_ADAMS"] | None = None

1073 cx: pydantic.FilePath | None = None

1074 daeMode: bool | None = None

1075 deltaXLinearize: pydantic.NonNegativeFloat | None = None

1076 deltaXSolver: pydantic.NonNegativeFloat | None = None

1077 embeddedServer: typing.Literal["opc-da", "opc-ua"] | pydantic.FilePath | None = None

1078 embeddedServerPort: int | None = None

1079 mat_sync: pydantic.PositiveInt | None = None

1080 emit_protected: bool | None = None

1081 eps: pydantic.PositiveInt | None = None

1082 f: pydantic.FilePath | None = None

1083 homAdaptBend: pydantic.PositiveFloat | None = None

1084 homBacktraceStrategy: typing.Literal["fix", "orthogonal"] | None = None

1085 homHEps: pydantic.PositiveFloat | None = None

1086 homMaxLambdaSteps: pydantic.PositiveInt | None = None

1087 homMaxNewtonSteps: pydantic.PositiveInt | None = None

1088 homMaxTries: pydantic.PositiveInt | None = None

1089 homNegStartDir: bool | None = None

1090 noHomotopyOnFirstTry: bool | None = None

1091 homTauDecFac: pydantic.PositiveFloat | None = None

1092 homTauDecFacPredictor: pydantic.PositiveFloat | None = None

1093 homTauIncFac: pydantic.PositiveFloat | None = None

1094 homTauIncThreshold: pydantic.PositiveFloat | None = None

1095 homTauMax: pydantic.PositiveFloat | None = None

1096 homTauMin: pydantic.PositiveFloat | None = None

1097 homTauStart: pydantic.PositiveFloat | None = None

1098 ils: pydantic.PositiveInt | None = None

1099 idaMaxErrorTestFails: pydantic.PositiveInt | None = None

1100 idaMaxNonLinIters: pydantic.PositiveInt | None = None

1101 idaMaxConvFails: pydantic.PositiveInt | None = None

1102 idaNonLinConvCoef: pydantic.PositiveFloat | None = None

1103 idaLS: typing.Literal["dense", "klu", "spgmr", "spbcg", "sptqmr"] | None = None

1104 idaScaling: bool | None = None

1105 idaSensitivity: bool | None = None

1106 ignoreHideResult: bool | None = None

1107 iif: pydantic.FilePath | None = None

1108 iim: typing.Literal["none", "symbolic"] | None = None

1109 iit: pydantic.NonNegativeFloat | None = None

1110 impRKOrder: pydantic.confloat(ge=1, le=6) | None = None

1111 impRKLS: typing.Literal["iterativ", "dense"] | None = None

1112 initialStepSize: pydantic.PositiveFloat | None = None

1113 csvInput: pydantic.FilePath | None = None

1114 stateFile: pydantic.FilePath | None = None

1115 ipopt_hesse: str | None = None # TODO: Unknown type

1116 ipopt_init: str | None = None # TODO: Unknown type

1117 ipopt_jac: str | None = None # TODO: Unknown type

1118 ipopt_max_iter: pydantic.PositiveInt | None = None

1119 ipopt_warm_start: pydantic.PositiveInt | None = None

1120 jacobian: (

1121 typing.Literal[

1122 "coloredNumerical",

1123 "internalNumerical",

1124 "coloredSymbolical",

1125 "numerical",

1126 "symbolical",

1127 ]

1128 | None

1129 ) = None

1130 jacobianThreads: pydantic.PositiveInt | None = None

1131 l: pydantic.NonNegativeFloat | None = None

1132 l_data_rec: bool | None = None

1133 logFormat: typing.Literal["text", "xml", "xmltcp"] | None = None

1134 ls: (

1135 typing.Literal["lapack", "lis", "klu", "umfpack", "totalpivot", "default"]

1136 | None

1137 ) = None

1138 ls_ipopt: str | None = None

1139 lss: typing.Literal["default", "lis", "klu", "umfpack"] | None = None

1140 lssMaxDensity: pydantic.PositiveFloat | None = None

1141 lssMinSize: pydantic.PositiveInt | None = None

1142 lvMaxWarn: pydantic.PositiveInt | None = None

1143 lv_time: (

1144 pydantic.conlist(max_length=2, min_length=2, item_type=pydantic.PositiveFloat)

1145 | None

1146 ) = None

1147 lv_system: tuple[pydantic.NonNegativeInt] | None = None

1148 mbi: pydantic.PositiveInt | None = None

1149 mei: pydantic.PositiveInt | None = None

1150 maxIntegrationOrder: pydantic.PositiveInt | None = None

1151 maxStepSize: pydantic.PositiveFloat | None = None

1152 measureTimePlotFormat: typing.Literal["svg", "jpg", "ps", "gif"] | None = None

1153 newtonDiagnostics: bool | None = None

1154 newtonFTol: pydantic.PositiveFloat | None = None

1155 newtonMaxStepFactor: float | None = None

1156 newtonXTol: pydantic.PositiveFloat | None = None

1157 newton: typing.Literal["damped", "damped2", "damped_ls", "damped_bt"] | None = None

1158 nls: (

1159 typing.Literal["hybrid", "kinsol", "kinsol", "newton", "mixed", "homotopy"]

1160 | None

1161 ) = None

1162 nlsInfo: bool | None = None

1163 nlsLS: typing.Literal["default", "totalpivot", "lapack", "klu"] | None = None

1164 nlssMaxDensity: pydantic.PositiveFloat | None = None

1165 nlssMinSize: pydantic.PositiveInt | None = None

1166 noemit: bool | None = None

1167 noEquidistantTimeGrid: bool | None = None

1168 noEquidistantOutputFrequency: pydantic.PositiveInt | None = None

1169 noEquidistantOutputTime: pydantic.PositiveFloat | None = None

1170 noEventEmit: bool | None = None

1171 noRestart: bool | None = None

1172 noRootFinding: bool | None = None

1173 noScaling: bool | None = None

1174 noSuppressAlg: bool | None = None

1175 optDebugJac: pydantic.PositiveInt | None = None

1176 optimizerNP: typing.Literal[1, 3] | None = None

1177 optimizerTimeGrid: pydantic.FilePath | None = None

1178 output: list[str] | None = None

1179 outputPath: pydantic.DirectoryPath | None = None

1180 override: list[str] | None = None

1181 overrideFile: pydantic.FilePath | None = None

1182 port: pydantic.PositiveInt | None = None

1183 r: str | None = None

1184 reconcile: bool | None = None

1185 reconcileBoundaryConditions: bool | None = None

1186 reconcileState: bool | None = None

1187 gbm: (

1188 typing.Literal[

1189 "adams",

1190 "expl_euler",

1191 "impl_euler",

1192 "trapezoid",

1193 "sdirk2",

1194 "sdirk3",

1195 "esdirk2",

1196 "esdirk3",

1197 "esdirk4",

1198 "radauIA2",

1199 "radauIA3",

1200 "radauIA4",

1201 "radauIIA2",

1202 "radauIIA3",

1203 "radauIIA4",

1204 "lobattoIIIA3",

1205 "lobattoIIIA4",

1206 "lobattoIIIB3",

1207 "lobattoIIIB4",

1208 "lobattoIIIC3",

1209 "lobattoIIIC4",

1210 "gauss2",

1211 "gauss3",

1212 "gauss4",

1213 "gauss5",

1214 "gauss6",

1215 "merson",

1216 "mersonSsc1",

1217 "mersonSsc2",

1218 "heun",

1219 "fehlberg12",

1220 "fehlberg45",

1221 "fehlberg78",

1222 "fehlbergSsc1",

1223 "fehlbergSsc2",

1224 "rk810",

1225 "rk1012",

1226 "rk1214",

1227 "dopri45",

1228 "dopriSsc1",

1229 "dopriSsc2",

1230 "tsit5",

1231 "rungekutta",

1232 "rungekuttaSsc",

1233 ]

1234 | None

1235 ) = None

1236 gbctrl: typing.Literal["i", "pi", "pid", "const"] | None = None

1237 gberr: typing.Literal["default", "richardson", "embedded"] | None = None

1238 gbint: (

1239 typing.Literal[

1240 "linear",

1241 "hermite",

1242 "hermite_a",

1243 "hermite_b",

1244 "hermite_errctrl",

1245 "dense_output",

1246 "dense_output_errctrl",

1247 ]

1248 | None

1249 ) = None

1250 gbnls: typing.Literal["newton", "kinsol"] | None = None

1251 gbfm: (

1252 typing.Literal[

1253 "adams",

1254 "expl_euler",

1255 "impl_euler",

1256 "trapezoid",

1257 "sdirk2",

1258 "sdirk3",

1259 "esdirk2",

1260 "esdirk3",

1261 "esdirk4",

1262 "radauIA2",

1263 "radauIA3",

1264 "radauIA4",

1265 "radauIIA2",

1266 "radaulIIA3",

1267 "radaulIIA4",

1268 "lobattoIIIA3",

1269 "lobattoIIIA4",

1270 "lobattoIIIB3",

1271 "lobattoIIIB4",

1272 "lobattoIIIC3",

1273 "lobattoIIIC4",

1274 "gauss2",

1275 "gauss3",

1276 "gauss4",

1277 "gauss5",

1278 "gauss6",

1279 "merson",

1280 "mersonSsc1",

1281 "mersonSsc2",

1282 "heun",

1283 "fehlberg12",

1284 "fehlberg45",

1285 "fehlberg78",

1286 "fehlbergSsc1",

1287 "fehlbergSsc2",

1288 "rk810",

1289 "rk1012",

1290 "dopri45",

1291 "dopriSsc1",

1292 "dopriSsc2",

1293 "tsit5",

1294 "rungekutta",

1295 "rungekuttaSsc",

1296 ]

1297 | None

1298 ) = None

1299 gbfctrl: typing.Literal["i", "pi", "pid", "const"] | None = None

1300 gbferr: typing.Literal["default", "richardson", "embedded"] | None = None

1301 gbfint: (

1302 typing.Literal[

1303 "linear",

1304 "hermite",

1305 "hermite_a",

1306 "hermite_b",

1307 "hermite_errctrl",

1308 "dense_output",

1309 "dense_output_errctrl",

1310 ]

1311 | None

1312 ) = None

1313 gbfnls: typing.Literal["newton", "kinsol"] | None = None

1314 s: (

1315 typing.Literal[

1316 "euler",

1317 "heun",

1318 "rungekutta",

1319 "impeuler",

1320 "trapezoid",

1321 "imprungekutta",

1322 "gbode",

1323 "irksco",

1324 "dassl",

1325 "ida",

1326 "cvode",

1327 "rungekuttaSsc",

1328 "symSolver",

1329 "symSolverSsc",

1330 "qss",

1331 "optimization",

1332 ]

1333 | None

1334 ) = None

1335 single: bool | None = None

1336 steps: bool | None = None

1337 steadyState: bool | None = None

1338 steadyStateTol: pydantic.PositiveFloat | None = None

1339 sx: pydantic.FilePath | None = None

1340 keepHessian: pydantic.PositiveInt | None = None

1341 w: bool | None = None

1342 parmodNumThreads: pydantic.PositiveInt | None = None

1343 LOG_STDOUT: bool | None = None

1344 LOG_ASSERT: bool | None = None

1345 LOG_DASSL: bool | None = None

1346 LOG_DASSL_STATES: bool | None = None

1347 LOG_DEBUG: bool | None = None

1348 LOG_DELAY: bool | None = None

1349 LOG_DIVISION: bool | None = None

1350 LOG_DSS: bool | None = None

1351 LOG_DSS_JAC: bool | None = None

1352 LOG_DT: bool | None = None

1353 LOG_DT_CONS: bool | None = None

1354 LOG_EVENTS: bool | None = None

1355 LOG_EVENTS_V: bool | None = None

1356 LOG_GBODE: bool | None = None

1357 LOG_GBODE_V: bool | None = None

1358 LOG_GBODE_NLS: bool | None = None

1359 LOG_GBODE_NLS_V: bool | None = None

1360 LOG_GBODE_STATES: bool | None = None

1361 LOG_INIT: bool | None = None

1362 LOG_INIT_HOMOTOPY: bool | None = None

1363 LOG_INIT_V: bool | None = None

1364 LOG_IPOPT: bool | None = None

1365 LOG_IPOPT_FULL: bool | None = None

1366 LOG_IPOPT_JAC: bool | None = None

1367 LOG_IPOPT_HESSE: bool | None = None

1368 LOG_IPOPT_ERROR: bool | None = None

1369 LOG_JAC: bool | None = None

1370 LOG_LS: bool | None = None

1371 LOG_LS_V: bool | None = None

1372 LOG_MIXED: bool | None = None

1373 LOG_NLS: bool | None = None

1374 LOG_NLS_V: bool | None = None

1375 LOG_NLS_HOMOTOPY: bool | None = None

1376 LOG_NLS_JAC: bool | None = None

1377 LOG_NLS_JAC_TEST: bool | None = None

1378 LOG_NLS_NEWTON_DIAG: bool | None = None

1379 LOG_NLS_RES: bool | None = None

1380 LOG_NLS_EXTRAPOLATE: bool | None = None

1381 LOG_RES_INIT: bool | None = None

1382 LOG_RT: bool | None = None

1383 LOG_SIMULATION: bool | None = None

1384 LOG_SOLVER: bool | None = None

1385 LOG_SOLVER_V: bool | None = None

1386 LOG_SOLVER_CONTEXT: bool | None = None

1387 LOG_SOTI: bool | None = None

1388 LOG_SPATIALDISTR: bool | None = None

1389 LOG_STATS: bool | None = None

1390 LOG_STATS_V: bool | None = None

1391 LOG_SUCCESS: bool | None = None

1392 LOG_SYNCHRONOUS: bool | None = None

1393 LOG_ZEROCROSSINGS: bool | None = None

1394 max_warn: int | None = None

1395

1396 @pydantic.model_validator(mode="before")

1397 @classmethod

1398 def check_embedded_server_port(

1399 cls, values: dict[str, typing.Any] | None

1400 ) -> dict[str, typing.Any] | None:

1401 if (

1402 isinstance(values, dict)

1403 and values.get("embedded_server_port")

1404 and not values.get("embedded_server")

1405 ):

1406 raise AssertionError(

1407 "Cannot specify embedded server port without specifying value for 'embedded_server'"

1408 )

1409 return values

1410

1411 @pydantic.model_validator(mode="before")

1412 @classmethod

1413 def check_homotopy_steps_and_symbolic(

1414 cls, values: dict[str, typing.Any] | None

1415 ) -> dict[str, typing.Any] | None:

1416 if (

1417 values

1418 and values.get("homotopy_n_steps") is not None

1419 and (_init_method := values.get("initialisation_method")) is not None

1420 and _init_method != "symbolic"

1421 ):

1422 raise AssertionError(

1423 f"Cannot specify 'homotopy_n_steps' with initialisation_method={_init_method}"

1424 )

1425 return values

1426

1427 @pydantic.model_validator(mode="before")

1428 @classmethod

1429 def check_override_override_file(

1430 cls, values: dict[str, typing.Any] | None

1431 ) -> dict[str, typing.Any] | None:

1432 if values and values.get("override") is not None and values.get("overrideFile"):

1433 raise AssertionError("Cannot specify both 'override' and 'overrideFile'")

1434 return values

1435

1436 def assemble_args(self) -> list[str]:

1437 _args_list: list[str] = []

1438 _log_levels_list: list[str] = []

1439 for arg_name, arg in self.model_dump().items():

1440 if not arg:

1441 continue

1442 if arg_name.startswith("LOG_"):

1443 _log_levels_list.append(f"{'-' if not arg else ''}{arg_name}")

1444 elif isinstance(arg, bool):

1445 _args_list.append(f"-{arg_name}")

1446 elif isinstance(arg, (list, tuple)):

1447 _args_list.append(f"-{arg_name}=" + ",".join(*arg))

1448 else:

1449 _args_list.append(f"-{arg_name}={arg}")

1450

1451 if _log_levels_list:

1452 _args_list.append(f"-lv={','.join(_log_levels_list)}")

1453

1454 return _args_list

1455

1456 @property

1457 def inputPath(self) -> None:

1458 raise AssertionError(

1459 "Cannot access argument 'inputPath', this is used internally by Pydelica "

1460 "to setup simulations"

1461 )

1462

1463 @inputPath.setter

1464 def inputPath(self, _) -> None:

1465 raise AssertionError(

1466 "Cannot set argument 'inputPath', this is used internally by Pydelica "

1467 "to setup simulations"

1468 )