Opened 8 years ago
Closed 7 years ago
#4289 closed defect (fixed)
In OMPython the linearization doesn't result correct results
Reported by: | arunkumar palanisamy | Owned by: | arunkumar palanisamy |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | OMPython | Version: | |
Keywords: | Cc: | Bernt.Lie@… |
Description
Below, I summarize the linearization results for a standard reactor model from the literature. The model has 4 inputs, one output and 2 states. The order of the inputs, outputs and states have been read from the resulting file of the OM linearization routine.
The “theoretical calculation” result is the correct result. This result has been found by analytic computation of the Jacobians using Waterloo Maple (similar to Mathematica), and by subsequent insertion of values for the operating point of the system. I have also computed the Jacobians *numerically* using MATLAB, and the result is identical to the “exact” result. So there can be no doubt that the “theoretical” result is the correct result.
A comment on the theoretical result: the A matrix contains one positive and one negative eigenvalue. The positive eigenvalue indicates that the system in fact is unstable at the operating point. (Something similar would be found for an inverted pendulum…) However, I have used very accurate values for the initial states, and in my simulations using OM, there is no problem in simulating the system for 10 minutes with no observed drift in the operating point.
The A and B matrices found using linearization in OM are very different from the exact values. The C and D matrices are correct, though.
Result from OM Linearization:
A= [-2.092050209205021,5.653416094580654e-077;
-6.134270952087974e-075,-2.702332893209552e-077];
B= [2.092050209205021,0,-0.4346639552067547,0;
0,0,-0.4901435697186606,0];
C= [0,0.01];
D= [0,0,0,0];
Results from Handmade calculation and from matlab
A =[4.3796 ,2.0921;
-3.5715 ,-2.0000]
B = [2.0921 ,1.0000 , 0, 0;
0 ,0 ,0.5000, 100.0000]
C= [0,0.01];
D= [0,0,0,0];
Attachments (1)
Change History (5)
by , 8 years ago
Attachment: | Reactor.mo added |
---|
comment:1 by , 8 years ago
Cc: | added |
---|---|
Status: | new → accepted |
comment:2 by , 8 years ago
Component: | Build Environment → OMPython |
---|---|
Summary: | Erroneous result by linearization in OM → In OMPython the linearization doesn't result correct results |
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
The issue here is to pass all options and the inputs correctly from OMPython to the model.
With the following script:
one can obtain the expected results:
To get the desired matrix B, of course one have to set the inputs correct.
As far as I see OMPython doesn't pass the stopTime, which is the point in time where the linearization is desired. Also the inputs are not passed to the model, so the values above are calculated with
u ={0
}, and than the solution starts to drifting.