Skip to content

Commit c5cd7b7

Browse files
GBODE documentation corrected (#9420)
1 parent 3032883 commit c5cd7b7

File tree

5 files changed

+109
-82
lines changed

5 files changed

+109
-82
lines changed

OMCompiler/Compiler/runtime/systemimpl.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,6 +2777,18 @@ char* System_getSimulationHelpTextSphinx(int detailed, int sphinx)
27772777
flagDesc = GB_METHOD_DESC;
27782778
break;
27792779

2780+
case FLAG_SR_INT:
2781+
numExtraFlags = GB_INTERPOL_MAX;
2782+
flagName = GB_INTERPOL_METHOD_NAME;
2783+
flagDesc = GB_INTERPOL_METHOD_DESC;
2784+
break;
2785+
2786+
case FLAG_SR_CTRL:
2787+
numExtraFlags = GB_CTRL_MAX;
2788+
flagName = GB_CTRL_METHOD_NAME;
2789+
flagDesc = GB_CTRL_METHOD_DESC;
2790+
break;
2791+
27802792
case FLAG_SR_NLS:
27812793
numExtraFlags = GB_NLS_MAX;
27822794
flagName = GB_NLS_METHOD_NAME;
@@ -2789,6 +2801,18 @@ char* System_getSimulationHelpTextSphinx(int detailed, int sphinx)
27892801
flagDesc = GB_METHOD_DESC;
27902802
break;
27912803

2804+
case FLAG_MR_INT:
2805+
numExtraFlags = GB_INTERPOL_MAX;
2806+
flagName = GB_INTERPOL_METHOD_NAME;
2807+
flagDesc = GB_INTERPOL_METHOD_DESC;
2808+
break;
2809+
2810+
case FLAG_MR_CTRL:
2811+
numExtraFlags = GB_CTRL_MAX;
2812+
flagName = GB_CTRL_METHOD_NAME;
2813+
flagDesc = GB_CTRL_METHOD_DESC;
2814+
break;
2815+
27922816
case FLAG_MR_NLS:
27932817
numExtraFlags = GB_NLS_MAX;
27942818
flagName = GB_NLS_METHOD_NAME;

OMCompiler/SimulationRuntime/c/simulation/solver/gbode_conf.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,6 @@
4040

4141
void dumOptions(const char* flagName, const char* flagValue, const char** argsArr, unsigned int maxArgs);
4242

43-
const char *GB_CTRL_METHOD_NAME[GB_CTRL_MAX] = {
44-
/* GB_CTRL_UNKNOWN */ "unknown",
45-
/* GB_CTRL_I */ "i",
46-
/* GB_CTRL_PI */ "pi",
47-
/* GB_CTRL_CNST */ "const"
48-
};
49-
50-
const char *GB_CTRL_METHOD_DESC[GB_CTRL_MAX] = {
51-
/* GB_CTRL_UNKNOWN */ "unknown",
52-
/* GB_CTRL_I */ "I controller for step size",
53-
/* GB_CTRL_PI */ "PI controller for step size",
54-
/* GB_CTRL_CNST */ "Constant step size"
55-
};
56-
57-
const char *GB_INTERPOL_METHOD_NAME[GB_INTERPOL_MAX] = {
58-
/* GB_INTERPOL_UNKNOWN */ "unknown",
59-
/* GB_INTERPOL_LIN */ "linear",
60-
/* GB_INTERPOL_HERMITE */ "hermite",
61-
/* GB_INTERPOL_HERMITE_a */ "hermite_a",
62-
/* GB_INTERPOL_HERMITE_b */ "hermite_b",
63-
/* GB_INTERPOL_HERMITE_ERRCTRL */ "hermite_errctrl",
64-
/* GB_DENSE_OUTPUT */ "dense_output",
65-
/* GB_DENSE_OUTPUT_ERRCTRL */ "dense_output_errctrl"
66-
};
67-
68-
const char *GB_INTERPOL_METHOD_DESC[GB_INTERPOL_MAX] = {
69-
/* GB_INTERPOL_UNKNOWN */ "unknown",
70-
/* GB_INTERPOL_LIN */ "Linear interpolation (1st order)",
71-
/* GB_INTERPOL_HERMITE */ "Hermite interpolation (3rd order)",
72-
/* GB_INTERPOL_HERMITE_a */ "Hermite interpolation (only for left hand side)",
73-
/* GB_INTERPOL_HERMITE_b */ "Hermite interpolation (only for right hand side)",
74-
/* GB_INTERPOL_HERMITE_ERRCTRL */ "Hermite interpolation with error control",
75-
/* GB_DENSE_OUTPUT */ "use dense output formula for interpolation",
76-
/* GB_DENSE_OUTPUT_ERRCTRL */ "use dense output fomular with error control"
77-
};
78-
7943
/**
8044
* @brief Get Runge-Kutta method from simulation flag FLAG_SR or FLAG_MR.
8145
*

OMCompiler/SimulationRuntime/c/simulation/solver/gbode_conf.h

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,41 +40,10 @@
4040
extern "C" {
4141
#endif
4242

43-
/**
44-
* @brief Step size controller method
45-
*/
46-
enum GB_CTRL_METHOD {
47-
GB_CTRL_UNKNOWN = 0, /* Unknown controller */
48-
GB_CTRL_I = 1, /* I controller */
49-
GB_CTRL_PI = 2, /* PI controller */
50-
GB_CTRL_CNST = 3, /* Constant step size */
51-
52-
GB_CTRL_MAX
53-
};
54-
55-
extern const char *GB_CTRL_METHOD_NAME[GB_CTRL_MAX];
56-
extern const char *GB_CTRL_METHOD_DESC[GB_CTRL_MAX];
57-
58-
enum GB_INTERPOL_METHOD {
59-
GB_INTERPOL_UNKNOWN = 0, /* Unknown interpolation method */
60-
GB_INTERPOL_LIN, /* Linear interpolation */
61-
GB_INTERPOL_HERMITE, /* Hermite interpolation */
62-
GB_INTERPOL_HERMITE_a, /* Hermite interpolation (only for left hand side)*/
63-
GB_INTERPOL_HERMITE_b, /* Hermite interpolation (only for right hand side)*/
64-
GB_INTERPOL_HERMITE_ERRCTRL, /* Hermite interpolation with error control */
65-
GB_DENSE_OUTPUT, /* Dense output, if available else hermite */
66-
GB_DENSE_OUTPUT_ERRCTRL, /* Dense output, if available else hermite with error control */
67-
68-
GB_INTERPOL_MAX
69-
};
70-
71-
extern const char *GB_INTERPOL_METHOD_NAME[GB_INTERPOL_MAX];
72-
extern const char *GB_INTERPOL_METHOD_DESC[GB_INTERPOL_MAX];
73-
7443
enum GB_METHOD getGB_method(enum _FLAG flag);
75-
enum GB_NLS_METHOD getGB_NLS_method(enum _FLAG flag);
76-
enum GB_CTRL_METHOD getControllerMethod();
7744
enum GB_INTERPOL_METHOD getInterpolationMethod(enum _FLAG flag);
45+
enum GB_CTRL_METHOD getControllerMethod(enum _FLAG flag);
46+
enum GB_NLS_METHOD getGB_NLS_method(enum _FLAG flag);
7847
double getGBRatio();
7948

8049
#ifdef __cplusplus

OMCompiler/SimulationRuntime/c/util/simulation_options.c

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,12 @@ const char *FLAG_DESC[FLAG_MAX+1] = {
270270
/* FLAG_DATA_RECONCILE_BOUNDARY */ "Run the Data Reconciliation numerical computation algorithm for boundary condition equations",
271271
/* FLAG_SR */ "Value specifies the chosen solver of solver gbode (single-rate, slow states integrator)",
272272
/* FLAG_SR_CTRL */ "Step size control of solver gbode (single-rate, slow states integrator)",
273-
/* FLAG_SR_ERR */ "Error estimation done by Richardson extrapolation of solver gbode (single-rate, slow states integrator)",
273+
/* FLAG_SR_ERR */ "Error estimation done by Richardson extrapolation (-gberr=1) of solver gbode (single-rate, slow states integrator)",
274274
/* FLAG_SR_INT */ "Interpolation method of solver gbode (single-rate, slow states integrator)",
275275
/* FLAG_SR_NLS */ "Non-linear solver method of solver gbode (single-rate, slow states integrator)",
276276
/* FLAG_MR */ "Value specifies the chosen solver of solver gbode (multi-rate, fast states integrator)",
277277
/* FLAG_MR_CTRL */ "Step size control of solver gbode (multi-rate, fast states integrator)",
278-
/* FLAG_MR_ERR */ "Error estimation done by Richardson extrapolation of solver gbode (multi-rate, fast states integrator)",
278+
/* FLAG_MR_ERR */ "Error estimation done by Richardson extrapolation (-gberr=1) of solver gbode (multi-rate, fast states integrator)",
279279
/* FLAG_MR_INT */ "Interpolation method of solver gbode (multi-rate, fast states integrator)",
280280
/* FLAG_MR_NLS */ "Non-linear solver method of solver gbode (multi-rate, fast states integrator)",
281281
/* FLAG_MR_PAR */ "Define percentage of states for the fast states selection of solver gbode",
@@ -568,27 +568,30 @@ const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
568568
/* FLAG_DATA_RECONCILE_BOUNDARY */
569569
" Run the Data Reconciliation numerical computation algorithm for boundary condition equations",
570570
/* FLAG_SR */
571-
"Value specifies the chosen solver of solver gbode (single-rate, slow states integrator)",
571+
" Value specifies the chosen solver of solver gbode (single-rate, slow states integrator).",
572572
/* FLAG_SR_CTRL */
573-
"Step size control of solver gbode (single-rate, slow states integrator)",
573+
" Step size control of solver gbode (single-rate, slow states integrator).",
574574
/* FLAG_SR_ERR */
575-
"Error estimation done by Richardson extrapolation of solver gbode (single-rate, slow states integrator)",
575+
" Error estimation done by Richardson extrapolation (-gberr=1) of solver gbode\n"
576+
" (single-rate, slow states integrator).",
576577
/* FLAG_SR_INT */
577-
"Interpolation method of solver gbode (single-rate, slow states integrator)",
578+
" Interpolation method of solver gbode (single-rate, slow states integrator).",
578579
/* FLAG_SR_NLS */
579-
"Non-linear solver method of solver gbode (single-rate, slow states integrator)",
580+
" Non-linear solver method of solver gbode (single-rate, slow states integrator).",
580581
/* FLAG_MR */
581-
"Value specifies the chosen solver of solver gbode (multi-rate, fast states integrator)",
582+
" Value specifies the chosen solver of solver gbode (multi-rate, fast states integrator).\n"
583+
" Current Restriction: Fully implicit (Gauss, Radau, Lobatto) RK methods are not supported, yet.",
582584
/* FLAG_MR_CTRL */
583-
"Step size control of solver gbode (multi-rate, fast states integrator)",
585+
" Step size control of solver gbode (multi-rate, fast states integrator).",
584586
/* FLAG_MR_ERR */
585-
"Error estimation done by Richardson extrapolation of solver gbode (multi-rate, fast states integrator)",
587+
" Error estimation done by Richardson extrapolation (-gberr=1) of solver gbode\n"
588+
" (multi-rate, fast states integrator).",
586589
/* FLAG_MR_INT */
587-
"Interpolation method of solver gbode (multi-rate, fast states integrator)",
590+
" Interpolation method of solver gbode (multi-rate, fast states integrator).",
588591
/* FLAG_MR_NLS */
589-
"Non-linear solver method of solver gbode (multi-rate, fast states integrator)",
592+
" Non-linear solver method of solver gbode (multi-rate, fast states integrator).",
590593
/* FLAG_MR_PAR */
591-
"Define percentage of states for the fast states selection of solver gbode",
594+
" Define percentage of states for the fast states selection of solver gbode (values from 0 to 1).",
592595
/* FLAG_RT */
593596
" Value specifies the scaling factor for real-time synchronization (0 disables).\n"
594597
" A value > 1 means the simulation takes a longer time to simulate.\n",
@@ -963,6 +966,42 @@ const char *GB_NLS_METHOD_DESC[GB_NLS_MAX] = {
963966
/* GB_NLS_KINSOL */ "SUNDIALS KINSOL: Inexact Newton, sparse"
964967
};
965968

969+
const char *GB_CTRL_METHOD_NAME[GB_CTRL_MAX] = {
970+
/* GB_CTRL_UNKNOWN */ "unknown",
971+
/* GB_CTRL_I */ "i",
972+
/* GB_CTRL_PI */ "pi",
973+
/* GB_CTRL_CNST */ "const"
974+
};
975+
976+
const char *GB_CTRL_METHOD_DESC[GB_CTRL_MAX] = {
977+
/* GB_CTRL_UNKNOWN */ "unknown",
978+
/* GB_CTRL_I */ "I controller for step size",
979+
/* GB_CTRL_PI */ "PI controller for step size",
980+
/* GB_CTRL_CNST */ "Constant step size"
981+
};
982+
983+
const char *GB_INTERPOL_METHOD_NAME[GB_INTERPOL_MAX] = {
984+
/* GB_INTERPOL_UNKNOWN */ "unknown",
985+
/* GB_INTERPOL_LIN */ "linear",
986+
/* GB_INTERPOL_HERMITE */ "hermite",
987+
/* GB_INTERPOL_HERMITE_a */ "hermite_a",
988+
/* GB_INTERPOL_HERMITE_b */ "hermite_b",
989+
/* GB_INTERPOL_HERMITE_ERRCTRL */ "hermite_errctrl",
990+
/* GB_DENSE_OUTPUT */ "dense_output",
991+
/* GB_DENSE_OUTPUT_ERRCTRL */ "dense_output_errctrl"
992+
};
993+
994+
const char *GB_INTERPOL_METHOD_DESC[GB_INTERPOL_MAX] = {
995+
/* GB_INTERPOL_UNKNOWN */ "unknown",
996+
/* GB_INTERPOL_LIN */ "Linear interpolation (1st order)",
997+
/* GB_INTERPOL_HERMITE */ "Hermite interpolation (3rd order)",
998+
/* GB_INTERPOL_HERMITE_a */ "Hermite interpolation (only for left hand side)",
999+
/* GB_INTERPOL_HERMITE_b */ "Hermite interpolation (only for right hand side)",
1000+
/* GB_INTERPOL_HERMITE_ERRCTRL */ "Hermite interpolation with error control",
1001+
/* GB_DENSE_OUTPUT */ "use dense output formula for interpolation",
1002+
/* GB_DENSE_OUTPUT_ERRCTRL */ "use dense output fomular with error control"
1003+
};
1004+
9661005
const char *SOLVER_METHOD_NAME[S_MAX] = {
9671006
/* S_UNKNOWN = 0 */ "unknown",
9681007
/* S_EULER */ "euler",

OMCompiler/SimulationRuntime/c/util/simulation_options.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,37 @@ enum GB_NLS_METHOD {
259259
extern const char *GB_NLS_METHOD_NAME[GB_NLS_MAX];
260260
extern const char *GB_NLS_METHOD_DESC[GB_NLS_MAX];
261261

262+
/**
263+
* @brief Step size controller method
264+
*/
265+
enum GB_CTRL_METHOD {
266+
GB_CTRL_UNKNOWN = 0, /* Unknown controller */
267+
GB_CTRL_I = 1, /* I controller */
268+
GB_CTRL_PI = 2, /* PI controller */
269+
GB_CTRL_CNST = 3, /* Constant step size */
270+
271+
GB_CTRL_MAX
272+
};
273+
274+
extern const char *GB_CTRL_METHOD_NAME[GB_CTRL_MAX];
275+
extern const char *GB_CTRL_METHOD_DESC[GB_CTRL_MAX];
276+
277+
enum GB_INTERPOL_METHOD {
278+
GB_INTERPOL_UNKNOWN = 0, /* Unknown interpolation method */
279+
GB_INTERPOL_LIN, /* Linear interpolation */
280+
GB_INTERPOL_HERMITE, /* Hermite interpolation */
281+
GB_INTERPOL_HERMITE_a, /* Hermite interpolation (only for left hand side)*/
282+
GB_INTERPOL_HERMITE_b, /* Hermite interpolation (only for right hand side)*/
283+
GB_INTERPOL_HERMITE_ERRCTRL, /* Hermite interpolation with error control */
284+
GB_DENSE_OUTPUT, /* Dense output, if available else hermite */
285+
GB_DENSE_OUTPUT_ERRCTRL, /* Dense output, if available else hermite with error control */
286+
287+
GB_INTERPOL_MAX
288+
};
289+
290+
extern const char *GB_INTERPOL_METHOD_NAME[GB_INTERPOL_MAX];
291+
extern const char *GB_INTERPOL_METHOD_DESC[GB_INTERPOL_MAX];
292+
262293
enum SOLVER_METHOD
263294
{
264295
S_UNKNOWN = 0,

0 commit comments

Comments
 (0)