private void ScrubberCondenser_StreamDetached(UnitOperation uo, ProcessStreamBase ps) { this.UpdateStreamsUI(); }
internal virtual bool DoDetach(ProcessStreamBase ps) { return(true); }
protected virtual void DeleteConnection(UnitOperation uo, ProcessStreamBase ps) { this.flowsheet.ConnectionManager.RemoveConnections(ps.Name, uo.Name); }
private void Dryer_StreamDetached(UnitOperation uo, ProcessStreamBase ps) { this.UpdateStreamsUI(); }
public virtual bool CanAttachStream(ProcessStreamBase ps, int streamIndex) { return(true); }
//implement interface IGasSolidSeparator public double CalculateParticleLoading(ProcessStreamBase psb) { DryingGasStream stream = psb as DryingGasStream; return(balanceModel.CalculateParticleLoading(stream)); }
protected override void DeleteConnection(UnitOperation uo, ProcessStreamBase ps) { this.flowsheet.ConnectionManager.RemoveUnitOpConnections(uo.Name); this.RecreateAllConnections(); this.DoThePaint(); }
private void EvaporationAndDryingSystem_StreamAdded(ProcessStreamBase processStream) { this.UpdateStreamsUI(); }
private void UpdateStreamsUI() { // clear the streams boxes and start again //this.groupBoxMixtureFluid.Controls.Clear(); //this.groupBoxParticle.Controls.Clear(); Cyclone cyclone = this.CycloneCtrl.Cyclone; bool hasGasIn = false; bool hasGasOut = false; bool hasParticleOut = false; ProcessStreamBase mixtureIn = cyclone.GasInlet; if (mixtureIn != null) { hasGasIn = true; } ProcessStreamBase fluidOut = cyclone.GasOutlet; if (fluidOut != null) { hasGasOut = true; } ProcessStreamBase particleOut = cyclone.ParticleOutlet; if (particleOut != null) { hasParticleOut = true; } //if (hasGasIn || hasGasOut) //{ // ProcessStreamBase labelsStream = null; // if (hasGasIn) // labelsStream = mixtureIn; // else if (hasGasOut) // labelsStream = fluidOut; // UserControl ctrl = null; // if (labelsStream is ProcessStream) // { // ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream); // } // else if (labelsStream is DryingGasStream) // { // ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); // } // this.groupBoxMixtureFluid.Controls.Add(ctrl); // ctrl.Location = new Point(4, 12 + 20 + 2); //} if (hasGasIn) { ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name); initializeGrid(processInCtrl, columnIndex, false, "Gas Inlet/Outlet"); columnIndex += 2; // UserControl ctrl = null; //if (mixtureIn is ProcessStream) //{ // ProcessStreamControl processInCtrl = (ProcessStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name); // ctrl = new ProcessStreamValuesControl(processInCtrl); //} //else if (mixtureIn is DryingGasStream) //{ // GasStreamControl gasInCtrl = (GasStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name); // ctrl = new GasStreamValuesControl(gasInCtrl); //} //this.groupBoxMixtureFluid.Controls.Add(ctrl); //ctrl.Location = new Point(196, 12 + 20 + 2); //this.textBoxGasInName.SetSolvable(cyclone.GasInlet); //this.groupBoxMixtureFluid.Controls.Add(this.textBoxGasInName); //this.textBoxGasInName.Text = cyclone.GasInlet.Name; //UI.SetStatusColor(this.textBoxGasInName, cyclone.GasInlet.SolveState); } if (hasGasOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name); initializeGrid(processOutCtrl, columnIndex, true, "Gas Inlet/Outlet"); columnIndex++; //UserControl ctrl = null; //if (fluidOut is ProcessStream) //{ // ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name); // ctrl = new ProcessStreamValuesControl(processOutCtrl); //} //else if (fluidOut is DryingGasStream) //{ // GasStreamControl gasOutCtrl = (GasStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name); // ctrl = new GasStreamValuesControl(gasOutCtrl); //} //this.groupBoxMixtureFluid.Controls.Add(ctrl); //ctrl.Location = new Point(276, 12 + 20 + 2); //this.textBoxGasOutName.SetSolvable(cyclone.GasOutlet); //this.groupBoxMixtureFluid.Controls.Add(this.textBoxGasOutName); //this.textBoxGasOutName.Text = cyclone.GasOutlet.Name; //UI.SetStatusColor(this.textBoxGasOutName, cyclone.GasOutlet.SolveState); } if (hasParticleOut) { ProcessStreamBaseControl particalOutCtrl = (ProcessStreamBaseControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name); initializeGrid(particalOutCtrl, columnIndex, false, "Particle Outlet"); columnIndex += 2; //// add the labels //UserControl ctrl = null; //if (particleOut is ProcessStream) //{ // ctrl = new ProcessStreamLabelsControl((ProcessStream)particleOut); //} //else if (particleOut is DryingMaterialStream) //{ // ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)particleOut); //} //this.groupBoxParticle.Controls.Add(ctrl); //ctrl.Location = new Point(4, 12 + 20 + 2); //// add the values //ctrl = null; //if (particleOut is ProcessStream) //{ // ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name); // ctrl = new ProcessStreamValuesControl(processOutCtrl); //} //else if (particleOut is DryingMaterialStream) //{ // MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name); // ctrl = new MaterialStreamValuesControl(matOutCtrl); //} //this.groupBoxParticle.Controls.Add(ctrl); //ctrl.Location = new Point(196, 12 + 20 + 2); //this.textBoxParticleOutName.SetSolvable(cyclone.ParticleOutlet); //this.groupBoxParticle.Controls.Add(this.textBoxParticleOutName); //this.textBoxParticleOutName.Text = cyclone.ParticleOutlet.Name; //UI.SetStatusColor(this.textBoxParticleOutName, cyclone.ParticleOutlet.SolveState); } }
private void Tee_StreamDetached(UnitOperation uo, ProcessStreamBase ps) { this.UpdateTheUI(); }
private void UpdateTheUI() { this.panel.Visible = false; this.userCtrlFractions.Visible = false; this.userCtrlFractions.Controls.Clear(); this.groupBoxStreams.Visible = false; this.groupBoxStreams.Controls.Clear(); this.outletControls.Clear(); int x = INITIAL_LOCATION; int w = VALUE_WIDTH; int s = INITIAL_GROUPBOX_WIDTH; int p = INITIAL_FORM_WIDTH; Tee tee = this.TeeCtrl.Tee; bool hasStreamIn = false; bool hasStreamOut = false; ProcessStreamBase streamOut = null; if (tee.OutletStreams.Count > 0) { hasStreamOut = true; streamOut = (ProcessStreamBase)tee.OutletStreams[0]; this.userCtrlFractions.Visible = true; } ProcessStreamBase streamIn = tee.Inlet; if (streamIn != null) { hasStreamIn = true; } if (hasStreamIn || hasStreamOut) { this.groupBoxStreams.Visible = true; ProcessStreamBase labelsStream = null; if (hasStreamIn) { labelsStream = streamIn; } else if (hasStreamOut) { labelsStream = streamOut; } UserControl ctrl = null; if (labelsStream is ProcessStream) { ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } else if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } ctrl.Location = new Point(4, 12 + 20 + 2); this.groupBoxStreams.Size = new Size(s, this.groupBoxHeight); this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24); this.groupBoxStreams.Controls.Add(ctrl); s = s + w; p = p + w; } if (hasStreamIn) { UserControl ctrl = null; if (streamIn is ProcessStream) { ProcessStreamControl processInCtrl = (ProcessStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name); ctrl = new ProcessStreamValuesControl(processInCtrl); } else if (streamIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } else if (streamIn is DryingMaterialStream) { MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name); ctrl = new MaterialStreamValuesControl(materialInCtrl); } ctrl.Location = new Point(x, 12 + 20 + 2); this.groupBoxStreams.Size = new Size(s, this.groupBoxHeight); this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24); this.groupBoxStreams.Controls.Add(ctrl); this.Size = new Size(p, this.formHeight); this.textBoxStreamInName.Text = streamIn.Name; this.textBoxStreamInName.Location = new Point(x, 12); this.textBoxStreamInName.SetSolvable(streamIn); this.groupBoxStreams.Controls.Add(this.textBoxStreamInName); UI.SetStatusColor(this.textBoxStreamInName, streamIn.SolveState); } if (hasStreamOut) { IEnumerator e = tee.OutletStreams.GetEnumerator(); while (e.MoveNext()) { s = s + w; x = x + w; p = p + w; ProcessStreamBase processStreamBase = (ProcessStreamBase)e.Current; UserControl ctrl = null; if (processStreamBase is ProcessStream) { ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name); ctrl = new ProcessStreamValuesControl(processOutCtrl); } else if (processStreamBase is DryingGasStream) { GasStreamControl gasOutCtrl = (GasStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name); ctrl = new GasStreamValuesControl(gasOutCtrl); } else if (processStreamBase is DryingMaterialStream) { MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name); ctrl = new MaterialStreamValuesControl(materialOutCtrl); } ctrl.Location = new Point(x, 12 + 20 + 2); this.groupBoxStreams.Size = new Size(s, this.groupBoxHeight); this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24); this.groupBoxStreams.Controls.Add(ctrl); this.Size = new Size(p, this.formHeight); ProsimoUI.SolvableNameTextBox textBoxStreamOutName = new ProsimoUI.SolvableNameTextBox(processStreamBase); textBoxStreamOutName.Width = 80; textBoxStreamOutName.Height = 20; textBoxStreamOutName.Text = processStreamBase.Name; textBoxStreamOutName.Location = new Point(x, 12); this.outletControls.Add(textBoxStreamOutName, textBoxStreamOutName.Text); this.groupBoxStreams.Controls.Add(textBoxStreamOutName); UI.SetStatusColor(textBoxStreamOutName, processStreamBase.SolveState); } // build the fractions for (int i = 0; i < this.TeeCtrl.Tee.OutletStreamAndFractions.Count; i++) { StreamAndFraction sf = (StreamAndFraction)this.TeeCtrl.Tee.OutletStreamAndFractions[i]; TeeStreamAndFractionControl sfCtrl = new TeeStreamAndFractionControl(this.TeeCtrl.Flowsheet, sf); sfCtrl.Location = new Point(0, i * sfCtrl.Height); this.userCtrlFractions.Controls.Add(sfCtrl); sfCtrl.textBoxFraction.KeyUp += new KeyEventHandler(KeyUpNavigator); } } this.Size = new Size(p + this.groupBoxFractions.Width, this.formHeight); this.panel.Visible = true; }
private void Tee_StreamAttached(UnitOperation uo, ProcessStreamBase ps, int desc) { this.UpdateTheUI(); }
public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad) { //StreamType streamType = StreamType.Unknown; //if (ps is DryingGasStream) { // streamType = StreamType.Gas; //} //else if (ps is ProcessStream) { // streamType = StreamType.Process; //} //else if (ps is DryingMaterialStream) { // streamType = StreamType.Material; //} ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps); SolvableConnection conn = null; if (ad == TwoStreamUnitOperation.INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = TwoStreamUnitOperation.INLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetStreamInConnectionPoint(); PointOrientation uoOrientation = TwoStreamUnitOpControl.INLET_ORIENTATION; // adjust for Recycle if (uo is Recycle) { uoOrientation = RecycleControl.INLET_ORIENTATION; } ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } else if (ad == TwoStreamUnitOperation.OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = TwoStreamUnitOperation.OUTLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetStreamOutConnectionPoint(); PointOrientation uoOrientation = TwoStreamUnitOpControl.OUTLET_ORIENTATION; // adjust for Recycle if (uo is Recycle) { uoOrientation = RecycleControl.OUTLET_ORIENTATION; } ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } if (conn != null) { //this.flowsheet.ConnectionManager.DrawConnection(conn); this.flowsheet.ConnectionManager.AddConnection(conn); //this.flowsheet.ConnectionManager.Connections.Add(conn); //this.flowsheet.ConnectionManager.DrawConnections(); } return(conn); }
private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxGasInletOutlet.Controls.Clear(); this.groupBoxLiquidOutlet.Controls.Clear(); this.groupBoxWaterInletOutlet.Controls.Clear(); ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser; bool hasGasIn = false; bool hasGasOut = false; bool hasLiquidOut = false; bool hasWaterIn = false; bool hasWaterOut = false; ProcessStreamBase gasIn = scrubberCondenser.GasInlet; hasGasIn = gasIn != null; ProcessStreamBase gasOut = scrubberCondenser.GasOutlet; hasGasOut = gasOut != null; ProcessStreamBase liquidOut = scrubberCondenser.LiquidOutlet; hasLiquidOut = liquidOut != null; ProcessStreamBase waterIn = scrubberCondenser.WaterInlet; hasWaterIn = waterIn != null; ProcessStreamBase waterOut = scrubberCondenser.WaterOutlet; hasWaterOut = waterOut != null; if (hasGasIn || hasGasOut) { ProcessStreamBase labelsStream = hasGasIn ? gasIn : gasOut; //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); UserControl ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasGasIn) { ProcessStreamBaseControl gasInCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasInlet.Name); //UserControl ctrl = new ProcessVarValuesControl(gasInCtrl); UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasInCtrl); this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxGasInName.SetSolvable(scrubberCondenser.GasInlet); this.groupBoxGasInletOutlet.Controls.Add(this.textBoxGasInName); this.textBoxGasInName.Text = scrubberCondenser.GasInlet.Name; UI.SetStatusColor(this.textBoxGasInName, scrubberCondenser.GasInlet.SolveState); } if (hasGasOut) { ProcessStreamBaseControl gasOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name); //UserControl ctrl = new ProcessVarValuesControl(gasOutCtrl); UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasOutCtrl); this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxGasOutName.SetSolvable(scrubberCondenser.GasOutlet); this.groupBoxGasInletOutlet.Controls.Add(this.textBoxGasOutName); this.textBoxGasOutName.Text = scrubberCondenser.GasOutlet.Name; UI.SetStatusColor(this.textBoxGasOutName, scrubberCondenser.GasOutlet.SolveState); } if (hasLiquidOut) { // add the labels //UserControl ctrl = new ProcessVarLabelsControl(liquidOut.VarList); UserControl ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)liquidOut); this.groupBoxLiquidOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); ProcessStreamBaseControl matOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.LiquidOutlet.Name); //ctrl = new ProcessVarValuesControl(matOutCtrl); ctrl = new MaterialStreamValuesControl((MaterialStreamControl)matOutCtrl); this.groupBoxLiquidOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxLiquidOutName.SetSolvable(scrubberCondenser.LiquidOutlet); this.groupBoxLiquidOutlet.Controls.Add(this.textBoxLiquidOutName); this.textBoxLiquidOutName.Text = scrubberCondenser.LiquidOutlet.Name; UI.SetStatusColor(this.textBoxLiquidOutName, scrubberCondenser.LiquidOutlet.SolveState); } if (hasWaterIn || hasWaterOut) { UserControl ctrl = null; ProcessStreamBase labelsStream = hasWaterIn ? waterIn : waterOut; if (waterIn is WaterStream) { ctrl = new ProcessVarLabelsControl(labelsStream.VarList); } else if (waterIn is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } this.groupBoxWaterInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasWaterIn) { UserControl ctrl = null; ProcessStreamBaseControl waterInCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.WaterInlet.Name); if (waterIn is WaterStream) { ctrl = new ProcessVarValuesControl(waterInCtrl); } else if (waterIn is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)waterInCtrl); } this.groupBoxWaterInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxWaterInName.SetSolvable(scrubberCondenser.WaterInlet); this.groupBoxWaterInletOutlet.Controls.Add(this.textBoxWaterInName); this.textBoxWaterInName.Text = scrubberCondenser.WaterInlet.Name; UI.SetStatusColor(this.textBoxWaterInName, scrubberCondenser.WaterInlet.SolveState); } if (hasWaterOut) { UserControl ctrl = null; ProcessStreamBaseControl waterOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.WaterOutlet.Name); if (waterOut is WaterStream) { ctrl = new ProcessVarValuesControl(waterOutCtrl); } else if (waterOut is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)waterOutCtrl); } this.groupBoxWaterInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxWaterOutName.SetSolvable(scrubberCondenser.WaterOutlet); this.groupBoxWaterInletOutlet.Controls.Add(this.textBoxWaterOutName); this.textBoxWaterOutName.Text = scrubberCondenser.WaterOutlet.Name; UI.SetStatusColor(this.textBoxWaterOutName, scrubberCondenser.WaterOutlet.SolveState); } }
private void UpdateStreamUI() { //this.panel.Visible = false; //this.groupBox.Visible = false; //this.groupBox.Controls.Clear(); //this.inletControls.Clear(); //int x = INITIAL_LOCATION; //int w = VALUE_WIDTH; //int s = INITIAL_GROUPBOX_WIDTH; //int p = INITIAL_FORM_WIDTH; Mixer mixer = this.MixerCtrl.Mixer; bool hasStreamIn = false; bool hasStreamOut = false; ProcessStreamBase streamIn = null; if (mixer.InletStreams.Count > 0) { hasStreamIn = true; streamIn = (ProcessStreamBase)mixer.InletStreams[0]; } ProcessStreamBase streamOut = mixer.Outlet; Boolean bFirstControl = true; if (streamOut != null) { hasStreamOut = true; } if (hasStreamIn) { IEnumerator e = mixer.InletStreams.GetEnumerator(); while (e.MoveNext()) { ProcessStreamBase processStreamBase = (ProcessStreamBase)e.Current; ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name); if (bFirstControl) { initializeGrid(processInCtrl, columnIndex, false, "Inlet/Outlet"); columnIndex += 2; bFirstControl = false; } else { initializeGrid(processInCtrl, columnIndex, true, "Inlet/Outlet"); columnIndex++; } //this.groupBox.Controls.Add(textBoxStreamInName); //UI.SetStatusColor(textBoxStreamInName, processStreamBase.SolveState); } } if (hasStreamOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name); if (bFirstControl) { initializeGrid(processOutCtrl, columnIndex, false, "Inlet/Outlet"); columnIndex += 2; bFirstControl = false; } else { initializeGrid(processOutCtrl, columnIndex, true, "Inlet/Outlet"); columnIndex++; } //UserControl ctrl = null; // if (streamOut is ProcessStream)) // { // ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name); //ctrl = new ProcessStreamValuesControl(processOutCtrl); // } // else if (streamOut is DryingGasStream) // { // GasStreamControl gasOutCtrl = (GasStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name); // ctrl = new GasStreamValuesControl(gasOutCtrl); // } // else if (streamOut is DryingMaterialStream) // { // MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name); // ctrl = new MaterialStreamValuesControl(materialOutCtrl); // } // ctrl.Location = new Point(x, 12 + 20 + 2); // this.groupBox.Size = new Size(s, this.groupBoxHeight); // this.groupBox.Controls.Add(ctrl); // this.Size = new Size(p, this.formHeight); // textBoxStreamOutName.Text = streamOut.Name; // textBoxStreamOutName.Location = new Point(x, 12); // this.textBoxStreamOutName.SetSolvable(streamOut); // this.groupBox.Controls.Add(this.textBoxStreamOutName); //UI.SetStatusColor(this.statusBar, streamOut.BSolveState); } //this.panel.Visible = true; }
public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad) { StreamType streamType = StreamType.Unknown; if (ps is DryingGasStream) { streamType = StreamType.Gas; } else if (ps is ProcessStream) { streamType = StreamType.Process; } else if (ps is DryingMaterialStream) { streamType = StreamType.Material; } ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps); SolvableConnection conn = null; if (ad == FlashTank.INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = FlashTank.INLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetInConnectionPoint(); PointOrientation uoOrientation = FlashTankControl.INLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } else if (ad == FlashTank.VAPOR_OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = FlashTank.VAPOR_OUTLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetVaporOutConnectionPoint(); PointOrientation uoOrientation = FlashTankControl.VAPOR_OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } else if (ad == FlashTank.LIQUID_OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = FlashTank.LIQUID_OUTLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetLiquidOutConnectionPoint(); PointOrientation uoOrientation = FlashTankControl.LIQUID_OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } if (conn != null) { this.flowsheet.ConnectionManager.AddConnection(conn); //this.flowsheet.ConnectionManager.Connections.Add(conn); //this.flowsheet.ConnectionManager.DrawConnections(); } return(conn); }
private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxMotiveSuction.Controls.Clear(); this.groupBoxDischarge.Controls.Clear(); Ejector ejector = this.EjectorCtrl.Ejector; bool hasMotiveIn = false; bool hasSuctionIn = false; bool hasDischargeOut = false; ProcessStreamBase motiveIn = ejector.MotiveInlet; if (motiveIn != null) { hasMotiveIn = true; } ProcessStreamBase suctionIn = ejector.SuctionInlet; if (suctionIn != null) { hasSuctionIn = true; } ProcessStreamBase dischargeOut = ejector.DischargeOutlet; if (dischargeOut != null) { hasDischargeOut = true; } if (hasMotiveIn || hasSuctionIn) { ProcessStreamBase labelsStream = null; if (hasMotiveIn) { labelsStream = motiveIn; } else if (hasSuctionIn) { labelsStream = suctionIn; } UserControl ctrl = null; if (labelsStream is ProcessStream) { ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } else if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasMotiveIn) { UserControl ctrl = null; if (motiveIn is ProcessStream) { ProcessStreamControl processInCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); ctrl = new ProcessStreamValuesControl(processInCtrl); } else if (motiveIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } else if (motiveIn is DryingMaterialStream) { MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); ctrl = new MaterialStreamValuesControl(materialInCtrl); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxMotiveInName.SetSolvable(ejector.MotiveInlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxMotiveInName); this.textBoxMotiveInName.Text = ejector.MotiveInlet.Name; UI.SetStatusColor(this.textBoxMotiveInName, ejector.MotiveInlet.SolveState); } if (hasSuctionIn) { UserControl ctrl = null; if (suctionIn is ProcessStream) { ProcessStreamControl processInCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); ctrl = new ProcessStreamValuesControl(processInCtrl); } else if (suctionIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } else if (suctionIn is DryingMaterialStream) { MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); ctrl = new MaterialStreamValuesControl(materialInCtrl); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxSuctionInName.SetSolvable(ejector.SuctionInlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxSuctionInName); this.textBoxSuctionInName.Text = ejector.SuctionInlet.Name; UI.SetStatusColor(this.textBoxSuctionInName, ejector.SuctionInlet.SolveState); } if (hasDischargeOut) { // add the labels UserControl ctrl = null; if (dischargeOut is ProcessStream) { ctrl = new ProcessStreamLabelsControl((ProcessStream)dischargeOut); } else if (dischargeOut is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)dischargeOut); } else if (dischargeOut is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)dischargeOut); } this.groupBoxDischarge.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); // add the values ctrl = null; if (dischargeOut is ProcessStream) { ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); ctrl = new ProcessStreamValuesControl(processOutCtrl); } else if (dischargeOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); ctrl = new MaterialStreamValuesControl(matOutCtrl); } else if (dischargeOut is DryingGasStream) { GasStreamControl gasOutCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); ctrl = new GasStreamValuesControl(gasOutCtrl); } this.groupBoxDischarge.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxDischargeOutName.SetSolvable(ejector.DischargeOutlet); this.groupBoxDischarge.Controls.Add(this.textBoxDischargeOutName); this.textBoxDischargeOutName.Text = ejector.DischargeOutlet.Name; UI.SetStatusColor(this.textBoxDischargeOutName, ejector.DischargeOutlet.SolveState); } }
public virtual void CreateConnection(UnitOperation uo, ProcessStreamBase ps, int desc) { }
public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad) { StreamType streamType = StreamType.Unknown; if (ps is DryingGasStream) { streamType = StreamType.Gas; } else if (ps is ProcessStream) { streamType = StreamType.Process; } else if (ps is DryingMaterialStream) { streamType = StreamType.Material; } ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps); SolvableConnection conn = null; if (ad > 0) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = ad; string uoName = this.Solvable.Name; Point uoPoint = this.GetStreamOutConnectionPoint(ad, uo.OutletStreams.Count); PointOrientation uoOrientation = TeeControl.OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } else if (ad == Tee.INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = Tee.INLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetStreamInConnectionPoint(); PointOrientation uoOrientation = TeeControl.INLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } if (conn != null) { //this.flowsheet.ConnectionManager.Connections.Add(conn); //this.flowsheet.ConnectionManager.UpdateConnections(this); //this.flowsheet.ConnectionManager.DrawConnections(); this.flowsheet.ConnectionManager.AddConnection(conn); this.DoThePaint(); } return(conn); }
private void UnitOperation_StreamDetached(UnitOperation uo, ProcessStreamBase ps) { this.DeleteConnection(uo, ps); }
private void Dryer_StreamAttached(UnitOperation uo, ProcessStreamBase ps, int desc) { this.UpdateStreamsUI(); }
private void UpdateStreamsUI() { Tee tee = this.TeeCtrl.Tee; bool hasStreamIn = false; bool hasStreamOut = false; ProcessStreamBase streamOut = null; if (tee.OutletStreams.Count > 0) { hasStreamOut = true; streamOut = (ProcessStreamBase)tee.OutletStreams[0]; //this.userCtrlFractions.Visible = true; } ProcessStreamBase streamIn = tee.Inlet; if (streamIn != null) { hasStreamIn = true; } if (hasStreamIn) { ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name); initializeGrid(processInCtrl, columnIndex, false, "Inlet/Outlets"); columnIndex += 2; } if (hasStreamOut) { Boolean bFirstControl = true; if (hasStreamIn) { bFirstControl = false; } IEnumerator e = tee.OutletStreams.GetEnumerator(); while (e.MoveNext()) { ProcessStreamBase processStreamBase = (ProcessStreamBase)e.Current; ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name); if (bFirstControl) { initializeGrid(processOutCtrl, columnIndex, false, "Inlet/Outlets"); columnIndex += 2; bFirstControl = false; } else { initializeGrid(processOutCtrl, columnIndex, true, "Inlet/Outlets"); columnIndex++; } //this.groupBoxStreams.Controls.Add(textBoxStreamOutName); //UI.SetStatusColor(this,statusBar, processStreamBase.SolveState); } // build the fractions for (int i = 0; i < this.TeeCtrl.Tee.OutletStreamAndFractions.Count; i++) { StreamAndFraction sf = (StreamAndFraction)this.TeeCtrl.Tee.OutletStreamAndFractions[i]; TeeStreamAndFractionControl sfCtrl = new TeeStreamAndFractionControl(this.TeeCtrl.Flowsheet, sf); //sfCtrl.Location = new Point(0, i*sfCtrl.Height); //this.userCtrlFractions.Controls.Add(sfCtrl); //sfCtrl.textBoxFraction.KeyUp += new KeyEventHandler(KeyUpNavigator); } } }
protected override void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxStreams.Controls.Clear(); BagFilter bagFilter = this.BagFilterCtrl.BagFilter; bool hasStreamIn = false; bool hasStreamOut = false; bool hasParticleOut = false; ProcessStreamBase streamIn = bagFilter.GasInlet; hasStreamIn = streamIn != null; ProcessStreamBase streamOut = bagFilter.GasOutlet; hasStreamOut = streamOut != null; ProcessStreamBase particleOut = bagFilter.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); } //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); this.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasStreamIn && streamIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.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 = bagFilter.Inlet.Name; UI.SetStatusColor(this.textBoxStreamInName, bagFilter.Inlet.SolveState); } if (hasStreamOut && streamOut is DryingGasStream) { ProcessStreamBaseControl baseControl = this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.GasOutlet.Name); GasStreamControl gasOutCtrl = (GasStreamControl)this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.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 = bagFilter.Outlet.Name; UI.SetStatusColor(this.textBoxStreamOutName, bagFilter.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.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.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(bagFilter.ParticleOutlet); this.groupBoxParticle.Controls.Add(this.textBoxParticleOutName); this.textBoxParticleOutName.Text = bagFilter.ParticleOutlet.Name; UI.SetStatusColor(this.textBoxParticleOutName, bagFilter.ParticleOutlet.SolveState); } }
public override void CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad) { StreamType streamType = StreamType.Unknown; if (ps is DryingGasStream) { streamType = StreamType.Gas; } else if (ps is ProcessStream) { streamType = StreamType.Process; } else if (ps is DryingMaterialStream) { streamType = StreamType.Material; } ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps); SolvableConnection conn = null; if (ad == Ejector.MOTIVE_INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = Ejector.MOTIVE_INLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetMotiveInConnectionPoint(); PointOrientation uoOrientation = EjectorControl.MOTIVE_INLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } else if (ad == Ejector.SUCTION_INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = Ejector.SUCTION_INLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetSuctionInConnectionPoint(); PointOrientation uoOrientation = EjectorControl.SUCTION_INLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } else if (ad == Ejector.DISCHARGE_OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = Ejector.DISCHARGE_OUTLET_INDEX; string uoName = this.Solvable.Name; Point uoPoint = this.GetDischargeOutConnectionPoint(); PointOrientation uoOrientation = EjectorControl.DISCHARGE_OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType); } if (conn != null) { this.flowsheet.ConnectionManager.Connections.Add(conn); this.flowsheet.ConnectionManager.DrawConnections(); } }
internal virtual bool DoAttach(ProcessStreamBase ps, int streamIndex) { return(true); }
public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad) { ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps); SolvableConnection conn = null; if (ad == ScrubberCondenser.GAS_INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = ScrubberCondenser.GAS_INLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetGasInConnectionPoint(); PointOrientation uoOrientation = ScrubberCondenserControl.GAS_INLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } else if (ad == ScrubberCondenser.GAS_OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = ScrubberCondenser.GAS_OUTLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetGasOutConnectionPoint(); PointOrientation uoOrientation = ScrubberCondenserControl.GAS_OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } else if (ad == ScrubberCondenser.LIQUID_OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = ScrubberCondenser.LIQUID_OUTLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetLiquidOutConnectionPoint(); PointOrientation uoOrientation = ScrubberCondenserControl.LIQUID_OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } else if (ad == ScrubberCondenser.WATER_INLET_INDEX) { int strIdx = ProcessStreamBaseControl.OUT_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetOutConnectionPoint(); PointOrientation strOrientation = ctrl.OutOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = ScrubberCondenser.WATER_INLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetWaterInConnectionPoint(); PointOrientation uoOrientation = ScrubberCondenserControl.WATER_INLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } else if (ad == ScrubberCondenser.WATER_OUTLET_INDEX) { int strIdx = ProcessStreamBaseControl.IN_INDEX; string strName = ctrl.Solvable.Name; Point strPoint = ctrl.GetInConnectionPoint(); PointOrientation strOrientation = ctrl.InOrientation; ConnectionPoint strConnPoint = new ConnectionPoint(strIdx, strName, strPoint, strOrientation); int uoIdx = ScrubberCondenser.WATER_OUTLET_INDEX; string uoName = this.solvable.Name; Point uoPoint = this.GetWaterOutConnectionPoint(); PointOrientation uoOrientation = ScrubberCondenserControl.WATER_OUTLET_ORIENTATION; ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation); conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType()); } if (conn != null) { this.flowsheet.ConnectionManager.AddConnection(conn); //this.flowsheet.ConnectionManager.Connections.Add(conn); //this.flowsheet.ConnectionManager.DrawConnections(); } return(conn); }
public virtual SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int desc) { return(null); }
public StreamAndFraction(ProcessStreamBase stream, Solvable owner) { this.stream = stream; this.fraction = new ProcessVarDouble(stream.Name + "Fraction", PhysicalQuantity.Fraction, VarState.Specified, owner); }
private void UnitOperation_StreamAttached(UnitOperation uo, ProcessStreamBase ps, int desc) { this.CreateConnection(uo, ps, desc); }
private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxMixtureFluid.Controls.Clear(); this.groupBoxParticle.Controls.Clear(); Cyclone cyclone = this.CycloneCtrl.Cyclone; bool hasGasIn = false; bool hasGasOut = false; bool hasParticleOut = false; ProcessStreamBase mixtureIn = cyclone.GasInlet; hasGasIn = mixtureIn != null; ProcessStreamBase fluidOut = cyclone.GasOutlet; hasGasOut = fluidOut != null; ProcessStreamBase particleOut = cyclone.ParticleOutlet; if (particleOut != null) { hasParticleOut = true; } if (hasGasIn || hasGasOut) { ProcessStreamBase labelsStream = hasGasIn ? mixtureIn : fluidOut; UserControl ctrl = null; //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } this.groupBoxMixtureFluid.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasGasIn) { ProcessStreamBaseControl gasInCtrl = this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name); //UserControl ctrl = new ProcessVarValuesControl(gasInCtrl); UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasInCtrl); this.groupBoxMixtureFluid.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxGasInName.SetSolvable(cyclone.GasInlet); this.groupBoxMixtureFluid.Controls.Add(this.textBoxGasInName); this.textBoxGasInName.Text = cyclone.GasInlet.Name; UI.SetStatusColor(this.textBoxGasInName, cyclone.GasInlet.SolveState); } if (hasGasOut) { ProcessStreamBaseControl gasOutCtrl = this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name); //UserControl ctrl = new ProcessVarValuesControl(gasOutCtrl); UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasOutCtrl); this.groupBoxMixtureFluid.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxGasOutName.SetSolvable(cyclone.GasOutlet); this.groupBoxMixtureFluid.Controls.Add(this.textBoxGasOutName); this.textBoxGasOutName.Text = cyclone.GasOutlet.Name; UI.SetStatusColor(this.textBoxGasOutName, cyclone.GasOutlet.SolveState); } if (hasParticleOut) { // add the labels UserControl ctrl = null; if (particleOut is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)particleOut); //ctrl = new ProcessVarLabelsControl(particleOut.VarList); } this.groupBoxParticle.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); // add the values ProcessStreamBaseControl matOutCtrl = this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name); if (particleOut is DryingMaterialStream) { //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(cyclone.ParticleOutlet); this.groupBoxParticle.Controls.Add(this.textBoxParticleOutName); this.textBoxParticleOutName.Text = cyclone.ParticleOutlet.Name; UI.SetStatusColor(this.textBoxParticleOutName, cyclone.ParticleOutlet.SolveState); } }