protected override void ValidatingHandler(object sender, System.ComponentModel.CancelEventArgs e) { HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger; TextBox tb = (TextBox)sender; if (tb.Text != null) { if (tb.Text.Trim().Equals("")) { if (sender == this.textBoxName) { e.Cancel = true; string message3 = "Please specify a name!"; MessageBox.Show(message3, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { if (sender == this.textBoxName) { ErrorMessage error = heatExchanger.SpecifyName(this.textBoxName.Text); if (error != null) { UI.ShowError(error); } } } } }
public HXRatingModelPlateAndFrame(HeatExchanger heatExchanger) : base(heatExchanger) { channelWidth = new ProcessVarDouble(StringConstants.CHANNEL_WIDTH, PhysicalQuantity.Length, 0.63, VarState.Specified, heatExchanger); projectedChannelLength = new ProcessVarDouble(StringConstants.PROJECTED_CHANNEL_LENGTH, PhysicalQuantity.Length, 1.55, VarState.Specified, heatExchanger); enlargementFactor = new ProcessVarDouble(StringConstants.ENLARGEMENT_FACTOR, PhysicalQuantity.Unknown, 1.25, VarState.Specified, heatExchanger); projectedPlateArea = new ProcessVarDouble(StringConstants.PROJECTED_PLATE_AREA, PhysicalQuantity.Area, VarState.AlwaysCalculated, heatExchanger); actualEffectivePlateArea = new ProcessVarDouble(StringConstants.ACTUAL_EFFECTIVE_PLATE_AREA, PhysicalQuantity.Area, VarState.AlwaysCalculated, heatExchanger); platePitch = new ProcessVarDouble(StringConstants.PLATE_PITCH, PhysicalQuantity.SmallLength, 0.0036, VarState.Specified, heatExchanger); //chevronAngle = new ProcessVarDouble(StringConstants.CHEVRON_ANGLE, PhysicalQuantity.PlaneAngle, Math.PI/4.0, VarState.Specified, heatExchanger); numberOfPlates = new ProcessVarInt(StringConstants.NUMBER_OF_PLATES, PhysicalQuantity.Unknown, 105, VarState.Specified, heatExchanger); hotSidePasses = new ProcessVarInt(StringConstants.HOT_SIDE_PASSES, PhysicalQuantity.Unknown, 1, VarState.Specified, heatExchanger); coldSidePasses = new ProcessVarInt(StringConstants.COLD_SIDE_PASSES, PhysicalQuantity.Unknown, 1, VarState.Specified, heatExchanger); portDiameter = new ProcessVarDouble(StringConstants.PORT_DIAMETER, PhysicalQuantity.Length, 0.2, VarState.Specified, heatExchanger); horizontalPortDistance = new ProcessVarDouble(StringConstants.HORIZONTAL_PORT_DISTANCE, PhysicalQuantity.Length, VarState.Specified, heatExchanger); verticalPortDistance = new ProcessVarDouble(StringConstants.VERTICAL_PORT_DISTANCE, PhysicalQuantity.Length, VarState.Specified, heatExchanger); compressedPlatePackLength = new ProcessVarDouble(StringConstants.COMPRESSED_PLATE_PACK_LENGTH, PhysicalQuantity.Length, VarState.Specified, heatExchanger); hotSideVelocity = new ProcessVarDouble(StringConstants.HOT_SIDE_VELOCITY, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, owner); coldSideVelocity = new ProcessVarDouble(StringConstants.COLD_SIDE_VELOCITY, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, owner); wallThickness.Name = StringConstants.PLATE_WALL_THICKNESS; wallThickness.Value = 0.0006; hotSideHeatTransferCoefficient.State = VarState.AlwaysCalculated; coldSideHeatTransferCoefficient.State = VarState.AlwaysCalculated; totalHeatTransferCoefficient.State = VarState.AlwaysCalculated; totalHeatTransferArea.State = VarState.AlwaysCalculated; InitializeVarListAndRegisterVars(); }
public void InitializeTheUI(Flowsheet flowsheet, HeatExchanger heatExchanger) { this.heatExchanger = heatExchanger; HXRatingModelPlateAndFrame plateAndFrameRating = heatExchanger.CurrentRatingModel as HXRatingModelPlateAndFrame; this.InitializeVariableTextBoxes(flowsheet, plateAndFrameRating); }
public override void SetObjectData() { base.SetObjectData(); int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionHXRatingModel", typeof(int)); if (persistedClassVersion == 1) { this.owner = info.GetValue("Owner", typeof(HeatExchanger)) as HeatExchanger; this.procVarList = info.GetValue("ProcVarList", typeof(ArrayList)) as ArrayList; this.flowDirection = (FlowDirection)info.GetValue("FlowDirection", typeof(FlowDirection)); this.coldSideHeatTransferCoefficient = RecallStorableObject("ColdSideHeatTransferCoefficient", typeof(ProcessVarDouble)) as ProcessVarDouble; this.hotSideHeatTransferCoefficient = RecallStorableObject("HotSideHeatTransferCoefficient", typeof(ProcessVarDouble)) as ProcessVarDouble; this.coldSideFoulingFactor = RecallStorableObject("ColdSideFoulingFactor", typeof(ProcessVarDouble)) as ProcessVarDouble; this.hotSideFoulingFactor = RecallStorableObject("HotSideFoulingFactor", typeof(ProcessVarDouble)) as ProcessVarDouble; this.includeWallEffect = (bool)info.GetValue("IncludeWallEffect", typeof(bool)); this.wallThermalConductivity = RecallStorableObject("WallThermalConductivity", typeof(ProcessVarDouble)) as ProcessVarDouble; this.wallThickness = RecallStorableObject("WallThickness", typeof(ProcessVarDouble)) as ProcessVarDouble; this.totalHeatTransferCoefficient = RecallStorableObject("TotalHeatTransferCoefficient", typeof(ProcessVarDouble)) as ProcessVarDouble; this.totalHeatTransferArea = RecallStorableObject("TotalHeatTransferArea", typeof(ProcessVarDouble)) as ProcessVarDouble; this.numberOfHeatTransferUnits = RecallStorableObject("NumberOfHeatTransferUnits", typeof(ProcessVarDouble)) as ProcessVarDouble; this.exchangerEffectiveness = RecallStorableObject("ExchangerEffectiveness", typeof(ProcessVarDouble)) as ProcessVarDouble; this.hotSideRe = RecallStorableObject("HotSideRe", typeof(ProcessVarDouble)) as ProcessVarDouble; this.coldSideRe = RecallStorableObject("ColdSideRe", typeof(ProcessVarDouble)) as ProcessVarDouble; } }
public HXRatingPlateAndFrameEditor(HeatExchangerControl heatExchangerCtrl) { // // Required for Windows Form Designer support // InitializeComponent(); this.inConstruction = true; this.Text = "Plate And Frame Rating: " + heatExchangerCtrl.HeatExchanger.Name; this.heatExchanger = heatExchangerCtrl.HeatExchanger; HXRatingModelPlateAndFrame ratingModel = this.heatExchanger.CurrentRatingModel as HXRatingModelPlateAndFrame; this.checkBoxIncludeWallEffect.Checked = ratingModel.IncludeWallEffect; this.hxRating2LabelsControl.Visible = this.checkBoxIncludeWallEffect.Checked; this.hxRating2ValuesControl.Visible = this.checkBoxIncludeWallEffect.Checked; this.hxRatingSimpleGenericPlateAndFrameLabelsControl.InitializeVariableLabels(ratingModel); this.hxRatingSimpleGenericPlateAndFrameValuesControl.InitializeTheUI(heatExchangerCtrl.Flowsheet, heatExchangerCtrl.HeatExchanger); this.hxRating2LabelsControl.InitializeVariableLabels(ratingModel); this.hxRating2ValuesControl.InitializeVariableTextBoxes(heatExchangerCtrl.Flowsheet, ratingModel); this.hxRatingPlateAndFrameLabelsControl.InitializeVariableLabels(ratingModel); this.hxRatingPlateAndFrameValuesControl.InitializeTheUI(heatExchangerCtrl.Flowsheet, this.heatExchanger); this.heatExchanger.SolveComplete += new SolveCompleteEventHandler(heatExchanger_SolveComplete); this.inConstruction = false; }
public HXRating2ValuesControl(Flowsheet flowsheet, HeatExchanger heatExchanger) { // NOTE: this constructor is not used InitializeComponent(); HXRatingModel ratingModel = heatExchanger.CurrentRatingModel as HXRatingModel; this.InitializeVariableTextBoxes(flowsheet, ratingModel); }
public HeatExchangerControl(Flowsheet flowsheet, Point location, HeatExchanger heatExchanger) : base(flowsheet, location, heatExchanger) { InitializeComponent(); this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H); UI.SetStatusColor(this, this.HeatExchanger.SolveState); this.UpdateBackImage(); }
public void InitializeTheUI(Flowsheet flowsheet, HeatExchanger heatExchanger) { this.inConstruction = true; this.heatExchanger = heatExchanger; HXRatingModelPlateAndFrame ratingModel = heatExchanger.CurrentRatingModel as HXRatingModelPlateAndFrame; this.InitializeVariableTextBoxes(flowsheet, ratingModel); heatExchanger.SolveComplete += new SolveCompleteEventHandler(heatExchanger_SolveComplete); this.inConstruction = false; this.SetFlowDirection(ratingModel.FlowDirection); }
public void InitializeTheUI(Flowsheet flowsheet, HeatExchanger heatExchanger) { this.inConstruction = true; this.heatExchanger = heatExchanger; HXRatingModelShellAndTube shellAndTubeRating = heatExchanger.CurrentRatingModel as HXRatingModelShellAndTube; this.InitializeVariableTextBoxes(flowsheet, shellAndTubeRating); heatExchanger.SolveComplete += new SolveCompleteEventHandler(heatExchanger_SolveComplete); this.comboBoxShellType.SelectedIndex = -1; this.inConstruction = false; this.SetShellType(shellAndTubeRating.ShellType); }
public override void SetObjectData() { base.SetObjectData(); int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionShellHTCAndDPCalculator", typeof(int)); if (persistedClassVersion == 1) { this.owner = info.GetValue("Owner", typeof(HeatExchanger)) as HeatExchanger; this.procVarList = info.GetValue("ProcVarList", typeof(ArrayList)) as ArrayList; this.ratingModel = (HXRatingModelShellAndTube)info.GetValue("RatingModel", typeof(HXRatingModelShellAndTube)); } }
private void HeatExchanger_HXHotSideChanged(HeatExchanger hx) { HXRatingModelShellAndTube ratingModel = this.HeatExchangerCtrl.HeatExchanger.CurrentRatingModel as HXRatingModelShellAndTube; this.SetHotSideShell(ratingModel.IsShellSideHot); if ((this.HeatExchangerCtrl.HeatExchanger.CurrentRatingModel as HXRatingModelShellAndTube).IsShellSideHot) { this.groupBoxColdStream.Text = HeatExchangerEditor.COLD_TUBE_INLET_OUTLET; this.groupBoxHotStream.Text = HeatExchangerEditor.HOT_SHELL_INLET_OUTLET; } else { this.groupBoxColdStream.Text = HeatExchangerEditor.COLD_SHELL_INLET_OUTLET; this.groupBoxHotStream.Text = HeatExchangerEditor.HOT_TUBE_INLET_OUTLET; } }
public HXRatingShellAndTubeEditor(HeatExchangerControl heatExchangerCtrl) { // // Required for Windows Form Designer support // InitializeComponent(); this.inConstruction = true; this.Text = "Shell And Tube Rating: " + heatExchangerCtrl.HeatExchanger.Name; this.heatExchanger = heatExchangerCtrl.HeatExchanger; HXRatingModelShellAndTube ratingModel = this.heatExchanger.CurrentRatingModel as HXRatingModelShellAndTube; this.checkBoxIncludeWallEffect.Checked = ratingModel.IncludeWallEffect; this.hxRating2LabelsControl.Visible = this.checkBoxIncludeWallEffect.Checked; this.hxRating2ValuesControl.Visible = this.checkBoxIncludeWallEffect.Checked; this.checkBoxIncludeNozzleEffect.Checked = ratingModel.IncludeNozzleEffect; this.hxRating3LabelsControl.Visible = this.checkBoxIncludeNozzleEffect.Checked; this.hxRating3ValuesControl.Visible = this.checkBoxIncludeNozzleEffect.Checked; this.hxRatingSimpleGenericShellAndTubeLabelsControl.InitializeVariableLabels(ratingModel); this.hxRatingSimpleGenericShellAndTubeValuesControl.InitializeTheUI(heatExchangerCtrl.Flowsheet, heatExchangerCtrl.HeatExchanger); this.hxRating2LabelsControl.InitializeVariableLabels(ratingModel); this.hxRating2ValuesControl.InitializeVariableTextBoxes(heatExchangerCtrl.Flowsheet, ratingModel); this.hxRatingShellAndTubeBellDelawareLabelsControl.InitializeVariableLabels(ratingModel); this.hxRatingShellAndTubeBellDelawareValuesControl.InitializeTheUI(heatExchangerCtrl.Flowsheet, this.heatExchanger); this.hxRatingShellAndTubeDonohueLabelsControl.InitializeVariableLabels(ratingModel); this.hxRatingShellAndTubeDonohueValuesControl.InitializeTheUI(heatExchangerCtrl.Flowsheet, this.heatExchanger); this.hxRatingShellAndTubeKernLabelsControl.InitializeVariableLabels(ratingModel); this.hxRatingShellAndTubeKernValuesControl.InitializeTheUI(heatExchangerCtrl.Flowsheet, this.heatExchanger); this.hxRating3LabelsControl.InitializeVariableLabels(ratingModel); this.hxRating3ValuesControl.InitializeVariableTextBoxes(heatExchangerCtrl.Flowsheet, ratingModel); this.heatExchanger.SolveComplete += new SolveCompleteEventHandler(heatExchanger_SolveComplete); this.comboBoxRatingType.SelectedIndex = -1; this.inConstruction = false; this.SetRatingType(ratingModel.ShellRatingType); }
protected HXRatingModel(HeatExchanger heatExchanger) { this.owner = heatExchanger; flowDirection = FlowDirection.Counter; hotSideHeatTransferCoefficient = new ProcessVarDouble(StringConstants.HOT_SIDE_HEAT_TRANSFER_COEFFICIENT, PhysicalQuantity.HeatTransferCoefficient, VarState.Specified, owner); coldSideHeatTransferCoefficient = new ProcessVarDouble(StringConstants.COLD_SIDE_HEAT_TRANSFER_COEFFICIENT, PhysicalQuantity.HeatTransferCoefficient, VarState.Specified, owner); hotSideFoulingFactor = new ProcessVarDouble(StringConstants.HOT_SIDE_FOULING_FACTOR, PhysicalQuantity.FoulingFactor, 0.0, VarState.Specified, owner); coldSideFoulingFactor = new ProcessVarDouble(StringConstants.COLD_SIDE_FOULING_FACTOR, PhysicalQuantity.FoulingFactor, 0.0, VarState.Specified, owner); totalHeatTransferCoefficient = new ProcessVarDouble(StringConstants.TOTAL_HEAT_TRANSFER_COEFFICIENT, PhysicalQuantity.HeatTransferCoefficient, VarState.Specified, owner); totalHeatTransferArea = new ProcessVarDouble(StringConstants.TOTAL_HEAT_TRANSFER_AREA, PhysicalQuantity.Area, VarState.Specified, owner); numberOfHeatTransferUnits = new ProcessVarDouble(StringConstants.NUMBER_OF_HEAT_TRANSFER_UNITS, PhysicalQuantity.Fraction, VarState.AlwaysCalculated, owner); exchangerEffectiveness = new ProcessVarDouble(StringConstants.EXCHANGER_EFFECTIVENESS, PhysicalQuantity.Fraction, VarState.AlwaysCalculated, owner); includeWallEffect = false; wallThermalConductivity = new ProcessVarDouble(StringConstants.WALL_THERMAL_CONDUCTIVITY, PhysicalQuantity.ThermalConductivity, 17.5, VarState.Specified, owner); wallThickness = new ProcessVarDouble(StringConstants.WALL_THICKNESS, PhysicalQuantity.SmallLength, 0.002, VarState.Specified, heatExchanger); hotSideRe = new ProcessVarDouble(StringConstants.HOT_SIDE_RE, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, owner); coldSideRe = new ProcessVarDouble(StringConstants.COLD_SIDE_RE, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, owner); }
private void UpdateStreamsUI() { // clear the stream group-boxes and start again //this.groupBoxColdStream.Controls.Clear(); //this.groupBoxHotStream.Controls.Clear(); HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger; bool hasColdIn = false; bool hasColdOut = false; bool hasHotIn = false; bool hasHotOut = false; ProcessStreamBase coldIn = heatExchanger.ColdSideInlet; if (coldIn != null) { hasColdIn = true; } ProcessStreamBase coldOut = heatExchanger.ColdSideOutlet; if (coldOut != null) { hasColdOut = true; } ProcessStreamBase hotIn = heatExchanger.HotSideInlet; if (hotIn != null) { hasHotIn = true; } ProcessStreamBase hotOut = heatExchanger.HotSideOutlet; if (hotOut != null) { hasHotOut = true; } //if (hasColdIn || hasColdOut) //{ // ProcessStreamBase labelsStream = null; // if (hasColdIn) // labelsStream = coldIn; // else if (hasColdOut) // labelsStream = coldOut; // 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.groupBoxColdStream.Controls.Add(ctrl); // ctrl.Location = new Point(4, 12 + 20 + 2); //} if (hasColdIn) { UserControl ctrl = null; ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideInlet.Name); initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet"); columnIndex += 2; if (hasColdOut) { baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name); initializeGrid(baseCtrl, columnIndex, true, "Inlet/Outlet"); columnIndex++; } //this.textBoxColdInName.Text = heatExchanger.ColdSideInlet.Name; //UI.SetStatusColor(this.textBoxColdInName, heatExchanger.ColdSideInlet.SolveState); } else if (hasColdOut) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name); initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet"); columnIndex += 2; //this.textBoxColdOutName.Text = heatExchanger.ColdSideOutlet.Name; //UI.SetStatusColor(this.textBoxColdOutName, heatExchanger.ColdSideOutlet.SolveState); } if (hasHotIn) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideInlet.Name); initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet"); columnIndex += 2; if (hasHotOut) { baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name); initializeGrid(baseCtrl, columnIndex, true, "Inlet/Outlet"); columnIndex++; } //this.textBoxHotInName.Text = heatExchanger.HotSideInlet.Name; //UI.SetStatusColor(this.textBoxHotInName, heatExchanger.HotSideInlet.SolveState); } else if (hasHotOut) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name); initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet"); columnIndex += 2; //this.textBoxHotOutName.Text = heatExchanger.HotSideOutlet.Name; //UI.SetStatusColor(this.textBoxHotOutName, heatExchanger.HotSideOutlet.SolveState); } }
public HeatExchangerEditor(HeatExchangerControl heatExchangerCtrl) : base(heatExchangerCtrl) { // // Required for Windows Form Designer support // //InitializeComponent(); this.inConstruction = true; HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger; this.Text = "Heat Exchanger: " + heatExchanger.Name; this.UpdateStreamsUI(); this.initializeGrid(heatExchangerCtrl, columnIndex, false, "Heat Exchanger"); // shell and tube hot side this.groupBoxHotSide = new System.Windows.Forms.GroupBox(); this.radioButtonHotSideTube = new System.Windows.Forms.RadioButton(); this.radioButtonHotSideShell = new System.Windows.Forms.RadioButton(); // // groupBoxHotSide // this.groupBoxHotSide.Controls.Add(this.radioButtonHotSideTube); this.groupBoxHotSide.Controls.Add(this.radioButtonHotSideShell); this.groupBoxHotSide.Location = new System.Drawing.Point(0, 0); this.groupBoxHotSide.Name = "groupBoxHotSide"; this.groupBoxHotSide.Size = new System.Drawing.Size(104, 68); this.groupBoxHotSide.TabIndex = 0; this.groupBoxHotSide.TabStop = false; this.groupBoxHotSide.Text = "Hot Side"; // // radioButtonHotSideTube // this.radioButtonHotSideTube.Location = new System.Drawing.Point(8, 44); this.radioButtonHotSideTube.Name = "radioButtonHotSideTube"; this.radioButtonHotSideTube.Size = new System.Drawing.Size(72, 20); this.radioButtonHotSideTube.TabIndex = 1; this.radioButtonHotSideTube.Text = "Tube"; this.radioButtonHotSideTube.CheckedChanged += new System.EventHandler(this.HotSideHandler); // // radioButtonHotSideShell // this.radioButtonHotSideShell.Location = new System.Drawing.Point(8, 20); this.radioButtonHotSideShell.Name = "radioButtonHotSideShell"; this.radioButtonHotSideShell.Size = new System.Drawing.Size(72, 20); this.radioButtonHotSideShell.TabIndex = 0; this.radioButtonHotSideShell.Text = "Shell"; this.radioButtonHotSideShell.CheckedChanged += new System.EventHandler(this.HotSideHandler); this.groupBoxHeatExchanger.Controls.Add(this.groupBoxHotSide); this.groupBoxHotSide.Location = new Point(20, 112); heatExchangerCtrl.HeatExchanger.StreamAttached += new StreamAttachedEventHandler(HeatExchanger_StreamAttached); heatExchangerCtrl.HeatExchanger.StreamDetached += new StreamDetachedEventHandler(HeatExchanger_StreamDetached); this.menuItemRating = new MenuItem(); this.menuItemRating.Index = this.menuItemReport.Index + 1; this.menuItemRating.Text = "Rating"; this.menuItemRating.Click += new EventHandler(menuItemRating_Click); this.mainMenu.MenuItems.Add(this.menuItemRating); this.comboBoxCalculationType = new System.Windows.Forms.ComboBox(); this.comboBoxExchangerType = new System.Windows.Forms.ComboBox(); this.labelCalculationType = new System.Windows.Forms.Label(); this.labelCalculationType.BackColor = Color.DarkGray; this.labelExchangerType = new System.Windows.Forms.Label(); this.labelExchangerType.BackColor = Color.DarkGray; // comboBoxCalculationType this.comboBoxCalculationType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxCalculationType.Items.AddRange(new object[] { "Balance", "Rating" }); this.comboBoxCalculationType.Location = new System.Drawing.Point(502, 8); this.comboBoxCalculationType.Name = "comboBoxCalculationType"; this.comboBoxCalculationType.Size = new System.Drawing.Size(80, 21); this.comboBoxCalculationType.TabIndex = 7; this.comboBoxCalculationType.SelectedIndexChanged += new EventHandler(comboBoxCalculationType_SelectedIndexChanged); // comboBoxExchangerType this.comboBoxExchangerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxExchangerType.Items.AddRange(new object[] { "Simple Generic", "Shell And Tube", "Plate And Frame" }); this.comboBoxExchangerType.Location = new System.Drawing.Point(802, 8); this.comboBoxExchangerType.Name = "comboBoxExchangerType"; this.comboBoxExchangerType.Size = new System.Drawing.Size(108, 21); this.comboBoxExchangerType.TabIndex = 6; this.comboBoxExchangerType.SelectedIndexChanged += new EventHandler(comboBoxExchangerType_SelectedIndexChanged); // labelCalculationType this.labelCalculationType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.labelCalculationType.Location = new System.Drawing.Point(310, 8); this.labelCalculationType.Name = "labelCalculationType"; this.labelCalculationType.Size = new System.Drawing.Size(192, 20); this.labelCalculationType.TabIndex = 5; this.labelCalculationType.Text = "Calculation Type:"; this.labelCalculationType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // labelExchangerType this.labelExchangerType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.labelExchangerType.Location = new System.Drawing.Point(610, 8); this.labelExchangerType.Name = "labelExchangerType"; this.labelExchangerType.Size = new System.Drawing.Size(192, 20); this.labelExchangerType.TabIndex = 4; this.labelExchangerType.Text = "Exchanger Type:"; this.labelExchangerType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.namePanel.Controls.Add(this.labelExchangerType); this.namePanel.Controls.Add(this.comboBoxExchangerType); this.namePanel.Controls.Add(this.labelCalculationType); this.namePanel.Controls.Add(this.comboBoxCalculationType); this.HeatExchangerCtrl.HeatExchanger.HXHotSideChanged += new HXHotSideChangedEventHandler(HeatExchanger_HXHotSideChanged); this.comboBoxCalculationType.SelectedIndex = -1; this.comboBoxExchangerType.SelectedIndex = -1; this.inConstruction = false; this.SetExchangerType(this.HeatExchangerCtrl.HeatExchanger.ExchangerType); this.SetCalculationType(this.HeatExchangerCtrl.HeatExchanger.CalculationType); if (this.HeatExchangerCtrl.HeatExchanger.CurrentRatingModel != null) { if (this.HeatExchangerCtrl.HeatExchanger.ExchangerType == ExchangerType.ShellAndTube) { HXRatingModelShellAndTube ratingModel = this.HeatExchangerCtrl.HeatExchanger.CurrentRatingModel as HXRatingModelShellAndTube; this.SetHotSideShell(ratingModel.IsShellSideHot); } } }
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); }
private void UpdateStreamsUI() { // clear the stream group-boxes and start again this.groupBoxColdStream.Controls.Clear(); this.groupBoxHotStream.Controls.Clear(); HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger; bool hasColdIn = false; bool hasColdOut = false; bool hasHotIn = false; bool hasHotOut = false; ProcessStreamBase coldIn = heatExchanger.ColdSideInlet; hasColdIn = coldIn != null; ProcessStreamBase coldOut = heatExchanger.ColdSideOutlet; hasColdOut = coldOut != null; ProcessStreamBase hotIn = heatExchanger.HotSideInlet; hasHotIn = hotIn != null; ProcessStreamBase hotOut = heatExchanger.HotSideOutlet; hasHotOut = hotOut != null; if (hasColdIn || hasColdOut) { ProcessStreamBase labelsStream = hasColdIn ? coldIn : coldOut; UserControl ctrl = null; if (labelsStream is WaterStream) { ctrl = new ProcessVarLabelsControl(labelsStream.VarList); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } else if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } this.groupBoxColdStream.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasColdIn) { UserControl ctrl = null; ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideInlet.Name); if (coldIn is WaterStream) { WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processInCtrl); } else if (coldIn is DryingGasStream) { GasStreamControl gasInCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasInCtrl); } else if (coldIn is DryingMaterialStream) { MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matInCtrl); } this.groupBoxColdStream.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxColdInName.SetSolvable(heatExchanger.ColdSideInlet); this.groupBoxColdStream.Controls.Add(this.textBoxColdInName); this.textBoxColdInName.Text = heatExchanger.ColdSideInlet.Name; UI.SetStatusColor(this.textBoxColdInName, heatExchanger.ColdSideInlet.SolveState); } if (hasColdOut) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name); UserControl ctrl = null; if (coldOut is WaterStream) { WaterStreamControl processOutCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processOutCtrl); } else if (coldOut is DryingGasStream) { GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasOutCtrl); } else if (coldOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matOutCtrl); } this.groupBoxColdStream.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxColdOutName.SetSolvable(heatExchanger.ColdSideOutlet); this.groupBoxColdStream.Controls.Add(this.textBoxColdOutName); this.textBoxColdOutName.Text = heatExchanger.ColdSideOutlet.Name; UI.SetStatusColor(this.textBoxColdOutName, heatExchanger.ColdSideOutlet.SolveState); } if (hasHotIn || hasHotOut) { ProcessStreamBase labelsStream = hasHotIn ? hotIn : hotOut; UserControl ctrl = null; if (labelsStream is WaterStream) { ctrl = new ProcessVarLabelsControl(labelsStream.VarList); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } else if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } this.groupBoxHotStream.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasHotIn) { UserControl ctrl = null; ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideInlet.Name); if (hotIn is WaterStream) { WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processInCtrl); } else if (hotIn is DryingGasStream) { GasStreamControl gasInCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasInCtrl); } else if (hotIn is DryingMaterialStream) { MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matInCtrl); } this.groupBoxHotStream.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxHotInName.SetSolvable(heatExchanger.HotSideInlet); this.groupBoxHotStream.Controls.Add(this.textBoxHotInName); this.textBoxHotInName.Text = heatExchanger.HotSideInlet.Name; UI.SetStatusColor(this.textBoxHotInName, heatExchanger.HotSideInlet.SolveState); } if (hasHotOut) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name); UserControl ctrl = null; if (hotOut is WaterStream) { WaterStreamControl processOutCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processOutCtrl); } else if (hotOut is DryingGasStream) { GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasOutCtrl); } else if (hotOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matOutCtrl); } this.groupBoxHotStream.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxHotOutName.SetSolvable(heatExchanger.HotSideOutlet); this.groupBoxHotStream.Controls.Add(this.textBoxHotOutName); this.textBoxHotOutName.Text = heatExchanger.HotSideOutlet.Name; UI.SetStatusColor(this.textBoxHotOutName, heatExchanger.HotSideOutlet.SolveState); } }
public HeatExchangerLabelsControl(HeatExchanger uo) : this() { this.InitializeVariableLabels(uo); }
public void InitializeVariableLabels(HeatExchanger uo) { this.labelTotalHeatTransfer.InitializeVariable(uo.TotalHeatTransfer); this.labelColdSidePressureDrop.InitializeVariable(uo.ColdSidePressureDrop); this.labelHotSidePressureDrop.InitializeVariable(uo.HotSidePressureDrop); }
public HeatExchangerEditor(HeatExchangerControl heatExchangerCtrl) : base(heatExchangerCtrl) { // // Required for Windows Form Designer support // InitializeComponent(); this.inConstruction = true; HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger; this.Text = "Heat Exchanger: " + heatExchanger.Name; this.UpdateStreamsUI(); this.groupBoxHeatExchanger = new System.Windows.Forms.GroupBox(); this.groupBoxHeatExchanger.Location = new System.Drawing.Point(724, 24); this.groupBoxHeatExchanger.Name = "groupBoxHeatExchanger"; this.groupBoxHeatExchanger.Text = "Heat Exchanger"; this.groupBoxHeatExchanger.Size = new System.Drawing.Size(280, 300); this.groupBoxHeatExchanger.TabIndex = 128; this.groupBoxHeatExchanger.TabStop = false; this.panel.Controls.Add(this.groupBoxHeatExchanger); // TO DO: to customize the height? or not // if (heatExchanger.ColdSideInlet is DryingGasStream) // { // this.groupBoxColdStream.Size = new System.Drawing.Size(360, 280); // this.panel.Size = new System.Drawing.Size(1010, 309); // this.ClientSize = new System.Drawing.Size(1010, 331); // } // else if (heatExchanger.ColdSideInlet is DryingMaterialStream) // { this.groupBoxColdStream.Size = new System.Drawing.Size(360, 300); this.panel.Size = new System.Drawing.Size(1010, 329); this.ClientSize = new System.Drawing.Size(1010, 351); // } this.groupBoxHotStream.Size = new System.Drawing.Size(360, 300); HeatExchangerLabelsControl heatExchangerLabelsCtrl = new HeatExchangerLabelsControl(this.HeatExchangerCtrl.HeatExchanger); //ProcessVarLabelsControl heatExchangerLabelsCtrl = new ProcessVarLabelsControl(this.HeatExchangerCtrl.HeatExchanger.VarList); this.groupBoxHeatExchanger.Controls.Add(heatExchangerLabelsCtrl); heatExchangerLabelsCtrl.Location = new Point(4, 12 + 20 + 2); HeatExchangerValuesControl heatExchangerValuesCtrl = new HeatExchangerValuesControl(this.HeatExchangerCtrl); //ProcessVarValuesControl heatExchangerValuesCtrl = new ProcessVarValuesControl(this.HeatExchangerCtrl); this.groupBoxHeatExchanger.Controls.Add(heatExchangerValuesCtrl); heatExchangerValuesCtrl.Location = new Point(196, 12 + 20 + 2); // shell and tube hot side this.groupBoxHotSide = new System.Windows.Forms.GroupBox(); this.radioButtonHotSideTube = new System.Windows.Forms.RadioButton(); this.radioButtonHotSideShell = new System.Windows.Forms.RadioButton(); // // groupBoxHotSide // this.groupBoxHotSide.Controls.Add(this.radioButtonHotSideTube); this.groupBoxHotSide.Controls.Add(this.radioButtonHotSideShell); this.groupBoxHotSide.Location = new System.Drawing.Point(0, 0); this.groupBoxHotSide.Name = "groupBoxHotSide"; this.groupBoxHotSide.Size = new System.Drawing.Size(104, 68); this.groupBoxHotSide.TabIndex = 0; this.groupBoxHotSide.TabStop = false; this.groupBoxHotSide.Text = "Hot Side"; // // radioButtonHotSideTube // this.radioButtonHotSideTube.Location = new System.Drawing.Point(8, 44); this.radioButtonHotSideTube.Name = "radioButtonHotSideTube"; this.radioButtonHotSideTube.Size = new System.Drawing.Size(72, 20); this.radioButtonHotSideTube.TabIndex = 1; this.radioButtonHotSideTube.Text = "Tube"; this.radioButtonHotSideTube.CheckedChanged += new System.EventHandler(this.HotSideHandler); // // radioButtonHotSideShell // this.radioButtonHotSideShell.Location = new System.Drawing.Point(8, 20); this.radioButtonHotSideShell.Name = "radioButtonHotSideShell"; this.radioButtonHotSideShell.Size = new System.Drawing.Size(72, 20); this.radioButtonHotSideShell.TabIndex = 0; this.radioButtonHotSideShell.Text = "Shell"; this.radioButtonHotSideShell.CheckedChanged += new System.EventHandler(this.HotSideHandler); this.groupBoxHeatExchanger.Controls.Add(this.groupBoxHotSide); this.groupBoxHotSide.Location = new Point(20, 112); heatExchangerCtrl.HeatExchanger.StreamAttached += new StreamAttachedEventHandler(HeatExchanger_StreamAttached); heatExchangerCtrl.HeatExchanger.StreamDetached += new StreamDetachedEventHandler(HeatExchanger_StreamDetached); this.menuItemRating = new MenuItem(); this.menuItemRating.Index = this.menuItemReport.Index + 1; this.menuItemRating.Text = "Rating"; this.menuItemRating.Click += new EventHandler(menuItemRating_Click); this.mainMenu.MenuItems.Add(this.menuItemRating); this.comboBoxCalculationType = new System.Windows.Forms.ComboBox(); this.comboBoxExchangerType = new System.Windows.Forms.ComboBox(); this.labelCalculationType = new System.Windows.Forms.Label(); this.labelCalculationType.BackColor = Color.DarkGray; this.labelExchangerType = new System.Windows.Forms.Label(); this.labelExchangerType.BackColor = Color.DarkGray; // comboBoxCalculationType this.comboBoxCalculationType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxCalculationType.Items.AddRange(new object[] { "Balance", "Rating" }); this.comboBoxCalculationType.Location = new System.Drawing.Point(492, 0); this.comboBoxCalculationType.Name = "comboBoxCalculationType"; this.comboBoxCalculationType.Size = new System.Drawing.Size(80, 21); this.comboBoxCalculationType.TabIndex = 7; this.comboBoxCalculationType.SelectedIndexChanged += new EventHandler(comboBoxCalculationType_SelectedIndexChanged); // comboBoxExchangerType this.comboBoxExchangerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxExchangerType.Items.AddRange(new object[] { "Simple Generic", "Shell And Tube", "Plate And Frame" }); this.comboBoxExchangerType.Location = new System.Drawing.Point(792, 0); this.comboBoxExchangerType.Name = "comboBoxExchangerType"; this.comboBoxExchangerType.Size = new System.Drawing.Size(108, 21); this.comboBoxExchangerType.TabIndex = 6; this.comboBoxExchangerType.SelectedIndexChanged += new EventHandler(comboBoxExchangerType_SelectedIndexChanged); // labelCalculationType this.labelCalculationType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.labelCalculationType.Location = new System.Drawing.Point(300, 0); this.labelCalculationType.Name = "labelCalculationType"; this.labelCalculationType.Size = new System.Drawing.Size(192, 20); this.labelCalculationType.TabIndex = 5; this.labelCalculationType.Text = "Calculation Type:"; this.labelCalculationType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // labelExchangerType this.labelExchangerType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.labelExchangerType.Location = new System.Drawing.Point(600, 0); this.labelExchangerType.Name = "labelExchangerType"; this.labelExchangerType.Size = new System.Drawing.Size(192, 20); this.labelExchangerType.TabIndex = 4; this.labelExchangerType.Text = "Exchanger Type:"; this.labelExchangerType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.panel.Controls.Add(this.labelExchangerType); this.panel.Controls.Add(this.comboBoxExchangerType); this.panel.Controls.Add(this.labelCalculationType); this.panel.Controls.Add(this.comboBoxCalculationType); this.HeatExchangerCtrl.HeatExchanger.HXHotSideChanged += new HXHotSideChangedEventHandler(HeatExchanger_HXHotSideChanged); this.comboBoxCalculationType.SelectedIndex = -1; this.comboBoxExchangerType.SelectedIndex = -1; this.inConstruction = false; this.SetExchangerType(this.HeatExchangerCtrl.HeatExchanger.ExchangerType); this.SetCalculationType(this.HeatExchangerCtrl.HeatExchanger.CalculationType); this.comboBoxCalculationType.Enabled = false; if (this.HeatExchangerCtrl.HeatExchanger.CurrentRatingModel != null) { if (this.HeatExchangerCtrl.HeatExchanger.ExchangerType == ExchangerType.ShellAndTube) { HXRatingModelShellAndTube ratingModel = this.HeatExchangerCtrl.HeatExchanger.CurrentRatingModel as HXRatingModelShellAndTube; this.SetHotSideShell(ratingModel.IsShellSideHot); } } }
//! Called by unity engine for rendering and handling GUI events. public void OnGUI() { // STYLE GUI.skin = GetComponent <PlayerGUI>().thisGUIskin; // ASPECT RATIO float ScreenHeight = Screen.height; float ScreenWidth = Screen.width; if (ScreenWidth / ScreenHeight < 1.7f) { ScreenHeight = (ScreenHeight * 0.75f); } if (ScreenHeight < 700) { GUI.skin.label.fontSize = 10; } if (!playerController.stateManager.Busy() && GetComponent <MainMenu>().finishedLoading == true) { // MACHINE CONTROL GUI if (playerController.inventoryOpen == false && playerController.machineGUIopen == true && playerController.objectInSight != null) { GameObject obj = playerController.objectInSight; if (obj.GetComponent <PowerConduit>() != null) { bool netFlag = false; PowerConduit powerConduit = obj.GetComponent <PowerConduit>(); if (powerConduit.connectionFailed == false) { GUI.DrawTexture(guiCoordinates.FourButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.outputLabelRect, "Range"); powerConduit.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, powerConduit.range, 6, 120); if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Dual Output: " + powerConduit.dualOutput)) { if (powerConduit.dualOutput == true) { powerConduit.dualOutput = false; } else { powerConduit.dualOutput = true; } playerController.PlayButtonSound(); } if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close")) { playerController.machineGUIopen = false; playerController.PlayButtonSound(); } } else { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; powerConduit.connectionAttempts = 0; powerConduit.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { bool rangeDeSync = powerConduit.range != playerController.networkedConduitRange; bool outputDeSync = powerConduit.dualOutput != playerController.networkedDualPower; if (rangeDeSync || outputDeSync || netFlag) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = powerConduit.gameObject.transform.position; updateNetworkConduitCoroutine = StartCoroutine(net.SendPowerData(location, powerConduit.range, powerConduit.dualOutput)); playerController.networkedConduitRange = powerConduit.range; playerController.networkedDualPower = powerConduit.dualOutput; } } } if (obj.GetComponent <RailCartHub>() != null) { bool netFlag = false; RailCartHub hub = obj.GetComponent <RailCartHub>(); if (hub.connectionFailed == false) { if (hubStopWindowOpen == false) { GUI.DrawTexture(guiCoordinates.FiveButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.railCartHubCircuitLabelRect, "Circuit"); int circuit = hub.circuit; string circuitString = GUI.TextField(guiCoordinates.railCartHubCircuitRect, circuit.ToString(), 3); try { hub.circuit = int.Parse(circuitString); } catch { // NOOP } GUI.Label(guiCoordinates.outputLabelRect, "Range"); hub.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, hub.range, 6, 120); if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Stop Settings")) { hubStopWindowOpen = true; playerController.PlayButtonSound(); } if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close")) { playerController.machineGUIopen = false; hubStopWindowOpen = false; playerController.PlayButtonSound(); } } else { GUI.DrawTexture(guiCoordinates.FiveButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.longOutputLabelRect, "Stop Time"); if (GUI.Button(guiCoordinates.outputControlButton0Rect, "Stop: " + hub.stop)) { if (hub.stop == true) { hub.stop = false; } else { hub.stop = true; } playerController.PlayButtonSound(); } hub.stopTime = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, hub.stopTime, 0, 600); if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Range Settings")) { hubStopWindowOpen = false; playerController.PlayButtonSound(); } if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close")) { playerController.machineGUIopen = false; hubStopWindowOpen = false; playerController.PlayButtonSound(); } } } else { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; hub.connectionAttempts = 0; hub.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { bool circuitDeSync = hub.circuit != playerController.networkedHubCircuit; bool rangeDeSync = hub.range != playerController.networkedHubRange; bool stopDeSync = hub.stop != playerController.networkedHubStop; bool timeDeSync = (int)hub.stopTime != (int)playerController.networkedHubStopTime; if (circuitDeSync || rangeDeSync || stopDeSync || timeDeSync || netFlag) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = hub.gameObject.transform.position; updateNetworkConduitCoroutine = StartCoroutine(net.SendHubData(location, hub.circuit, hub.range, hub.stop, hub.stopTime)); playerController.networkedHubCircuit = hub.circuit; playerController.networkedHubRange = hub.range; playerController.networkedHubStop = hub.stop; playerController.networkedHubStopTime = hub.stopTime; } } } if (obj.GetComponent <Retriever>() != null) { bool netFlag = false; Retriever retriever = obj.GetComponent <Retriever>(); if (retriever.connectionFailed == false) { GUI.DrawTexture(guiCoordinates.FourButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]); if (retriever.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); retriever.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, retriever.speed, 0, retriever.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Choose Items")) { if (obj.GetComponent <InventoryManager>().initialized == true) { playerController.inventoryOpen = true; playerController.storageGUIopen = true; playerController.machineGUIopen = false; playerController.PlayButtonSound(); } } if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close")) { playerController.machineGUIopen = false; playerController.PlayButtonSound(); } } else { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; retriever.connectionAttempts = 0; retriever.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (retriever.speed != playerController.networkedConduitRange || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = retriever.gameObject.transform.position; updateNetworkConduitCoroutine = StartCoroutine(net.SendConduitData(location, retriever.speed)); playerController.networkedConduitRange = retriever.speed; } } } if (obj.GetComponent <AutoCrafter>() != null) { bool netFlag = false; AutoCrafter autoCrafter = obj.GetComponent <AutoCrafter>(); if (autoCrafter.connectionFailed == false) { GUI.DrawTexture(guiCoordinates.FourButtonSpeedControlBGRect, textureDictionary.dictionary["Interface Background"]); if (autoCrafter.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); autoCrafter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, autoCrafter.speed, 0, autoCrafter.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } if (GUI.Button(guiCoordinates.outputControlButton3Rect, "Choose Item")) { if (obj.GetComponent <InventoryManager>().initialized == true) { playerController.inventoryOpen = true; playerController.storageGUIopen = true; playerController.machineGUIopen = false; playerController.PlayButtonSound(); } } if (GUI.Button(guiCoordinates.outputControlButton4Rect, "Close")) { playerController.machineGUIopen = false; playerController.PlayButtonSound(); } } else { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; autoCrafter.connectionAttempts = 0; autoCrafter.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (autoCrafter.speed != playerController.networkedConduitRange || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = autoCrafter.gameObject.transform.position; updateNetworkConduitCoroutine = StartCoroutine(net.SendConduitData(location, autoCrafter.speed)); playerController.networkedConduitRange = autoCrafter.speed; } } } if (obj.GetComponent <UniversalConduit>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); UniversalConduit conduit = obj.GetComponent <UniversalConduit>(); if (conduit.connectionFailed == false) { GUI.Label(guiCoordinates.outputLabelRect, "Range"); conduit.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, conduit.range, 6, 120); } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; conduit.connectionAttempts = 0; conduit.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (conduit.range != playerController.networkedConduitRange || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = conduit.gameObject.transform.position; updateNetworkConduitCoroutine = StartCoroutine(net.SendConduitData(location, conduit.range)); playerController.networkedConduitRange = conduit.range; } } } if (obj.GetComponent <DarkMatterConduit>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); DarkMatterConduit conduit = obj.GetComponent <DarkMatterConduit>(); if (conduit.connectionFailed == false) { GUI.Label(guiCoordinates.outputLabelRect, "Range"); conduit.range = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, conduit.range, 6, 120); } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; conduit.connectionAttempts = 0; conduit.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (conduit.range != playerController.networkedConduitRange || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = conduit.gameObject.transform.position; updateNetworkConduitCoroutine = StartCoroutine(net.SendConduitData(location, conduit.range)); playerController.networkedConduitRange = conduit.range; } } } if (obj.GetComponent <HeatExchanger>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); HeatExchanger hx = obj.GetComponent <HeatExchanger>(); if (hx.inputObject != null) { if (hx.inputObject.GetComponent <UniversalConduit>() != null) { if (hx.connectionFailed == false) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); hx.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, hx.speed, 0, playerController.hxAmount); } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; hx.connectionAttempts = 0; hx.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (hx.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = hx.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, hx.speed)); playerController.networkedMachineSpeed = hx.speed; } } } else { GUI.Label(guiCoordinates.outputLabelRect, "No Input"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "No Input"); } } if (obj.GetComponent <PowerSource>() != null) { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); PowerSource powerSource = obj.GetComponent <PowerSource>(); if (powerSource.connectionFailed == true) { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { powerSource.connectionAttempts = 0; powerSource.connectionFailed = false; playerController.PlayButtonSound(); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Online"); } } if (obj.GetComponent <Auger>() != null) { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); Auger auger = obj.GetComponent <Auger>(); if (auger.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); auger.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, auger.speed, 0, auger.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (auger.speed != playerController.networkedMachineSpeed) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = auger.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, auger.speed)); playerController.networkedMachineSpeed = auger.speed; } } } if (obj.GetComponent <UniversalExtractor>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); UniversalExtractor extractor = obj.GetComponent <UniversalExtractor>(); if (extractor.connectionFailed == false) { if (extractor.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); extractor.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, extractor.speed, 0, extractor.power); } else { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; extractor.connectionAttempts = 0; extractor.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (extractor.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = extractor.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, extractor.speed)); playerController.networkedMachineSpeed = extractor.speed; } } } if (obj.GetComponent <DarkMatterCollector>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); DarkMatterCollector collector = obj.GetComponent <DarkMatterCollector>(); if (collector.connectionFailed == false) { if (collector.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); collector.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, collector.speed, 0, collector.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; collector.connectionAttempts = 0; collector.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (collector.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = collector.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, collector.speed)); playerController.networkedMachineSpeed = collector.speed; } } } if (obj.GetComponent <Smelter>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); Smelter smelter = obj.GetComponent <Smelter>(); if (smelter.connectionFailed == false) { if (smelter.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); smelter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, smelter.speed, 0, smelter.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; smelter.connectionAttempts = 0; smelter.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (smelter.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = smelter.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, smelter.speed)); playerController.networkedMachineSpeed = smelter.speed; } } } if (obj.GetComponent <AlloySmelter>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); AlloySmelter alloySmelter = obj.GetComponent <AlloySmelter>(); if (alloySmelter.connectionFailed == false) { if (alloySmelter.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); alloySmelter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, alloySmelter.speed, 0, alloySmelter.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; alloySmelter.connectionAttempts = 0; alloySmelter.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (alloySmelter.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = alloySmelter.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, alloySmelter.speed)); playerController.networkedMachineSpeed = alloySmelter.speed; } } } if (obj.GetComponent <Press>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); Press press = obj.GetComponent <Press>(); if (press.connectionFailed == false) { if (press.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); press.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, press.speed, 0, press.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; press.connectionAttempts = 0; press.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (press.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = press.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, press.speed)); playerController.networkedMachineSpeed = press.speed; } } } if (obj.GetComponent <Extruder>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); Extruder extruder = obj.GetComponent <Extruder>(); if (extruder.connectionFailed == false) { if (extruder.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); extruder.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, extruder.speed, 0, extruder.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; extruder.connectionAttempts = 0; extruder.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (extruder.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = extruder.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, extruder.speed)); playerController.networkedMachineSpeed = extruder.speed; } } } if (obj.GetComponent <ModMachine>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); ModMachine modMachine = obj.GetComponent <ModMachine>(); if (modMachine.connectionFailed == false) { if (modMachine.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); modMachine.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, modMachine.speed, 0, modMachine.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; modMachine.connectionAttempts = 0; modMachine.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (modMachine.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = modMachine.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, modMachine.speed)); playerController.networkedMachineSpeed = modMachine.speed; } } } if (obj.GetComponent <Turret>() != null) { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); Turret turret = obj.GetComponent <Turret>(); if (turret.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); if (turret.power < 30) { turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, turret.power); } else { turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, 30); } } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (turret.speed != playerController.networkedMachineSpeed) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = turret.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, turret.speed)); playerController.networkedMachineSpeed = turret.speed; } } } if (obj.GetComponent <MissileTurret>() != null) { GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); MissileTurret turret = obj.GetComponent <MissileTurret>(); if (turret.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); if (turret.power < 30) { turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, turret.power); } else { turret.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, turret.speed, 0, 30); } } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (turret.speed != playerController.networkedMachineSpeed) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = turret.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, turret.speed)); playerController.networkedMachineSpeed = turret.speed; } } } if (obj.GetComponent <GearCutter>() != null) { bool netFlag = false; GUI.DrawTexture(guiCoordinates.speedControlBGRect, textureDictionary.dictionary["Interface Background"]); GearCutter gearCutter = obj.GetComponent <GearCutter>(); if (gearCutter.connectionFailed == false) { if (gearCutter.power > 0) { GUI.Label(guiCoordinates.outputLabelRect, "Output"); gearCutter.speed = (int)GUI.HorizontalSlider(guiCoordinates.outputControlButton2Rect, gearCutter.speed, 0, gearCutter.power); } else { GUI.Label(guiCoordinates.outputLabelRect, "No Power"); } } else { GUI.Label(guiCoordinates.outputLabelRect, "Offline"); if (GUI.Button(guiCoordinates.outputControlButton2Rect, "Reboot")) { netFlag = true; gearCutter.connectionAttempts = 0; gearCutter.connectionFailed = false; playerController.PlayButtonSound(); } } if (PlayerPrefsX.GetPersistentBool("multiplayer") == true) { if (gearCutter.speed != playerController.networkedMachineSpeed || netFlag == true) { NetworkSend net = playerController.networkController.networkSend; Vector3 location = gearCutter.gameObject.transform.position; updateNetworkMachineCoroutine = StartCoroutine(net.SendMachineData(location, gearCutter.speed)); playerController.networkedMachineSpeed = gearCutter.speed; } } } } else { hubStopWindowOpen = false; gameObject.GetComponent <MSCameraController>().enabled = true; } } }
protected ShellHTCAndDPCalculator(HXRatingModelShellAndTube ratingModel) { this.ratingModel = ratingModel; this.owner = ratingModel.Owner; //InitializeVarList(); }
public HXRatingModelSimpleGeneric(HeatExchanger heatExchanger) : base(heatExchanger) { InitializeVarListAndRegisterVars(); }