Buildings.Media.PerfectGases.MoistAir.Utilities

utility functions

Package Content

NameDescription
Buildings.Media.PerfectGases.MoistAir.Utilities.spliceFunction spliceFunction  
Buildings.Media.PerfectGases.MoistAir.Utilities.spliceFunction_der spliceFunction_der  


Buildings.Media.PerfectGases.MoistAir.Utilities.spliceFunction

Inputs

TypeNameDefaultDescription
Realpos  
Realneg  
Realx  
Realdeltax1 

Outputs

TypeNameDescription
Realout 

Modelica definition

function spliceFunction 
  annotation(derivative=spliceFunction_der);  
    input Real pos;
    input Real neg;
    input Real x;
    input Real deltax=1;
    output Real out;
protected 
    Real scaledX;
    Real scaledX1;
    Real y;
algorithm 
    scaledX1 := x/deltax;
    scaledX := scaledX1*Modelica.Math.asin(1);
    if scaledX1 <= -0.999999999 then
      y := 0;
    elseif scaledX1 >= 0.999999999 then
      y := 1;
    else
      y := (Modelica.Math.tanh(Modelica.Math.tan(scaledX)) + 1)/2;
    end if;
    out := pos*y + (1 - y)*neg;
end spliceFunction;

Buildings.Media.PerfectGases.MoistAir.Utilities.spliceFunction_der

Inputs

TypeNameDefaultDescription
Realpos  
Realneg  
Realx  
Realdeltax1 
Realdpos  
Realdneg  
Realdx  
Realddeltax0 

Outputs

TypeNameDescription
Realout 

Modelica definition

function spliceFunction_der 
    input Real pos;
    input Real neg;
    input Real x;
    input Real deltax=1;
    input Real dpos;
    input Real dneg;
    input Real dx;
    input Real ddeltax=0;
    output Real out;
protected 
    Real scaledX;
    Real scaledX1;
    Real dscaledX1;
    Real y;
algorithm 
    scaledX1 := x/deltax;
    scaledX := scaledX1*Modelica.Math.asin(1);
    dscaledX1 := (dx - scaledX1*ddeltax)/deltax;
    if scaledX1 <= -0.99999999999 then
      y := 0;
    elseif scaledX1 >= 0.9999999999 then
      y := 1;
    else
      y := (Modelica.Math.tanh(Modelica.Math.tan(scaledX)) + 1)/2;
    end if;
    out := dpos*y + (1 - y)*dneg;
    if (abs(scaledX1) < 1) then
      out := out + (pos - neg)*dscaledX1*Modelica.Math.asin(1)/2/(
        Modelica.Math.cosh(Modelica.Math.tan(scaledX))*Modelica.Math.cos(
        scaledX))^2;
    end if;
end spliceFunction_der;

HTML-documentation generated by Dymola Tue May 27 12:39:50 2008.