- Index
- » Users
- » Ingrasciotta
- » Profile
Posts
Posts
CTG wrote:
My question regarding mainly p1 and p2 was due to the fact that when u1 becames 0, the equation becames: m=0 and breaks any connection between p1 and p2 (any value of p1 and p2 will fulfill the equation), so their value must be completely determined outside the exposed code.
Yes it does. When u1 comes to zero the valve is closed and the mass flow m drop to zero. Any type of connection between p1,p2 is losses but it's permitted by the block connected to the valve where the variables p1 and p2 are determinated.
p1,p2 and rho1 are variables that the valve element obtains through flowports. u1 is a real variable this value can be insert by a real port and it goes from 1 to 0, if the port is not connected u1 = 1.
The code you write to me works correctly but the simulation is extremly slow.
I actually use this code but it doesn't work:
m = u1*Cv * Modelica.Fluid.Utilities.regRoot(2 * rho1 * (p1 - p2), 45);
when u1>=1 then
if noEvent(m-m_r>0.001) then
der(Cv) = -0.001;
elseif noEvent(m-m_r<-0.001) then
der(Cv) = 0.001;
else
der(Cv) = 0;
end if;
elsewhen u1<1 then
der(Cv)=0;
end when ;
u1 is an external signal that is =1 at rated condition and it goes from 1 to 0 when an event occcurs. I want that Cv is constat when u1<1 so when the event occurs.
I tried with a code like this but it doesn't work with large models, the simulation compiles well and starts but it doesn't go over a few percent.
To avoid the chattering i use noEvent in cicle if.
Hi guys,
i'm trying to ha a convergence at a certain value of mass flow with a valve changing Cv. I use this formula to create a valve block:
Cv = m /sqrt(2*rho*(p1-p2))
where :
m--> mass flow
rho--> inlet density
p1--> inlet pressure
p2-->outlet pressure
p1,p2, rho are external parameters, Cv is the only parameter that can i change between one simulation to the other. I shoul liked to write an automatic loop like this :
given Cv at t = 0 and m in rated condition:
if m<m_rated then Cv = Cv+delta
if m>m_rated then Cv = Cv-delta
where delta is a parameter that can i decide every time.
Can i use some block in Modelica Library to obtain this behaviour?
Tnks everybody who will answered
Problem solved
Hello everybody,
I'm molding a joint in Modelica, I know that modelica library already has it .
I create the model with 2 flanges where flow variable is torque tau and the potenzial variable is the angle phi.
I want to simulate a joint loss, so i choose a boolean input K to decide when the event occurs. Then this equations are used:
if not k then
flange_a.tau+flange_b.tau = 0;
flange_a.phi = flange_b.phi;
else
flange_a.tau = 0;
flange_b.tau = 0;
end if ;
Unfortunatly this model doesn't work, the simulation stop after a correct compilation. How can i solve?
Problem solved! Thanks you so much!
I have seen it. I want to print an error when these two parameter are false or true both of them at the same time.
I try to use an auxiliary boolean parameter n :
parameter Boolean n = false;
equation
if Step ==false and Ramp == false then
n = true;
elseif Step == true and Ramp ==true then
n = true;
else
n = false;
end if;
assert(n,"message",level = AssertionLevel.error)
But it still not working. Can you help me?
Hello,
i'm create a model using blocks selfmade. For each block the user will provide the parameters required. If the user will not put in all the parameters( for example he will leave an empty box) i want to stamp an error or warning (and if possibile stop the initialization of the simulation). How can i do ?
Tnks for answered. In the end i resolve with a timer wich start when the condition x==1.1 is sodisfied using a boolean variable.
I don't used:
when x>= 1.1 then
T=Time;
end when ;
because the time variable T will updaiting time by time for every second that x will be over than 1.1.
Problem solved. Tnks everyone
Hello ,
i want to get the time of the simulation when the event is appened.
For example:
i have the variable x(t) that goes from 0 to 2 and i want to get the time when x =1.5.
I write on modelica this code.
when x == 1.5 then
T = time;
end when;
This code doesn't work.
Where am i failing?
Tnks
Hello,
i'm simuling a model with modelica and if i check the system with the "check button" it's ok ( 64 equation in 64 variables) but if i run the simulation this error appear in the dashboard:
"An independent subset of the model has imbalanced number of equations (60) and variables (59)."
The model is created with 2 submodels, one for a volume and one for a single stage of a steam turbine. The submodel works alone correctly.
Where am i make mistakes?
- Index
- » Users
- » Ingrasciotta
- » Profile