Exemple #1
0
        public float convertColUnit(float val0, QuantityType srcUnits, QuantityType dstUnits)
        {
            float val  = val0;
            float tm   = 0;
            float flow = 0;

            if (dstUnits == srcUnits)
            {
                return(val);
            }

            flow = fu + fl;
            tm   = vc / flow;

            if (model == ModelType.Transport)
            {
                if (srcUnits == QuantityType.Steps && dstUnits == QuantityType.Volume)
                {
                    val *= (vc / column);
                    return(val);
                }
                else if (srcUnits == QuantityType.Volume && dstUnits == QuantityType.Steps)
                {
                    val *= (column / vc);
                    return(val);
                }

                // x -> time
                switch (srcUnits)
                {
                case QuantityType.Steps:
                    val *= (tm / column);
                    break;

                case QuantityType.Volume:
                    val /= flow;
                    break;
                }
                // time -> y
                switch (dstUnits)
                {
                case QuantityType.Steps:
                    val /= (tm / column);
                    break;

                case QuantityType.Volume:
                    val *= flow;
                    break;

                case QuantityType.Column:
                    val /= tm;
                    break;

                case QuantityType.ReS:
                    val = Equations.calcK(kDefinition, vu, vl, fu, fl, val * flow);
                    break;
                }
            }
            else
            {
                // x -> vol
                switch (srcUnits)
                {
                case QuantityType.Steps:
                    val *= (vc / column);
                    break;

                case QuantityType.Time:
                    val *= flow;
                    break;
                }
                // vol -> y
                switch (dstUnits)
                {
                case QuantityType.Steps:
                    val /= (vc / column);
                    break;

                case QuantityType.Time:
                    val /= flow;
                    break;

                case QuantityType.Column:
                    val /= vc;
                    break;

                case QuantityType.ReS:
                    val = Equations.calcK(kDefinition, vu, vl, fu, fl, val);
                    break;
                }
            }
            return(val);
        }
Exemple #2
0
        public float convertUnit(float val0, QuantityType srcUnits, QuantityType dstUnits, PhaseType phase)
        {
            float val  = val0;
            float vm0  = 0;
            float vm   = 0;
            float tm   = 0;
            float flow = 0;

            if (dstUnits == srcUnits)
            {
                return(val);
            }

            if (phase == PhaseType.Upper || phase == PhaseType.Both || runMode == RunModeType.CoCurrent)
            {
                vm0  += vu;
                vm   += vu * fnormu;
                flow += fu;
                if (fu != 0)
                {
                    tm += vu / fu;
                }
            }
            if (phase == PhaseType.Lower || phase == PhaseType.Both || runMode == RunModeType.CoCurrent)
            {
                vm0  += vl;
                vm   += vl * fnorml;
                flow += fl;
                if (fl != 0)
                {
                    tm += vl / fl;
                }
            }

            if (model == ModelType.Transport)
            {
                if (runMode == RunModeType.CoCurrent)
                {
                    tm = Tmnorm;
                }
                // x -> time
                switch (srcUnits)
                {
                case QuantityType.Steps:
                    val *= (tm / column);
                    break;

                case QuantityType.Volume:
                    val /= flow;
                    break;
                }
                tm = Tmnorm;
                // time -> y
                switch (dstUnits)
                {
                case QuantityType.Steps:
                    val /= (tm / column);
                    break;

                case QuantityType.Volume:
                    val *= flow;
                    break;

                case QuantityType.Column:
                    val /= tm;
                    break;

                case QuantityType.ReS:
                    val = Equations.calcK(kDefinition, vu, vl, fu, fl, val * flow);
                    break;
                }
            }
            else
            {
                // x -> vol
                switch (srcUnits)
                {
                case QuantityType.Steps:
                    val *= (vm / column);
                    break;

                case QuantityType.Time:
                    val *= flow;
                    break;
                }
                // vol -> y
                switch (dstUnits)
                {
                case QuantityType.Steps:
                    val /= (vm / column);
                    break;

                case QuantityType.Time:
                    val /= flow;
                    break;

                case QuantityType.Column:
                    val /= vm0;
                    break;

                case QuantityType.ReS:
                    val = Equations.calcK(kDefinition, vu, vl, fu, fl, val);
                    break;
                }
            }
            return(val);
        }