Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1936e9d
commit e69beac
Showing
5 changed files
with
110 additions
and
2 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
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,36 @@ | ||
// name: startValue1 | ||
// keywords: initialization, start-value, states | ||
// status: correct | ||
|
||
loadString(" | ||
model startValue1 | ||
parameter Real p1(fixed=false); | ||
parameter Real p2 = 2.0; | ||
Real x(start=p1, fixed=true); | ||
Real y(start=p2, fixed=true); | ||
initial equation | ||
p1 = 1.0; | ||
equation | ||
der(x)=0; | ||
der(y)=0; | ||
end startValue1; | ||
"); getErrorString(); | ||
|
||
simulate(startValue1, stopTime=0.2); getErrorString(); | ||
val(x, 0.0); getErrorString(); | ||
val(y, 0.0); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// record SimulationResult | ||
// resultFile = "startValue1_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 0.2, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'startValue1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// "" | ||
// 1.0 | ||
// "" | ||
// 2.0 | ||
// "" | ||
// endResult |
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,37 @@ | ||
// name: startValue2 | ||
// keywords: initialization, start-value, algebraic variables | ||
// status: correct | ||
|
||
loadString(" | ||
model startValue2 | ||
parameter Real a(fixed=false); | ||
parameter Real b(fixed=false); | ||
Real w(start=a); | ||
Real y(start=b); | ||
initial equation | ||
a=4; | ||
b=6; | ||
equation | ||
sin(w*y)+cos(w)*y=time; | ||
sin(w*y)+sin(y)+w=(a+b)*time; | ||
end startValue2; | ||
"); getErrorString(); | ||
|
||
simulate(startValue2, startTime=0.1, stopTime=0.2); getErrorString(); | ||
val(w, 0.1); getErrorString(); | ||
val(y, 0.1); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// record SimulationResult | ||
// resultFile = "startValue2_res.mat", | ||
// simulationOptions = "startTime = 0.1, stopTime = 0.2, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'startValue2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// "" | ||
// 2.492275940961305 | ||
// "" | ||
// -0.9661771347533339 | ||
// "" | ||
// endResult |
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,32 @@ | ||
// name: startValue3 | ||
// keywords: initialization, start-value, parameter | ||
// status: correct | ||
|
||
loadString(" | ||
model startValue3 | ||
parameter Real a(fixed=false); | ||
parameter Real b(fixed=false); | ||
Real c(start=a/b, fixed=true); | ||
initial equation | ||
a=4; | ||
b=6; | ||
equation | ||
der(c) = 0; | ||
end startValue3; | ||
"); getErrorString(); | ||
|
||
simulate(startValue3, stopTime=0.2); getErrorString(); | ||
val(c, 0.0); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// record SimulationResult | ||
// resultFile = "startValue3_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 0.2, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'startValue3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// "" | ||
// 0.6666666666666666 | ||
// "" | ||
// endResult |