Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » phuonghoathu
  • » Profile

Posts

Posts

sjoelund.se wrote:

For me, the first one succeeds and the second one fails.
If I make M,m and D constant, it succeeds. So something in initialization seems to go wrong. Note that using simulate(rocket, method = "euler") works fine regardless.

But the first falied and the second true.I can't  explain,

So something in initialization seems to go wrong

??????

Please tell me!!!!!!!!

thanks for all!!!!!!!!!!!!!

ok

I will write to clean my problem!!!!!!!11

The first i have a ODE :                   => x’’  = G*M* /(x2)  + G*m*/( (D-x)2 )       , x(0) = R , x'(0) = V    

G = 6.67*(10^(-11))  "gravity constant";

M = 59736*(10^(20)) "mass of earth";

m = 7.347*(10^(22)) "mass of mooth";

D = 384400.0 "distance betwen earth and mooth(mean)";

V = 50.0 "velocity of rocket";

After i write this on modelica (**********)

Code:

model rocket

    parameter Real G = 6.67*(10^(-11))  "gravity constant";
    parameter Real M = 59736*(10^(20)) "mass of earth";
    parameter Real m = 7.347*(10^(22)) "mass of mooth";
    parameter Real D = 384400.0 "distance betwen earth and mooth(mean)";
    parameter Real V = 50.0 "velocity of rocket";
    Real x(start = 6400.0) "distance bettwen rocket and earth";
    Real y(start = V) "der of x";
    Real temp1;
    Real temp2;
equation
           temp1 =     G*M;
           temp2 = G*m;
           der(y)*(D-x)*(D-x)*x*x =  -1*temp1*(D-x)*(D-x) + temp2*x*x ;       
           der(x) = y;   
end rocket;

i simulator it -> error

But where i change it by :   y(t) = Rx(t) và u(a) = y(a*T) với t = a*T with T2 = R/g
I have new ODE :                               u’’ = -1/(u2)  + 0.012/((60 - u)2);   u(0) = 1 ;u’(0) = V*T/R

I write on modelica

Code:

model rocket


    parameter Real G = 6.67*(10^(-11))  "gravity constant";

    parameter Real M = 59736*(10^(20)) "mass of earth";

    parameter Real m = 7.347*(10^(22)) "mass of mooth";

    parameter Real D = 384400.0 "distance betwen earth and mooth(mean)";

    parameter Real V = 50.0 "velocity of rocket";

    Real x(start = 1.0);

    Real y(start = (V/7.92));

    Real temp1 ;

    Real temp2;

equation

    temp1 = m/M;

    temp2  = D/6400;

    der(y)*((temp2-x)^2)*x*x =  -1*((temp2-x)^2) + temp1*x*x ;

    der(x) = y;   

end rocket;

-> it is ok

So , why the first(**********) way was error

Thanks for all!
But I can't fix it.plz help me.
I get a other solution by ODE :

Code:

model rocket

    parameter Real G = 6.67*(10^(-11))  "gravity constant";
    parameter Real M = 59736*(10^(20)) "mass of earth";
    parameter Real m = 7.347*(10^(22)) "mass of mooth";
    parameter Real D = 384400.0 "distance betwen earth and mooth(mean)";
    parameter Real V = 50.0 "velocity of rocket";
    Real x(start = 1.0);
    Real y(start = (V/7.92));
    Real temp1 ;
    Real temp2;
equation
    temp1 = m/M;
    temp2  = D/6400;
    der(y)*((temp2-x)^2)*x*x =  -1*((temp2-x)^2) + temp1*x*x ;
    der(x) = y;   
end rocket;

it excute good and can switch to

Code:

model rocket 

    parameter Real G=6.67*(10^(-11))  "gravity constant";
    parameter Real M = 59736*(10^(24)) "mass of earth";
    parameter Real m = 7.347*(10^(22)) "mass of mooth";
    parameter Real D = 384400 "distance bettwen earth and mooth(mean)";
    parameter Real V = 100000.0 "velocity of rocket";
    Real x(start = 0.0) "distance bettwen rocket and earth";
    Real y(start = V) "der of x";
equation
           der(x) = y;
           der(y)*((D-x)^2)*x =  (-1)*G*M*((D-x)^2) + G*m*x ;                 
end rocket;

(************)


so why (************) don't run when i simulate??????It can error of modelica??????


Thanks

hi all

I have GUI in java  and input some parameter example (a) .I want  process in openmodelica example(ODE :

Code:

 der(x) = ax

)and show result  back java.

Plz give me  solution.

thanhks

Ok thanks

plz help me again

Code:

model rocket

    parameter Real G=6.67*(10^(-11))  "gravity constant";
    parameter Real M = 59736*(10^(24)) "mass of earth";
    parameter Real m = 7.347*(10^(22)) "mass of mooth";
    parameter Real D = 384400 "distance bettwen earth and mooth(mean)";
    parameter Real V = 100000.0 "velocity of rocket";
    Real x(start = 0.0) "distance bettwen rocket and earth";
    Real y(start = V) "der of x";
equation
           der(x) = y;
           der(y)*((D-x)^2)*x =  (-1)*G*M*((D-x)^2) + G*m*x ;                 
end rocket;

where i sinulate -> error:

Code:

simulate(rocket,stopTime = 5)

record SimulationResult
    resultFile = "Simulation failed.
"
end SimulationResult;

plz .I need it soon.I don 't know what is error

adrpo,
so,how to get a solution for it????????
y''  - (y'/(x-1)) = x*(x-1) with y'(2) = -1 and y(2) = 1;

@All : I am .... so i not good at  English

i have a problem ưhen i try to describe ODE
I HAVE A  ODE :
    y''  - (y'/(x-1)) = x*(x-1) with y'(2) = -1 and y(2) = 1;
how way to get a solution?????

my code:
         

Code:

model DAEexample

  Real x;
  Real y(start = 1.0);
  Real u(start = -1.0);
equation
  der(y) = u;
  der(u) - (u/(x-1)) = x*(x-1);
end DAEexample;

--------

Code:

loadFile("C:/OpenModelica1.5.0/test/test1.mo")

true

>> simulate(test1,startTime = 2.0,stopTime = 20.0)
record SimulationResult
    resultFile = "Simulation failed.
Error: Too few equations, underdetermined system. The model has 1 equation(s) and 2 variable(s)
"
end SimulationResult;

thanks for all

  • Index
  • » Users
  • » phuonghoathu
  • » Profile
You are here: