Hi Alexander,

<[EMAIL PROTECTED]> writes:
> dunno if that's your problem, but the usage of assert seems to be mistaken 
> here.
>
> Asserting for (dI < dO) means assuring that state. Only if (dI < dO)
> evaluates to false, your message is given. But then the message "Inlet
> smaller than outlet!" suggests the opposite to me. Unless you mean
> "Inlet should be smaller than outlet."

Your are right!  I got a bit confused, I'm sorry.  Anyway, a problem
(bug) remains still: Instead of giving the assertion text (Inlet smaller
than outlet) OM calculates some values and gives no warning/error
message what so ever instead it says:

>>> runScript("model.mos")
"true
true
record
    resultFile = "Idiot.Test_res.plt"
end record

Thanks for your support

       Dieter

>
> Greetings
> Alexander
>
>
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von dieter
> Gesendet: Dienstag, 3. Juni 2008 22:03
> An: Modelica Association
> Betreff: Problem with "assert"
>
> Hi,
>
> unfortunately there seems to be another bug: When I'm running below
> model with
>
>   simulate( Idiot.Test, stopTime = 6000/60,numberOfIntervals=50);
>
> it gives me some 50 result steps, so far so good.  But when I just
> comment out the (here logically irrelevant) assert function below, OM
> gives me only 2 result steps!
>
> Thanks
>
>    Dieter
>
> ------------------------------------------------------------
>
> package Idiot //import Modelica.Constants.*;
>
> final constant Real pi = 3.1415926;
> final constant Real ambientPressure = 101325;
>
> connector Port
>   Real pressure;
>   flow Real flowrate;
> end Port;
>  
> class Fluid                   "Water is the default" 
>   parameter Real density = 1e3;
>   parameter Real viscosity = 1e-3;
> end Fluid;  
>
> partial model TwoPorts
>   outer parameter Fluid fluid;
>   Port inPort, outPort;
> equation
>   inPort.flowrate + outPort.flowrate = 0;
> end TwoPorts;
>
> partial model Conduit         "generic flow resistance element"
>   extends TwoPorts;
>   parameter Real referenceDiameter = 5e-3 "may it be the in or outPort 
> diameter"; 
> //protected
>   final parameter Real d = referenceDiameter; // final excludes them from the 
> GUI
>   final parameter Real A = pi/4 * d^2;
>   Real dp                     "pressure loss";
>   Real r,m, q, z;
>   Real lossFactor;
>   Real v                      "velocity";
>   Real Re                     "Reynolds No";
> equation
>   r = fluid.density;
>   m = fluid.viscosity;
>   q = inPort.flowrate;
>   z = lossFactor;
>   v = q / A;
>   Re = v * d / ( m / r);
>   dp = z * r/2 * v^2;//genericPressureLoss(z, v, r);
>   inPort.pressure = outPort.pressure + dp;
> end Conduit;
>
> model Nozzle          "also usable for broken (deburred) inlet opening" 
>   extends Conduit;
>   parameter Real inDiameter = 1e6; // "approximation of a broken (deburred) 
> inlet from ambience";
> protected
>   final parameter Real dI = inDiameter;
>   final parameter Real dO = referenceDiameter;
> //algorithm
> equation
> //  assert( dI < dO, "Inlet smaller than outlet!  Use a diffuser instead");
>   lossFactor = 1.04 - (dO/dI)^4; // loss factor includes the acceleration 
> work r/2 v^2
>                                // 0.04 is from VDI Wärematlas 7th issue
>                                // 0.05 from Dubbel 16th issue
> //  annotation (Documentation (info= "The nozzle is also a good
> //  approximation for deburred intakes z = 0.05, rounded intake: z = 0.005
> //  to 0.05, very sharp edged intakes: up to z = 0.5 (taken from VDI
> //  Wärmeatlas 7th issue)")); 
> end Nozzle;
>
> model Ambience
>   Port port;
> equation
>   port.pressure = ambientPressure;
> end Ambience;
>
> model PressureBoundary
>   parameter Real p = 4e5;
>   Port port;
> equation
>   port.pressure = p + ambientPressure;
> end PressureBoundary;
>
> model PumpStage
>   // TODO: leakage! TwoPorts is tight!
>   extends TwoPorts;
>   parameter Real V = 0.8054e-6        "0.8054e-6 VDO, 2.05e-6: GKN";
>   parameter Real s = 0.03e-3  "tooth gap";
>   parameter Real b = 6e-3     "Stage breadth";
>   parameter Real l = 0.4e-3   "effective tooth gap length";
>   parameter Real e0 = 0.975   "volumetric efficiency at '0 bar'";
> //protected
>   Real qt; // tooth leakage
>   Real n                      "revs";
>   Real m, dp, q, qq;
>   Real qqq;
> equation
>   m = fluid.viscosity;
>   n = time;
>   dp = outPort.pressure - inPort.pressure;
>   qt = b*s *  dp*s^2 / ( 12*m*l);
>   q = e0*V*n;
>   qq = q - qt;
>   qqq = qq / q;
>   inPort.flowrate = if q < qt then 0 else qq;
> end PumpStage;
>
> model Test
>   parameter Real pressure = ambientPressure;
>   inner Fluid fluid(viscosity = 3.3e-3, density = 850);
>   Nozzle nozzle;
>   Ambience ambience;
>   PressureBoundary pressureBC( p = pressure);
>   PumpStage pump;
> equation
>   connect( ambience.port, nozzle.inPort);
>   connect( nozzle.outPort, pump.inPort);
> //  connect(ambience.port, pump.inPort);
> //  connect( ambience.port, pump.inPort);
>   connect( pump.outPort, pressureBC.port);
> end Test;
> end Idiot;

Reply via email to