Start value problem in der() function of medium - Modelica

alimuradpashaalimuradpasha Member
edited October 26 in Systems

I am modeling with Modelica in Ansys Twin builder. I encounter with an initialization error when I compile the code, although I give initialization values. Error is as follows;

Iteration variable "der(Hochdrucktank.medium.h)" is missing start value!

Iteration variable "der(Niederdrucktank.medium.h)" is missing start value!

Iteration variable "der(Swept1.medium.p)" is missing start value!

The code is as follows;

Iteration variable "der(Swept1.medium.p)" is missing start value!

model Hochdruckreiniger2
    Real dummyStart_V_hochdrucktank(start=0);
    Real dummyStart_V_niederdrucktank(start=0);
    Real dummyStart_h_sweptvolume(start=0);
    Real dummyStart2(start=0);
    Real dummyStart3(start=0);
    //Component(s)
    Modelica.Fluid.Machines.SweptVolume Swept1 (
        pistonCrossArea = 0.0001131,
        clearance = 0.000002,
        portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
        0.1),Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
        0.1)},
        redeclare package Medium = Modelica.Media.Water.StandardWater,
        nPorts = 2,
        use_portsData = true,
        p_start = 100,
        use_T_start = true;
    inner Modelica.Fluid.System system;
    Modelica.Fluid.Vessels.OpenTank Niederdrucktank (
        redeclare package Medium = Modelica.Media.Water.StandardWater,
        nPorts = 1,
        height = 40.84,
        crossArea = 10,
        portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
        0.1)},
        h_start = 100,
        V(start = 10));
    Modelica.Fluid.Vessels.OpenTank Hochdrucktank (
        redeclare package Medium = Modelica.Media.Water.StandardWater,
        nPorts = 1,
        height = 4997,
        crossArea = 10,
        portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
        0.1)},
        h_start = 100,
        V(start = 100));
    Modelica.Mechanics.Translational.Sources.Position Posit1 (exact = true);
    Modelica.Fluid.Valves.ValveIncompressible Hochdruckventile (
        dp_nominal = 66.6175,
        m_flow_nominal = 0.04873,
        rho_nominal = 1019.921,
        opening = opening_HP,
        redeclare package Medium = Modelica.Media.Water.StandardWater);
    Modelica.Fluid.Valves.ValveIncompressible Niederdruckventile (
        dp_nominal = 65.21,
        m_flow_nominal = 0.04873,
        rho_nominal = 998.388,
        opening = opening_NP,
        redeclare package Medium = Modelica.Media.Water.StandardWater);
    Modelica.Blocks.Sources.Sine Sine1 (amplitude = 0.000000629669, freqHz = 46.6666, offset = 0.00000313588);


equation
    T_per=pi/(180*3600*N/60);//Radian  
        f=((V_max-V_tod)/2)*sin((2*pi*time*T_per)+(V_tod+(V_max-V_tod)/2));
          if der(f)>=0 then
            opening_NP=1;
            opening_HP=0;
           else
            opening_NP=0;
            opening_HP=1;
          end if;
    dummyStart_V_hochdrucktank=der(Hochdrucktank.V);
    dummyStart_V_niederdrucktank=der(Niederdrucktank.V);
    dummyStart2=der(Hochdrucktank.medium.h);
    dummyStart3=der(Niederdrucktank.medium.h);
    dummyStart_h_sweptvolume=der(Swept1.medium.p);
    //Connection(s)
    connect(Posit1.flange, Swept1.flange);
    connect(Hochdrucktank.ports[1], Hochdruckventile.port_a);
    connect(Hochdruckventile.port_b, Swept1.ports[2]);
    connect(Niederdrucktank.ports[1], Niederdruckventile.port_a);
    connect(Niederdruckventile.port_b, Swept1.ports[1]);
    connect(Sine1.y, Posit1.s_ref);
end  Hochdruckreiniger2;

Do you know how to solve this problem? Thanks for your helps in advance!

Best Answer

Answers

  • Inside Twin Builder, you can access Modelica examples for the different libraries, you can view the diagram and Modelica text. Also, as a general rule, it is always a good practice to start building systems from simple to more complex in incremental steps, that can help in identifying problems.

    Unfortunately, a full answer to this question is beyond the scope of Ansys employees. Hopefully another member can help you.

Sign In or Register to comment.