Hi, I started to use modelica like a week ago and i got this model
that i want to simulate:
class Experimento "Experimento"
Real w_entrada;
Real w_salida;
Real L_o;
Real tension(start=0);
Real L;
Real posicion(start=0.2);
Real velocidad;
Real beta;
constant Real radio = 0.05;
constant Real young = 3e6;
constant Real area = 5e-5;
constant Real masa = 0.5;
constant Real k_f = 2;
constant Real l = 0.4;
constant Real gravedad= 9.8;
equation
posicion = (l / 2) * tan(beta) - 2 * radio / cos(beta);
L = 4 * radio*(beta - sin(beta)/cos(beta)) + l/cos(beta);
masa * der(velocidad) = masa * gravedad - 2 * tension * sin(beta)
- k_f * velocidad;
der(posicion) = velocidad;
/**** Young's Modulus ****/
young * area * (L - L_o) = tension * L_o ;
der(L_o) = radio * (w_entrada - w_salida);
w_entrada = if ((time > 20 ) and (time <= 40)) then 0.5
else if ((time > 40 ) and (time <= 60)) then 1
else if ((time > 60 ) and (time <= 80)) then 0.5
else 0;
w_salida = if ((time > 30 ) and (time <= 50)) then 0.5
else if ((time > 50 ) and (time <= 70)) then 1
else if ((time > 70 ) and (time <= 90)) then 0.5
else 0;
end Experimento;
I already got a simulation of it on scilba/scicos, but i need to use
an extended kalman filter, and scicos it doesn't help a lot with it,
so maybe with modelica could be easier, but i can't understand how
modelica use the "start" condition.
To me (a human being) it's clear that with the "posicion" (position)
starting at 0.2 modelica could calculate the initial condition for
"beta" and "L", with the first two equations (and that's what it
does.). And with the "tension" starting at 0, should calculate the
initial conditions for L_o, but it doesn't, maybe thats how works
modelica, how could i describe my model in a way that modelica can
calculate the initial conditions.
When i try to simulate the model i got this:
>>> loadFile("/home/jcardona/stuff/personal/tesis/modelica/Primer_Modelo_20081005a.mo")
true
>>> simulate(Experimento,stopTime=10)
record
resultFile = "Simulation failed.
"
end record
>>>
and when try to simulate just a second:
>>> loadFile("/home/jcardona/stuff/personal/tesis/modelica/Primer_Modelo_20081005a.mo")
true
>>> simulate(Experimento,stopTime=0)
record
resultFile = "Experimento_res.plt"
end record
>>>
with this result i can know the initial conditions (is that true? i
just suppose that if modelica try to simulate 0 seconds it will just
calculate the initial conditions.)
Another question: "The language feature differentiation of function
tan is not supported. Suggested workaroung: no suggestion", what is
that? modelica can't get the derivate of tan?? how can be added? just
using a sin/cos?
Maybe the answer could be really obvious, please remember i got a week
on modelica :)
Thanks.
--
Jorge Eduardo Cardona
[EMAIL PROTECTED]
jorgeecardona.blogspot.com
------------------------------------------------
Linux registered user #391186
Registered machine #291871
------------------------------------------------