- Index
- » Users
- » eypma
- » Profile
Posts
Posts
Can someone tell me about the status and plans of OMOptim.
The documentation is a bit limited, at least too limited for me to even get the most basic case running.
In addition, I can't find any examples to get me started.
Or do I have to switch to JModelica (using Optimica) to do the job?
I am trying to generate random noise but get strange results. Code is based on Kalman.onb example (which does not work either. The function I use and the modle to test it are:
Code:
record SEEDINFO
Real s1;
Real s2;
Real s3;
end SEEDINFO;
function MathRandom
input SEEDINFO si;
input Real tim;
output Real x;
output SEEDINFO so;
algorithm
so.s1 := abs( rem( (171*si.s1*exp( mod(tim-11,tim+13) ) ), 30269) );
so.s2 := abs( rem( (172*si.s2*exp( mod(tim-5,tim+7) ) ), 30307) );
so.s3 := abs( rem( (170*si.s3*exp( mod(tim-23,tim+76) ) ), 30323) );
if so.s1 < 1e-4 then
so.s1 := 1.0;
end if;
if so.s2 < 1e-4 then
so.s2 := 1.0;
end if;
if so.s3 < 1e-4 then
so.s3 := 1.0;
end if;
x := rem((so.s1/30269.0 +so.s2/30307.0 + so.s3/30323.0),1.0);
end MathRandom;
model test_MathRandom
output Real y(start=0.0);
parameter Real dtSample = 0.1;
protected
SEEDINFO s(s1(start=-10), s2(start=20), s3(start=30));
Real x(start=0.0);
algorithm
(x,s):=MathRandom(s,time);
equation
when sample(0.0, dtSample) then
y = x;
end when;
end test_MathRandom;
The output starts somewhere at 1.0e+21.
The function when used in OMNotebook gives the expected results.
Any ideas?
- Index
- » Users
- » eypma
- » Profile