Skip to content

Commit

Permalink
added DrumBoiler as testcase for linearization
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Oct 4, 2017
1 parent 1cd286d commit 118b3d0
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openmodelica/linearization/Makefile
Expand Up @@ -22,10 +22,11 @@ test_04.mos \
test_05.mos \
test_06.mos \
test_07.mos \
ticket3701.mos \
testDrumBoiler.mos \
testknownvar.mos \
testMathFuncs.mos \
testRecordDiff.mos \
ticket3701.mos \


# test that currently fail. Move up when fixed.
Expand Down
67 changes: 67 additions & 0 deletions openmodelica/linearization/testDrumBoiler.mos
@@ -0,0 +1,67 @@
// name: testDrumBoiler
// keywords: jacobian differentiation linearization
// status: correct
// teardown_command: rm -rf testDrumBoilerLin* output.log
//

loadModel(Modelica);getErrorString();
loadString("
model testDrumBoilerLin
extends Modelica.Fluid.Examples.DrumBoiler.DrumBoiler(use_inputs=true);
end testDrumBoilerLin;
");

setCommandLineOptions("--generateSymbolicLinearization");
linearize(testDrumBoilerLin, stopTime=0.0);getErrorString();

loadFile("linear_testDrumBoilerLin.mo");
list(linear_testDrumBoilerLin);


// Result:
// true
// ""
// true
// true
// record SimulationResult
// resultFile = "testDrumBoilerLin_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 0.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testDrumBoilerLin', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "stdout | info | Linearization will performed at point of time: 0.000000
// stdout | info | The initialization finished successfully without homotopy method.
// stdout | info | The simulation finished successfully.
// stdout | info | Linear model is created!
// "
// end SimulationResult;
// "Warning: There are iteration variables with default zero start attribute. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
// "
// true
// "model linear_testDrumBoilerLin
// parameter Integer n = 3;
// // states
// parameter Integer k = 2;
// // top-level inputs
// parameter Integer l = 4;
// // top-level outputs
// parameter Real x0[3] = {0, 67, 100000};
// parameter Real u0[2] = {0, 0};
// parameter Real A[3, 3] = [-0, -0.008333333333333333, -0; 0.01044245597663854, -0.01044245597663854, 1.734723475976807e-18; 0.329426456282044, -0.3294264562820693, -1.265654248072678e-14];
// parameter Real B[3, 2] = [0, 0; -0.001782707655225083, 0.0003271130816094902; -53.49729114463396, 23.68285223957279];
// parameter Real C[4, 3] = [0, 0, 0.0001439468903880629; 0, 1, 0; 0, 0, 1e-05; 0, 0, 0];
// parameter Real D[4, 2] = [0, 0; 0, 0; 0, 0; 1, 0];
// Real x[3](start = x0);
// input Real u[2](start = u0);
// output Real y[4];
// Real 'x_controller.x' = x[1];
// Real 'x_evaporator.V_l' = x[2];
// Real 'x_evaporator.p' = x[3];
// Real 'u_Y_Valve' = u[1];
// Real 'u_q_F' = u[2];
// Real 'y_T_S' = y[1];
// Real 'y_V_l' = y[2];
// Real 'y_p_S' = y[3];
// Real 'y_qm_S' = y[4];
// equation
// der(x) = A * x + B * u;
// y = C * x + D * u;
// end linear_testDrumBoilerLin;"
// endResult

0 comments on commit 118b3d0

Please sign in to comment.