Name | Description |
---|---|
spliceFunction | |
spliceFunction_der |
Type | Name | Default | Description |
---|---|---|---|
Real | pos | ||
Real | neg | ||
Real | x | ||
Real | deltax | 1 |
Type | Name | Description |
---|---|---|
Real | out |
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;
Type | Name | Default | Description |
---|---|---|---|
Real | pos | ||
Real | neg | ||
Real | x | ||
Real | deltax | 1 | |
Real | dpos | ||
Real | dneg | ||
Real | dx | ||
Real | ddeltax | 0 |
Type | Name | Description |
---|---|---|
Real | out |
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;