Example #1
0
        public Variable CreateVariable(string name, string subscript, string description, PhysicalDimension type)
        {
            var variable = new Variable(name, 0);

            variable.InternalUnit = _internal.UnitDictionary[type];
            variable.InputUnit    = _input.UnitDictionary[type];
            variable.OutputUnit   = _output.UnitDictionary[type];
            variable.Dimension    = type;
            variable.Description  = description;
            variable.Subscript    = subscript;

            switch (type)
            {
            case PhysicalDimension.Temperature:
                variable.ValueInSI  = 273.15;
                variable.LowerBound = _temperatureLowerBound;
                variable.UpperBound = _temperatureUpperBound;
                break;

            case PhysicalDimension.Pressure:
                variable.ValueInSI  = 1e5;
                variable.LowerBound = _pressureLowerBound;
                variable.UpperBound = _pressureUpperBound;
                break;

            case PhysicalDimension.MassDensity:
            case PhysicalDimension.MolarDensity:
            case PhysicalDimension.MolarFlow:
            case PhysicalDimension.MassFlow:
            case PhysicalDimension.Area:
            case PhysicalDimension.Volume:
                variable.LowerBound = 0;
                variable.UpperBound = 1e20;
                break;

            case PhysicalDimension.VolumeFlow:
                variable.LowerBound = 0;
                variable.UpperBound = 1e6;
                break;

            case PhysicalDimension.MolarVolume:
                variable.LowerBound = 0;
                variable.UpperBound = 1e6;
                break;

            case PhysicalDimension.HeatTransferCoefficient:
                variable.LowerBound = 1e-6;
                variable.UpperBound = 1e6;
                break;


            case PhysicalDimension.MolarFraction:
            case PhysicalDimension.MassFraction:
                variable.LowerBound = 0;
                variable.UpperBound = 1;
                break;
            }

            return(variable);
        }
Example #2
0
 public Variable CreateVariable(string name, string description, PhysicalDimension type)
 {
     return(CreateVariable(name, "", description, type));
 }
Example #3
0
 public void SetOutputDimension(PhysicalDimension type, Unit unit)
 {
     SetDimension(_output, type, unit);
 }
Example #4
0
 void SetDimension(UnitSet set, PhysicalDimension type, Unit unit)
 {
     set.UnitDictionary[type] = unit;
 }
Example #5
0
 public void SetInputDimension(PhysicalDimension type, Unit unit)
 {
     SetDimension(_input, type, unit);
 }