This function returns a value between 1 and 0. A smooth transition is achieved by means of defining the position
and the transition intervall from start
to stop
parameter. Outside this intervall, the 1 and the 0 are returned, respectively. This transition function with up to two smooth derivatives was taken from [1]. If you provide an order
higher than 2, the generalised logistic function[2] will be used to calculated the transition curve.
tFactor
= smooth transition between 0 and 1 from start
to stop
[-]
Use tFactor
in an equation like this:
tFactor = transition_factor(start=start,stop=stop,position=position); smoothed = tFactor*1stValue + (1 - tFactor)*2ndValue;
[1] Christoph C Richter, Proposal of New Object-Oriented Equation-Based Model Libraries for Thermodynamic Systems, PhD thesis, Technical University Carolo-Wilhelmina Braunschweig, 2008
[2] Generalised logistic function on Wikipedia
Implemented in 2012 for Technical University of Denmark, DTU Mechanical Engineering, Kongens Lyngby, Denmark by Jorrit Wronski (jowr@mek.dtu.dk)
function transition_factor extends Modelica.Icons.Function; import Modelica.Constants.pi; import Modelica.Constants.e; input Real start = 0.25 "start of transition interval"; input Real stop = 0.75 "end of transition interval"; input Real position = 0.0 "current position"; input Integer order = 2 "Smooth up to which derivative?"; output Real tFactor "weighting factor"; end transition_factor;