public double Calculate(int id, UnitOpSystem unitOpSystem, Hashtable values) { string formula = (string)unitOpSystem.FormulaTable[id]; // the keys is needed to sort the keys in the hashmap // and start replacing the longer ids with the values in the formula ArrayList keys = new ArrayList(); IEnumerator e = values.GetEnumerator(); while (e.MoveNext()) { IDictionaryEnumerator de = (IDictionaryEnumerator)e.Current; keys.Add(de.Key); } keys.Sort(); // numbers in increasing order // replace the literals with their values for (int i = 0; i < keys.Count; i++) { int key = (int)keys[keys.Count - 1 - i]; double val = (double)values[key]; string keyStr = "v" + key.ToString(); string valStr = val.ToString(); formula = formula.Replace(keyStr, valStr); } // calculate the numerical expression return(ExpressionCalculator.CalculateExpression(formula)); }
public ArrayList GetIndependentVariables(int id, UnitOpSystem unitOpSystem) { string formula = (string)unitOpSystem.FormulaTable[id]; // get a list with indexes of v ArrayList vs = new ArrayList(); for (int i = 0; i < formula.Length; i++) { char c = formula[i]; if (c == 'v') { vs.Add(i); } } // for every index (v) find the id and put it on the list ArrayList ids = new ArrayList(); IEnumerator e = vs.GetEnumerator(); while (e.MoveNext()) { int idx = (int)e.Current; int identifier = this.GetId(idx, formula); ids.Add(identifier); } return(ids); }
//private double hLoss, hInput, cp, t1, t2, wb; //private double hLoss, hInput, h1, h2, wb; public Heater(string name, UnitOpSystem uoSys) : base(name, uoSys) { pressureDrop = new ProcessVarDouble(StringConstants.PRESSURE_DROP, PhysicalQuantity.Pressure, VarState.Specified, this); heatInput.Name = StringConstants.HEATING_DUTY; heatInput.Value = Constants.NO_VALUE; InitializeVarListAndRegisterVars(); }
public BagFilter(string name, UnitOpSystem uoSys) : base(name, uoSys) { bagDiameter = new ProcessVarDouble(StringConstants.BAG_DIAMETER, PhysicalQuantity.Length, VarState.Specified, this); bagLength = new ProcessVarDouble(StringConstants.BAG_LENGTH, PhysicalQuantity.Length, VarState.Specified, this); numberOfBags = new ProcessVarDouble(StringConstants.NUMBER_OF_BAGS, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, this); InitializeVarListAndRegisterVars(); }
public Ejector(string name, UnitOpSystem uoSys) : base(name, uoSys) { entrainmentRatio = new ProcessVarDouble(StringConstants.ENTRAINMENT_RATIO, PhysicalQuantity.Fraction, VarState.Specified, this); compressionRatio = new ProcessVarDouble(StringConstants.COMPRESSION_RATIO, PhysicalQuantity.Fraction, VarState.Specified, this); suctionMotivePressureRatio = new ProcessVarDouble(StringConstants.SUCTION_MOTIVE_PRESSURE_RATIO, PhysicalQuantity.Fraction, VarState.Specified, this); InitializeVarListAndRegisterVars(); }
public ElectrostaticPrecipitator(string name, UnitOpSystem uoSys) : base(name, uoSys) { balanceModel = new GasSolidSeparatorBalanceModel(this); driftVelocity = new ProcessVarDouble(StringConstants.DRIFT_VELOCITY, PhysicalQuantity.Velocity, VarState.Specified, this); totalSurfaceArea = new ProcessVarDouble(StringConstants.TOTAL_SURFACE_AREA, PhysicalQuantity.Area, VarState.AlwaysCalculated, this); InitializeVarListAndRegisterVars(); }
//public DryingStream(DryingSystem dryingSystem) : base(dryingSystem) { //} //public DryingStream(string name, UnitOperation upStreamOwner, UnitOperation downStreamOwner, DryingSystem dryingSystem) : base(name, upStreamOwner, downStreamOwner, dryingSystem) { protected DryingStream(string name, MaterialComponents mComponents, UnitOpSystem uoSys) : base(name, mComponents, uoSys) { massFlowRateDryBase = new ProcessVarDouble(StringConstants.MASS_FLOW_RATE_DRY, PhysicalQuantity.MassFlowRate, VarState.Specified, this); moistureContentDryBase = new ProcessVarDouble(StringConstants.MOISTURE_CONTENT_DRY, PhysicalQuantity.MoistureContent, VarState.Specified, this); moistureContentWetBase = new ProcessVarDouble(StringConstants.MOISTURE_CONTENT_WET, PhysicalQuantity.MoistureContent, VarState.Specified, this); specificHeatDryBase = new ProcessVarDouble(StringConstants.SPECIFIC_HEAT_DRY, PhysicalQuantity.SpecificHeat, VarState.Specified, this); specificEnthalpyDryBase = new ProcessVarDouble(StringConstants.SPECIFIC_ENTHALPY_DRY, PhysicalQuantity.SpecificHeat, VarState.Specified, this); specificHeatAbsDry = new ProcessVarDouble(StringConstants.SPECIFIC_HEAT_ABS_DRY, PhysicalQuantity.SpecificHeat, VarState.Specified, this); }
public Cyclone(string name, UnitOpSystem uoSys) : base(name, uoSys) { /*pressureDrop = new ProcessVarDouble(StringConstants.PRESSURE_DROP, PhysicalQuantity.Pressure, VarState.Specified, this); * collectionEfficiency = new ProcessVarDouble(StringConstants.COLLECTION_EFFICIENCY, PhysicalQuantity.Fraction, VarState.Specified, this); * inletParticleLoading = new ProcessVarDouble(StringConstants.INLET_PARTICLE_LOADING, PhysicalQuantity.MassVolumeConcentration, VarState.Specified, this); * outletParticleLoading = new ProcessVarDouble(StringConstants.OUTLET_PARTICLE_LOADING, PhysicalQuantity.MassVolumeConcentration, VarState.Specified, this); * massFlowRateOfParticleLostToGasOutlet = new ProcessVarDouble(StringConstants.PARTICLE_LOSS_TO_GAS_OUTLET, PhysicalQuantity.MassFlowRate, VarState.Specified, this); * InitializeVarListAndRegisterVars();*/ balanceModel = new GasSolidSeparatorBalanceModel(this); }
public Compressor(string name, UnitOpSystem uoSys) : base(name, uoSys) { compressionProcess = CompressionProcess.Adiabatic; pressureRatio = new ProcessVarDouble(StringConstants.PRESSURE_RATIO, PhysicalQuantity.Unknown, VarState.Specified, this); polytropicExponent = new ProcessVarDouble(StringConstants.POLYTROPIC_EXPONENT, PhysicalQuantity.Unknown, VarState.Specified, this); adiabaticExponent = new ProcessVarDouble(StringConstants.ADIABATIC_EXPONENT, PhysicalQuantity.Unknown, VarState.Specified, this); polytropicEfficiency = new ProcessVarDouble(StringConstants.POLYTROPIC_EFFICIENCY, PhysicalQuantity.Fraction, VarState.Specified, this); adiabaticEfficiency = new ProcessVarDouble(StringConstants.ADIABATIC_EFFICIENCY, PhysicalQuantity.Fraction, VarState.Specified, this); powerInput = new ProcessVarDouble(StringConstants.POWER_INPUT, PhysicalQuantity.Power, VarState.AlwaysCalculated, this); InitializeVarListAndRegisterVars(); }
public WetScrubber(string name, UnitOpSystem uoSys) : base(name, uoSys) { scrubberType = ScrubberType.Condensing; balanceModel = new GasSolidSeparatorBalanceModel(this); liquidToGasVolumeRatio = new ProcessVarDouble(StringConstants.LIQUID_GAS_RATIO, PhysicalQuantity.Unknown, VarState.Specified, this); liquidRecirculationMassFlowRate = new ProcessVarDouble(StringConstants.LIQUID_RECIRCULATION_MASS_FLOW_RATE, PhysicalQuantity.MassFlowRate, VarState.Specified, this); liquidRecirculationVolumeFlowRate = new ProcessVarDouble(StringConstants.LIQUID_RECIRCULATION_VOLUME_FLOW_RATE, PhysicalQuantity.VolumeFlowRate, VarState.Specified, this); InitializeVarListAndRegisterVars(); }
protected FabricFilter(string name, UnitOpSystem uoSys) : base(name, uoSys) { /*pressureDrop = new ProcessVarDouble(StringConstants.PRESSURE_DROP, PhysicalQuantity.Pressure, VarState.Specified, this); * collectionEfficiency = new ProcessVarDouble(StringConstants.COLLECTION_EFFICIENCY, PhysicalQuantity.Fraction, VarState.Specified, this); * inletDustLoading = new ProcessVarDouble(StringConstants.INLET_DUST_LOADING, PhysicalQuantity.MassVolumeConcentration, VarState.Specified, this); * outletDustLoading = new ProcessVarDouble(StringConstants.OUTLET_DUST_LOADING, PhysicalQuantity.MassVolumeConcentration, VarState.Specified, this); * dustAccumulationRate = new ProcessVarDouble(StringConstants.DUST_ACCUMULATION_RATE, PhysicalQuantity.MassFlowRate, VarState.AlwaysCalculated, this);*/ balanceModel = new GasSolidSeparatorBalanceModel(this); gasToClothRatio = new ProcessVarDouble(StringConstants.FILTRATION_VELOCITY, PhysicalQuantity.Velocity, VarState.Specified, this); totalFilteringArea = new ProcessVarDouble(StringConstants.TOTAL_FILTERING_AREA, PhysicalQuantity.Area, VarState.AlwaysCalculated, this); }
protected ProcessStreamBase(string name, MaterialComponents mComponents, UnitOpSystem uoSys) : base(name, uoSys) { this.materialComponents = mComponents; massFlowRate = new ProcessVarDouble(StringConstants.MASS_FLOW_RATE, PhysicalQuantity.MassFlowRate, VarState.Specified, this); volumeFlowRate = new ProcessVarDouble(StringConstants.VOLUME_FLOW_RATE, PhysicalQuantity.VolumeFlowRate, VarState.Specified, this); vaporFraction = new ProcessVarDouble(StringConstants.VAPOR_FRACTION, PhysicalQuantity.Fraction, VarState.Specified, this); pressure = new ProcessVarDouble(StringConstants.PRESSURE, PhysicalQuantity.Pressure, VarState.Specified, this); temperature = new ProcessVarDouble(StringConstants.TEMPERATURE, PhysicalQuantity.Temperature, VarState.Specified, this); specificEnthalpy = new ProcessVarDouble(StringConstants.SPECIFIC_ENTHALPY, PhysicalQuantity.SpecificEnergy, VarState.AlwaysCalculated, this); density = new ProcessVarDouble(StringConstants.DENSITY, PhysicalQuantity.Density, VarState.Specified, this); specificHeat = new ProcessVarDouble(StringConstants.SPECIFIC_HEAT, PhysicalQuantity.SpecificHeat, VarState.Specified, this); //specificVolume = new ProcessVarDouble(StringConstants.SPECIFIC_VOLUME, PhysicalQuantity.SpecificVolume, VarState.AlwaysCalculated, this); //dynamicViscosity = new ProcessVarDouble(StringConstants.DYNAMIC_VISCOSITY, PhysicalQuantity.DynamicViscosity, VarState.Specified, this); //thermalConductivity = new ProcessVarDouble(StringConstants.THERMAL_CONDUCTIVITY, PhysicalQuantity.ThermalConductivity, VarState.Specified, this); }
public Pump(string name, UnitOpSystem uoSys) : base(name, uoSys) { staticSuctionHead = new ProcessVarDouble(StringConstants.STATIC_SUCTION_HEAD, PhysicalQuantity.LiquidHead, VarState.Specified, this); suctionFrictionHead = new ProcessVarDouble(StringConstants.SUCTION_FRICTION_HEAD, PhysicalQuantity.LiquidHead, 0.0, VarState.Specified, this); staticDischargeHead = new ProcessVarDouble(StringConstants.STATIC_DICHARGE_HEAD, PhysicalQuantity.LiquidHead, VarState.Specified, this); dischargeFrictionHead = new ProcessVarDouble(StringConstants.DISCHARGE_FRICTION_HEAD, PhysicalQuantity.LiquidHead, 0.0, VarState.Specified, this); totalDynamicHead = new ProcessVarDouble(StringConstants.TOTAL_DYNAMIC_HEAD, PhysicalQuantity.LiquidHead, VarState.Specified, this); capacity = new ProcessVarDouble(StringConstants.CAPACITY, PhysicalQuantity.VolumeRateFlowLiquids, VarState.AlwaysCalculated, this); efficiency = new ProcessVarDouble(StringConstants.EFFICIENCY, PhysicalQuantity.Fraction, VarState.Specified, this); powerInput = new ProcessVarDouble(StringConstants.POWER_INPUT, PhysicalQuantity.Power, VarState.AlwaysCalculated, this); includeOutletVelocityEffect = true; outletDiameter = new ProcessVarDouble(StringConstants.OUTLET_DIAMETER, PhysicalQuantity.SmallLength, VarState.Specified, this); outletVelocity = new ProcessVarDouble(StringConstants.OUTLET_VELOCITY, PhysicalQuantity.Velocity, VarState.AlwaysCalculated, this); InitializeVarListAndRegisterVars(); }
public DryingGasStream(string name, MaterialComponents mComponents, UnitOpSystem uoSys) : base(name, mComponents, uoSys) { temperature.Name = StringConstants.DRY_BULB_TEMPERATURE; wetBulbTemperature = new ProcessVarDouble(StringConstants.WET_BULB_TEMPERATURE, PhysicalQuantity.Temperature, VarState.Specified, this); dewPoint = new ProcessVarDouble(StringConstants.DEW_POINT, PhysicalQuantity.Temperature, VarState.Specified, this); moistureContentDryBase.Name = StringConstants.HUMIDITY; relativeHumidity = new ProcessVarDouble(StringConstants.RELATIVE_HUMIDITY, PhysicalQuantity.Fraction, VarState.Specified, this); humidVolume = new ProcessVarDouble(StringConstants.HUMID_VOLUME, PhysicalQuantity.SpecificVolume, VarState.AlwaysCalculated, this); specificHeatDryBase.Name = StringConstants.HUMID_HEAT; specificEnthalpyDryBase.Name = StringConstants.HUMID_ENTHALPY; volumeFlowRate.Type = PhysicalQuantity.VolumeRateFlowGases; density.State = VarState.AlwaysCalculated; specificHeatDryBase.State = VarState.AlwaysCalculated; vaporFraction.Value = 1.0; InitializeVarListAndRegisterVars(); }
public Fan(string name, UnitOpSystem uoSys) : base(name, uoSys) { staticPressure = new ProcessVarDouble(StringConstants.STATIC_PRESSURE, PhysicalQuantity.Pressure, VarState.Specified, this); totalDischargePressure = new ProcessVarDouble(StringConstants.TOTAL_DISCHARGE_PRESSURE, PhysicalQuantity.Pressure, VarState.AlwaysCalculated, this); efficiency = new ProcessVarDouble(StringConstants.EFFICIENCY, PhysicalQuantity.Fraction, VarState.Specified, this); powerInput = new ProcessVarDouble(StringConstants.POWER_INPUT, PhysicalQuantity.Power, VarState.AlwaysCalculated, this); outletCrossSectionType = CrossSectionType.Circle; outletDiameter = new ProcessVarDouble(StringConstants.OUTLET_DIAMETER, PhysicalQuantity.SmallLength, VarState.Specified, this); outletWidth = new ProcessVarDouble(StringConstants.WIDTH, PhysicalQuantity.SmallLength, VarState.Specified, this); outletHeight = new ProcessVarDouble(StringConstants.HEIGHT, PhysicalQuantity.SmallLength, VarState.Specified, this); outletHeightWidthRatio = new ProcessVarDouble(StringConstants.HEIGHT_WIDTH_RATIO, PhysicalQuantity.Unknown, VarState.Specified, this); includeOutletVelocityEffect = true; outletVelocity = new ProcessVarDouble(StringConstants.OUTLET_VELOCITY, PhysicalQuantity.Velocity, VarState.AlwaysCalculated, this); //outletGeometry = new CrossSectionGeometry(this); InitializeVarListAndRegisterVars(); }
public Tee(string name, UnitOpSystem uoSys) : base(name, uoSys) { }
public FlashTank(string name, UnitOpSystem uoSys) : base(name, uoSys) { }
//public ProcessStream(DryingSystem dryingSystem) : base(dryingSystem) { //} //public ProcessStream(string name, DryingSystem dryingSystem) : base(name, dryingSystem) { public ProcessStream(string name, MaterialComponents mComponents, UnitOpSystem uoSys) : base(name, mComponents, uoSys) { InitializeVarListAndRegisterVars(); }
public Heater(string name, UnitOpSystem uoSys) : base(name, uoSys) { pressureDrop = new ProcessVarDouble(StringConstants.PRESSURE_DROP, PhysicalQuantity.Pressure, VarState.Specified, this); heatInput.Value = Constants.NO_VALUE; Init(); }
//public Dryer(string name, ProcessType processType, UnitOpSystem uoSys) : base(name, uoSys) public LiquidDryer(string name, UnitOpSystem uoSys) : base(name, uoSys) { dryerType = LiquidDryerType.Unknown; }
public PsychrometricChartModel(string name, DryingGasStream input, DryingGasStream output, DryingGasStream current, UnitOpSystem uoSys) : base(name, uoSys) { this.inputStream = input; inputStream.DownStreamOwner = this; this.outputStream = output; outputStream.UpStreamOwner = this; pressure = new ProcessVarDouble(StringConstants.PRESSURE, PhysicalQuantity.Pressure, 1.0132685e5, VarState.Specified, this); this.currentStream = current; currentStream.DownStreamOwner = this; inputStream.Pressure = pressure; outputStream.Pressure = pressure; currentStream.Pressure = pressure; ProcessVarDouble dryBulbTemp = new ProcessVarDouble(StringConstants.DRY_BULB_TEMPERATURE, PhysicalQuantity.Temperature, 293.15, VarState.Specified, this); xVar = new PlotVariable(dryBulbTemp, 283.15, 373.15); ProcessVarDouble humidity = new ProcessVarDouble(StringConstants.HUMIDITY, PhysicalQuantity.MoistureContent, 0.1, VarState.Specified, this); yVar = new PlotVariable(humidity, 0.0, 0.3); GenerateHumidityChartData(); inletStreams.Add(inputStream); outletStreams.Add(outputStream); InitializeStreams(); this.hcType = HCType.ChartOnly; }
public AirFilter(string name, UnitOpSystem uoSys) : base(name, uoSys) { InitializeVarListAndRegisterVars(); }
public Recycle(string name, UnitOpSystem uoSys) : base(name, uoSys) { solvingPriority = 2000; }
public DryingMaterialStream(string name, MaterialComponents mComponents, MaterialStateType materialStateType, UnitOpSystem uoSys) : base(name, mComponents, uoSys) { this.materialStateType = materialStateType; massConcentration = new ProcessVarDouble(StringConstants.MASS_CONCENTRATION, PhysicalQuantity.MoistureContent, VarState.Specified, this); if (materialStateType == MaterialStateType.Liquid) { volumeFlowRate.Type = PhysicalQuantity.VolumeRateFlowLiquids; specificHeatAbsDry.Enabled = false; } else if (materialStateType == MaterialStateType.Solid) { pressure.Enabled = false; vaporFraction.Enabled = false; massConcentration.Enabled = false; } InitializeVarListAndRegisterVars(); }
public Mixer(string name, UnitOpSystem uoSys) : base(name, uoSys) { }
public Adjust(string name, UnitOpSystem uoSys) : base(name, uoSys) { }
public Valve(string name, UnitOpSystem uoSys) : base(name, uoSys) { pressureDrop = new ProcessVarDouble(StringConstants.PRESSURE_DROP, PhysicalQuantity.Pressure, VarState.Specified, this); InitializeVarListAndRegisterVars(); }