Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Belonging to [master]: - OpenModelica/OpenModelica-testsuite#1071
- Loading branch information
1 parent
87420c2
commit 01e433a
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// name: ticket-5206 | ||
// keywords: if equations, non-linear, residual equations | ||
// status: correct | ||
|
||
|
||
loadString(" | ||
model Test5206 | ||
Real x(start=1); | ||
Real y(start=8); | ||
Real usat(start=1); | ||
Real u(start=2); | ||
parameter Real y0(fixed = false, start = 8); | ||
parameter Real T = 1; | ||
parameter Real k = 10; | ||
parameter Real uMin = 0; | ||
parameter Real uMax = 1; | ||
parameter Real y_ref = 8; | ||
initial equation | ||
der(x) = 0; | ||
if u > usat then | ||
u = usat + 1; | ||
else | ||
y = y_ref; | ||
end if; | ||
equation | ||
T * der(x) = usat - x; | ||
y = k * x; | ||
usat = homotopy(actual = smooth(0, if u > uMax then uMax else if u < uMin then uMin else u), simplified = u); | ||
u = y0 - y; | ||
end Test5206; | ||
"); | ||
getErrorString(); | ||
|
||
simulate(Test5206); | ||
getErrorString(); | ||
|
||
val(x,0.0); | ||
val(x,1.0); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// | ||
// The selection of a new tearing variable failed. | ||
// record SimulationResult | ||
// resultFile = "Test5206_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Test5206', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method. | ||
// LOG_SUCCESS | info | The simulation finished successfully. | ||
// " | ||
// end SimulationResult; | ||
// "Warning: Function Tearing.selectTearingVar failed at least once. Use -d=tearingdump or -d=tearingdumpV for more information. | ||
// " | ||
// 1.0 | ||
// 1.0 | ||
// endResult |