public ElectrostaticPrecipitatorEditor(ElectrostaticPrecipitatorControl electrostaticPrecipitatorCtrl) : base(electrostaticPrecipitatorCtrl) { // // Required for Windows Form Designer support // InitializeComponent(); this.UpdateStreamsUI(); ElectrostaticPrecipitator electrostaticPrecipitator = this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator; this.Text = "Electrostatic Precipitator: " + electrostaticPrecipitator.Name; this.groupBoxUnitOpVars.Location = new System.Drawing.Point(644, 24); this.groupBoxUnitOpVars.Size = new System.Drawing.Size(280, 260); this.groupBoxUnitOpVars.Controls.Clear(); this.groupBoxUnitOpVars.Text = "Electrostatic Precipitator"; ProcessVarLabelsControl electrostaticPrecipitatorLabelsCtrl = new ProcessVarLabelsControl(this.solvableCtrl.Solvable.VarList); this.groupBoxUnitOpVars.Controls.Add(electrostaticPrecipitatorLabelsCtrl); electrostaticPrecipitatorLabelsCtrl.Location = new Point(4, 12 + 20 + 2); ProcessVarValuesControl electrostaticPrecipitatorValuesCtrl = new ProcessVarValuesControl(this.solvableCtrl); this.groupBoxUnitOpVars.Controls.Add(electrostaticPrecipitatorValuesCtrl); electrostaticPrecipitatorValuesCtrl.Location = new Point(196, 12 + 20 + 2); }
public ElectrostaticPrecipitatorControl(Flowsheet flowsheet, Point location, ElectrostaticPrecipitator electrostaticPrecipitator) : base(flowsheet, location, electrostaticPrecipitator) { InitializeComponent(); this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H); UI.SetStatusColor(this, this.ElectrostaticPrecipitator.SolveState); this.UpdateBackImage(); }
public void InitializeVariableLabels(ElectrostaticPrecipitator uo) { this.labelPressureDrop.InitializeVariable(uo.GasPressureDrop); this.labelCollectionEfficiency.InitializeVariable(uo.CollectionEfficiency); this.labelInletParticleLoading.InitializeVariable(uo.InletParticleLoading); this.labelOutletParticleLoading.InitializeVariable(uo.OutletParticleLoading); this.labelParticleCollectionRate.InitializeVariable(uo.ParticleCollectionRate); this.labelMassFlowRateOfParticleLostToGasOutlet.InitializeVariable(uo.MassFlowRateOfParticleLostToGasOutlet); this.labelDriftVelocity.InitializeVariable(uo.DriftVelocity); this.labelTotalSurfaceArea.InitializeVariable(uo.TotalSurfaceArea); }
public ElectrostaticPrecipitatorEditor(ElectrostaticPrecipitatorControl electrostaticPrecipitatorCtrl) : base(electrostaticPrecipitatorCtrl) { // // Required for Windows Form Designer support // //InitializeComponent(); ElectrostaticPrecipitator electrostaticPrecipitator = this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator; this.Text = "Electrostatic Precipitator: " + electrostaticPrecipitator.Name; //this.groupBoxTwoStreamUnitOp.Size = new System.Drawing.Size(280, 200); //this.groupBoxTwoStreamUnitOp.Text = "Electrostatic Precipitator"; //ElectrostaticPrecipitatorLabelsControl electrostaticPrecipitatorLabelsCtrl = new ElectrostaticPrecipitatorLabelsControl(this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator); //this.groupBoxTwoStreamUnitOp.Controls.Add(electrostaticPrecipitatorLabelsCtrl); //electrostaticPrecipitatorLabelsCtrl.Location = new Point(4, 12 + 20 + 2); //ElectrostaticPrecipitatorValuesControl electrostaticPrecipitatorValuesCtrl = new ElectrostaticPrecipitatorValuesControl(this.ElectrostaticPrecipitatorCtrl); //this.groupBoxTwoStreamUnitOp.Controls.Add(electrostaticPrecipitatorValuesCtrl); //electrostaticPrecipitatorValuesCtrl.Location = new Point(196, 12 + 20 + 2); initializeGrid(electrostaticPrecipitatorCtrl, columnIndex, false, "Electrostatic Precipitator"); }
private Flowsheet SetFlowsheetContent(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList items, string flowsheetName) { Flowsheet flowsheet = null; IEnumerator e = items.GetEnumerator(); while (e.MoveNext()) { object obj = e.Current; if (obj is EvaporationAndDryingSystem) { EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj; persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData() persisted.SetObjectData(); flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted); } else if (obj is GasStreamControl) { GasStreamControl persistedCtrl = (GasStreamControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); DryingGasStream stream = flowsheet.EvaporationAndDryingSystem.GetGasStream(solvableName); GasStreamControl newCtrl = new GasStreamControl(flowsheet, new Point(0, 0), stream); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is MaterialStreamControl) { MaterialStreamControl persistedCtrl = (MaterialStreamControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); DryingMaterialStream stream = flowsheet.EvaporationAndDryingSystem.GetMaterialStream(solvableName); MaterialStreamControl newCtrl = new MaterialStreamControl(flowsheet, new Point(0, 0), stream); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is DryerControl) { DryerControl persistedCtrl = (DryerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Dryer uo = flowsheet.EvaporationAndDryingSystem.GetDryer(solvableName); DryerControl newCtrl = new DryerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is HeatExchangerControl) { HeatExchangerControl persistedCtrl = (HeatExchangerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); HeatExchanger uo = flowsheet.EvaporationAndDryingSystem.GetHeatExchanger(solvableName); HeatExchangerControl newCtrl = new HeatExchangerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is CycloneControl) { CycloneControl persistedCtrl = (CycloneControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Cyclone uo = flowsheet.EvaporationAndDryingSystem.GetCyclone(solvableName); CycloneControl newCtrl = new CycloneControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is EjectorControl) { EjectorControl persistedCtrl = (EjectorControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Ejector uo = flowsheet.EvaporationAndDryingSystem.GetEjector(solvableName); EjectorControl newCtrl = new EjectorControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is WetScrubberControl) { WetScrubberControl persistedCtrl = (WetScrubberControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); WetScrubber uo = flowsheet.EvaporationAndDryingSystem.GetWetScrubber(solvableName); WetScrubberControl newCtrl = new WetScrubberControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is ScrubberCondenserControl) { ScrubberCondenserControl persistedCtrl = (ScrubberCondenserControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); ScrubberCondenser uo = flowsheet.EvaporationAndDryingSystem.GetScrubberCondenser(solvableName); ScrubberCondenserControl newCtrl = new ScrubberCondenserControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is MixerControl) { MixerControl persistedCtrl = (MixerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Mixer uo = flowsheet.EvaporationAndDryingSystem.GetMixer(solvableName); MixerControl newCtrl = new MixerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is TeeControl) { TeeControl persistedCtrl = (TeeControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Tee uo = flowsheet.EvaporationAndDryingSystem.GetTee(solvableName); TeeControl newCtrl = new TeeControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is FlashTankControl) { FlashTankControl persistedCtrl = (FlashTankControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); FlashTank uo = flowsheet.EvaporationAndDryingSystem.GetFlashTank(solvableName); FlashTankControl newCtrl = new FlashTankControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is FanControl) { FanControl persistedCtrl = (FanControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Fan uo = flowsheet.EvaporationAndDryingSystem.GetFan(solvableName); FanControl newCtrl = new FanControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is ValveControl) { ValveControl persistedCtrl = (ValveControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Valve uo = flowsheet.EvaporationAndDryingSystem.GetValve(solvableName); ValveControl newCtrl = new ValveControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is BagFilterControl) { BagFilterControl persistedCtrl = (BagFilterControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); BagFilter uo = flowsheet.EvaporationAndDryingSystem.GetBagFilter(solvableName); BagFilterControl newCtrl = new BagFilterControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is AirFilterControl) { AirFilterControl persistedCtrl = (AirFilterControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); AirFilter uo = flowsheet.EvaporationAndDryingSystem.GetAirFilter(solvableName); AirFilterControl newCtrl = new AirFilterControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is CompressorControl) { CompressorControl persistedCtrl = (CompressorControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Compressor uo = flowsheet.EvaporationAndDryingSystem.GetCompressor(solvableName); CompressorControl newCtrl = new CompressorControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is HeaterControl) { HeaterControl persistedCtrl = (HeaterControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Heater uo = flowsheet.EvaporationAndDryingSystem.GetHeater(solvableName); HeaterControl newCtrl = new HeaterControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is CoolerControl) { CoolerControl persistedCtrl = (CoolerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Cooler uo = flowsheet.EvaporationAndDryingSystem.GetCooler(solvableName); CoolerControl newCtrl = new CoolerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is ElectrostaticPrecipitatorControl) { ElectrostaticPrecipitatorControl persistedCtrl = (ElectrostaticPrecipitatorControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); ElectrostaticPrecipitator uo = flowsheet.EvaporationAndDryingSystem.GetElectrostaticPrecipitator(solvableName); ElectrostaticPrecipitatorControl newCtrl = new ElectrostaticPrecipitatorControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is PumpControl) { PumpControl persistedCtrl = (PumpControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Pump uo = flowsheet.EvaporationAndDryingSystem.GetPump(solvableName); PumpControl newCtrl = new PumpControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is RecycleControl) { RecycleControl persistedCtrl = (RecycleControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Recycle uo = flowsheet.EvaporationAndDryingSystem.GetRecycle(solvableName); RecycleControl newCtrl = new RecycleControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is SolvableConnection) { SolvableConnection persistedDc = (SolvableConnection)obj; SolvableConnection dc = new SolvableConnection(flowsheet); dc.SetObjectData(persistedDc.SerializationInfo, persistedDc.StreamingContext); flowsheet.ConnectionManager.Connections.Add(dc); } else if (obj is FlowsheetPreferences) { FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences; flowsheetPrefs.SetObjectData(flowsheetPrefs.SerializationInfo, flowsheetPrefs.StreamingContext); flowsheet.BackColor = flowsheetPrefs.BackColor; } else if (obj is ProsimoUI.CustomEditor.CustomEditor) { ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj; flowsheet.CustomEditor.SetObjectData(persistedEditor.SerializationInfo, persistedEditor.StreamingContext); } } if (this.CheckFlowsheetVersion(items, flowsheet)) { flowsheet.IsDirty = false; } else { flowsheet = null; } return(flowsheet); }
public ElectrostaticPrecipitatorControl(Flowsheet flowsheet, Point location, ElectrostaticPrecipitator electrostaticPrecipitator) : base(flowsheet, location, electrostaticPrecipitator) { }
public ElectrostaticPrecipitatorLabelsControl(ElectrostaticPrecipitator uo) : this() { this.InitializeVariableLabels(uo); }
protected override void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxStreams.Controls.Clear(); ElectrostaticPrecipitator electrostaticPrecipitator = this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator; bool hasStreamIn = false; bool hasStreamOut = false; bool hasParticleOut = false; ProcessStreamBase streamIn = electrostaticPrecipitator.GasInlet; hasStreamIn = streamIn != null; ProcessStreamBase streamOut = electrostaticPrecipitator.GasOutlet; hasStreamOut = streamOut != null; ProcessStreamBase particleOut = electrostaticPrecipitator.ParticleOutlet; if (particleOut != null) { hasParticleOut = true; } if (hasStreamIn || hasStreamOut) { ProcessStreamBase labelsStream = hasStreamIn ? streamIn : streamOut; UserControl ctrl = null; if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } this.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasStreamIn && streamIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.ElectrostaticPrecipitatorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator.GasInlet.Name); UserControl ctrl = new GasStreamValuesControl(gasInCtrl); this.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxStreamInName.SetSolvable(streamIn); this.groupBoxStreams.Controls.Add(this.textBoxStreamInName); this.textBoxStreamInName.Text = electrostaticPrecipitator.Inlet.Name; UI.SetStatusColor(this.textBoxStreamInName, electrostaticPrecipitator.Inlet.SolveState); } if (hasStreamOut && streamOut is DryingGasStream) { ProcessStreamBaseControl baseControl = this.ElectrostaticPrecipitatorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator.GasOutlet.Name); GasStreamControl gasOutCtrl = (GasStreamControl)this.ElectrostaticPrecipitatorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator.GasOutlet.Name); UserControl ctrl = new GasStreamValuesControl(gasOutCtrl); this.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxStreamOutName.SetSolvable(streamOut); this.groupBoxStreams.Controls.Add(this.textBoxStreamOutName); this.textBoxStreamOutName.Text = electrostaticPrecipitator.Outlet.Name; UI.SetStatusColor(this.textBoxStreamOutName, electrostaticPrecipitator.Outlet.SolveState); } if (hasParticleOut && particleOut is DryingMaterialStream) { // add the labels UserControl ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)particleOut); this.groupBoxParticle.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); // add the values ProcessStreamBaseControl matOutCtrl = this.ElectrostaticPrecipitatorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ElectrostaticPrecipitatorCtrl.ElectrostaticPrecipitator.ParticleOutlet.Name); //ctrl = new ProcessVarValuesControl(matOutCtrl); ctrl = new MaterialStreamValuesControl((MaterialStreamControl)matOutCtrl); this.groupBoxParticle.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxParticleOutName.SetSolvable(electrostaticPrecipitator.ParticleOutlet); this.groupBoxParticle.Controls.Add(this.textBoxParticleOutName); this.textBoxParticleOutName.Text = electrostaticPrecipitator.ParticleOutlet.Name; UI.SetStatusColor(this.textBoxParticleOutName, electrostaticPrecipitator.ParticleOutlet.SolveState); } }