Switching the Mass or Volumeflow in MoSDH using any valve

56 Views Asked by At

I am currently working on a model using the MoSDH library in Modelica, specific in Dymola2023.

You can find the MoSDH Library on GitHub, here: https://github.com/MoSDH/MoSDH

I am currently experiencing an issue using the threeWayValves as they don't really seem to be able to have an impact on the volumeFlow.

I tried the threeWayValve as well as the threeWayValveMix in the "ExampleValve", which can be found under Components->Distribution, but the different control modes don't seem to have the influence i would expect.

Has anyone experience with using them and may explain to me how to use them?

I am really looking forward to any kind of input by now.

I am trying to use them as switches. Basically: if Scenario A open A and B and close C, elseif Scenario B open A and C and close B. But so far the valves never really restrict the volume flow at any point.

  if controlMode==Mode.closeA then
    flowPort_a.p=p+volFlowA/V_leakage*dp0;
    flowPort_b.p=p+volFlowB/V_flowNom*dpNom;
    flowPort_c.p=p+volFlowC/V_flowNom*dpNom;
  elseif controlMode==Mode.closeB then
    flowPort_a.p=p+volFlowA/V_leakage*dpNom;
    flowPort_b.p=p+volFlowB/V_flowNom*dp0;
    flowPort_c.p=p+volFlowC/V_flowNom*dpNom;
  elseif controlMode==Mode.closeC then
    flowPort_a.p=p+volFlowA/V_leakage*dpNom;
    flowPort_b.p=p+volFlowB/V_flowNom*dpNom;
    flowPort_c.p=p+volFlowC/V_flowNom*dp0;
  else
    flowPort_a.p=p+volFlowA/V_leakage*dpNom;
    flowPort_b.p=p+volFlowB/V_flowNom*dpNom;
    flowPort_c.p=p+volFlowC/V_flowNom*dpNom;
  end if;
1

There are 1 best solutions below

0
Clement44 On

I have looked at the threeWayValve.mo on GitHub, and it is actually a macro-component based on three regular control valves Modelica.Thermal.FluidHeatFlow.Components.Valve. The equation section deals with the openings:

  if controlMode==MoSDH.Utilities.Types.ValveOperationModes.ctrlAfreeC then
   valveA.y=max(0,min(1,controlSignalRef));
   valveB.y=max(0,min(1,1-controlSignalRef));
   valveC.y=1;
  elseif controlMode==MoSDH.Utilities.Types.ValveOperationModes.ctrlCfreeA then
   valveA.y=1;
   valveB.y=max(0,min(1,1-controlSignalRef));
   valveC.y=max(0,min(1,controlSignalRef));
  else
   valveA.y=1;
   valveB.y=1;
   valveC.y=1;
  end if;

My understanding is that with the first mode, your opening command is applied to valveA, while valveB gets the rest: That would be a three-way mixing valve (two inputs & one output) with flows through portA and portB nominally inwards.

The second mode is for the three-way diverting valve (one input & two outputs) with flows through portB and portC nominally outwards.

I am not sure that the third mode means anything, except that each valve is fully open.

As for your need for switches, would something like this work ?

  if controlMode==Mode.closeA then
   valveA.y=0;
   valveB.y=1;
   valveC.y=1;
  elseif controlMode==Mode.closeB then
   valveA.y=1;
   valveB.y=0;
   valveC.y=1;
  elseif controlMode==Mode.closeC then
   valveA.y=1;
   valveB.y=1;
   valveC.y=0;
  else
   valveA.y=1;
   valveB.y=1;
   valveC.y=1;
  end if;