Skip to content

Commit

Permalink
Simplify and fix extrapolation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Feb 23, 2024
1 parent bde648b commit e822684
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Modelica/Blocks/Sources.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1685,12 +1685,12 @@ parameter Real table[:, <strong>2</strong>]=[0, 0; 1, 1; 2, 4];
extrapolation == Modelica.Blocks.Types.Extrapolation.LastTwoPoints or
extrapolation == Modelica.Blocks.Types.Extrapolation.HoldLastPoint) then
assert(noEvent(time >= t_min + shiftTime), "
Extrapolation warning: Time (=" + String(time) + ") must be greater or equal
than the minimum abscissa value t_min (=" + String(t_min) + ") defined in the table.
Extrapolation warning: Time must be greater or equal
than the shifted minimum abscissa value defined in the table.
", level=AssertionLevel.warning);
assert(noEvent(time <= t_max + shiftTime), "
Extrapolation warning: Time (=" + String(time) + ") must be less or equal
than the maximum abscissa value t_max (=" + String(t_max) + ") defined in the table.
Extrapolation warning: Time must be less or equal
than the shifted maximum abscissa value defined in the table.
", level=AssertionLevel.warning);
end if;

Expand Down
30 changes: 12 additions & 18 deletions Modelica/Resources/C-Sources/ModelicaStandardTables.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,13 +1167,11 @@ double ModelicaStandardTables_CombiTimeTable_getValue(void* _tableID, int iCol,
break;

case NO_EXTRAPOLATION:
ModelicaFormatError("Extrapolation error: Time "
"(=%lf) must be %s or equal\nthan the %s abscissa "
"value %s (=%lf) defined in the table.\n", tOld,
ModelicaFormatError("Extrapolation error: Time must be "
"%s or equal\nthan the shifted %s abscissa "
"value defined in the table.\n",
(extrapolate == LEFT) ? "greater" : "less",
(extrapolate == LEFT) ? "minimum" : "maximum",
(extrapolate == LEFT) ? "t_min" : "t_max",
(extrapolate == LEFT) ? tMin : tMax);
(extrapolate == LEFT) ? "minimum" : "maximum");
return y;

case PERIODIC:
Expand Down Expand Up @@ -1425,13 +1423,11 @@ double ModelicaStandardTables_CombiTimeTable_getDerValue(void* _tableID, int iCo
break;

case NO_EXTRAPOLATION:
ModelicaFormatError("Extrapolation error: Time "
"(=%lf) must be %s or equal\nthan the %s abscissa "
"value %s (=%lf) defined in the table.\n", tOld,
ModelicaFormatError("Extrapolation error: Time must be "
"%s or equal\nthan the shifted %s abscissa "
"value defined in the table.\n",
(extrapolate == LEFT) ? "greater" : "less",
(extrapolate == LEFT) ? "minimum" : "maximum",
(extrapolate == LEFT) ? "t_min" : "t_max",
(extrapolate == LEFT) ? tMin : tMax);
(extrapolate == LEFT) ? "minimum" : "maximum");
return der_y;

case PERIODIC:
Expand Down Expand Up @@ -1685,13 +1681,11 @@ double ModelicaStandardTables_CombiTimeTable_getDer2Value(void* _tableID, int iC
break;

case NO_EXTRAPOLATION:
ModelicaFormatError("Extrapolation error: Time "
"(=%lf) must be %s or equal\nthan the %s abscissa "
"value %s (=%lf) defined in the table.\n", tOld,
ModelicaFormatError("Extrapolation error: Time must be "
"%s or equal\nthan the shifted %s abscissa "
"value defined in the table.\n",
(extrapolate == LEFT) ? "greater" : "less",
(extrapolate == LEFT) ? "minimum" : "maximum",
(extrapolate == LEFT) ? "t_min" : "t_max",
(extrapolate == LEFT) ? tMin : tMax);
(extrapolate == LEFT) ? "minimum" : "maximum");
return der2_y;

case PERIODIC:
Expand Down

0 comments on commit e822684

Please sign in to comment.