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
  • » Ingrasciotta
  • » Profile

Posts

Posts

Aug-21-19 06:50:19
How obtain a convergence at a certain value
Category: Programming

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.

Aug-20-19 06:32:51
How obtain a convergence at a certain value
Category: Programming

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.

Aug-18-19 15:02:38
How obtain a convergence at a certain value
Category: Programming

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.

Aug-18-19 08:08:41
How obtain a convergence at a certain value
Category: Programming

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.

Aug-14-19 14:05:41
How obtain a convergence at a certain value
Category: Programming

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

Jul-24-19 10:00:25
Category: Programming

Problem solved

Jul-13-19 17:44:53
Category: Programming

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?

Jul-12-19 07:47:48
Category: Programming

Problem solved! Thanks you so much!

Jul-10-19 09:10:12
Category: Programming

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? 

Jul-02-19 15:05:42
Category: Programming

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 ?

Jun-24-19 06:38:02
Gettting time event
Category: Programming

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.

Jun-21-19 08:48:04
An independent subset of the model has imbalanced number of equations
Category: Programming

Problem solved. Tnks everyone

Jun-20-19 15:03:57
Gettting time event
Category: Programming

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

May-30-19 09:26:04
An independent subset of the model has imbalanced number of equations
Category: Programming

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
You are here: