void CallSolverIfNeeded() { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }
public static void Populate(ISimulationObject obj, DynamicLayout container) { var su = obj.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = obj.GetFlowsheet().FlowsheetOptions.NumberFormat; var recycle = (EnergyRecycle)obj; s.CreateAndAddLabelRow(container, "Object Details"); s.CreateAndAddTwoLabelsRow(container, "Status", obj.GraphicObject.Active ? "Active" : "Inactive"); s.CreateAndAddStringEditorRow(container, "Name", obj.GraphicObject.Tag, (TextBox arg3, EventArgs ev) => { obj.GraphicObject.Tag = arg3.Text; }); container.CreateAndAddLabelRow("Convergence Tolerances"); container.CreateAndAddTextBoxRow(nf, "Energy Flow", cv.ConvertFromSI(su.heatflow, recycle.ConvergenceParameters.Energy), (sender, e) => { if (sender.Text.IsValidDouble()) { recycle.ConvergenceParameters.Energy = cv.ConvertToSI(su.heatflow, sender.Text.ToDoubleFromCurrent()); } }); }
public static void Populate(ISimulationObject obj, DynamicLayout container) { var su = obj.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = obj.GetFlowsheet().FlowsheetOptions.NumberFormat; var recycle = (Recycle)obj; s.CreateAndAddLabelRow(container, "Object Details"); s.CreateAndAddTwoLabelsRow(container, "Status", obj.GraphicObject.Active ? "Active" : "Inactive"); s.CreateAndAddStringEditorRow(container, "Name", obj.GraphicObject.Tag, (TextBox arg3, EventArgs ev) => { obj.GraphicObject.Tag = arg3.Text; }); container.CreateAndAddLabelRow("Convergence Control"); container.CreateAndAddCheckBoxRow("Converge using global solver", recycle.AccelerationMethod == Interfaces.Enums.AccelMethod.GlobalBroyden, (sender, e) => { if (sender.Checked.GetValueOrDefault()) { recycle.AccelerationMethod = Interfaces.Enums.AccelMethod.GlobalBroyden; } else { recycle.AccelerationMethod = Interfaces.Enums.AccelMethod.None; } }); container.CreateAndAddLabelRow("Convergence Tolerances"); container.CreateAndAddTextBoxRow(nf, "Mass Flow", cv.ConvertFromSI(su.massflow, recycle.ConvergenceParameters.VazaoMassica), (sender, e) => { if (sender.Text.IsValidDouble()) { recycle.ConvergenceParameters.VazaoMassica = cv.ConvertToSI(su.massflow, sender.Text.ToDoubleFromCurrent()); } }); container.CreateAndAddTextBoxRow(nf, "Temperature", cv.ConvertFromSI(su.deltaT, recycle.ConvergenceParameters.Temperatura), (sender, e) => { if (sender.Text.IsValidDouble()) { recycle.ConvergenceParameters.Temperatura = cv.ConvertToSI(su.deltaT, sender.Text.ToDoubleFromCurrent()); } }); container.CreateAndAddTextBoxRow(nf, "Pressure", cv.ConvertFromSI(su.deltaP, recycle.ConvergenceParameters.Pressao), (sender, e) => { if (sender.Text.IsValidDouble()) { recycle.ConvergenceParameters.Pressao = cv.ConvertToSI(su.deltaP, sender.Text.ToDoubleFromCurrent()); } }); }
void Initialize() { var mslist = SimObject.GetFlowsheet().GraphicObjects.Values.Where((x) => x.ObjectType == ObjectType.MaterialStream).Select((m) => m.Tag).ToList(); var eslist = SimObject.GetFlowsheet().GraphicObjects.Values.Where((x) => x.ObjectType == ObjectType.EnergyStream).Select((m) => m.Tag).ToList(); var mslist_in = SimObject.GetFlowsheet().GraphicObjects.Values.Where((x) => x.ObjectType == ObjectType.MaterialStream && !x.OutputConnectors[0].IsAttached).Select((m) => m.Tag).ToList(); var eslist_in = SimObject.GetFlowsheet().GraphicObjects.Values.Where((x) => x.ObjectType == ObjectType.EnergyStream && !x.OutputConnectors[0].IsAttached).Select((m) => m.Tag).ToList(); var mslist_out = SimObject.GetFlowsheet().GraphicObjects.Values.Where((x) => x.ObjectType == ObjectType.MaterialStream && !x.InputConnectors[0].IsAttached).Select((m) => m.Tag).ToList(); var eslist_out = SimObject.GetFlowsheet().GraphicObjects.Values.Where((x) => x.ObjectType == ObjectType.EnergyStream && !x.InputConnectors[0].IsAttached).Select((m) => m.Tag).ToList(); mslist.Insert(0, ""); eslist.Insert(0, ""); mslist_in.Insert(0, ""); eslist_in.Insert(0, ""); mslist_out.Insert(0, ""); eslist_out.Insert(0, ""); foreach (var cp in SimObject.GraphicObject.InputConnectors) { if (cp.Type != ConType.ConEn) { CreateAndAddRow("In", cp, mslist_in); } } foreach (var cp in SimObject.GraphicObject.OutputConnectors) { if (cp.Type != ConType.ConEn) { CreateAndAddRow("Out", cp, mslist_out); } } foreach (var cp in SimObject.GraphicObject.InputConnectors) { if (cp.Type == ConType.ConEn) { CreateAndAddRow("In", cp, eslist_in); } } foreach (var cp in SimObject.GraphicObject.OutputConnectors) { if (cp.Type == ConType.ConEn) { CreateAndAddRow("Out", cp, eslist_out); } } if (SimObject.GraphicObject.EnergyConnector.Active) { CreateAndAddRow("Out", SimObject.GraphicObject.EnergyConnector, eslist_out); } }
void Initialize() { ThermalEditorDefinitions profile = ((Pipe)SimObject).ThermalProfile; var flowsheet = SimObject.GetFlowsheet(); var su = flowsheet.FlowsheetOptions.SelectedUnitSystem; var nf = flowsheet.FlowsheetOptions.NumberFormat; s.CreateAndAddLabelRow(container, "Definitions"); int position = 0; switch (profile.TipoPerfil) { case ThermalEditorDefinitions.ThermalProfileType.Definir_CGTC: position = 0; break; case ThermalEditorDefinitions.ThermalProfileType.Estimar_CGTC: position = 2; break; case ThermalEditorDefinitions.ThermalProfileType.Definir_Q: position = 1; break; } s.CreateAndAddDropDownRow(container, "Profile Type", Shared.StringArrays.thermalprofiletype().ToList(), position, (sender, e) => { switch (sender.SelectedIndex) { case 0: profile.TipoPerfil = ThermalEditorDefinitions.ThermalProfileType.Definir_CGTC; break; case 1: profile.TipoPerfil = ThermalEditorDefinitions.ThermalProfileType.Definir_Q; break; case 2: profile.TipoPerfil = ThermalEditorDefinitions.ThermalProfileType.Estimar_CGTC; break; } }); s.CreateAndAddLabelRow(container, "Defined HTC Parameters"); s.CreateAndAddTextBoxRow(container, nf, "Overall HTC (" + su.heat_transf_coeff + ")", cv.ConvertFromSI(su.heat_transf_coeff, profile.CGTC_Definido), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.CGTC_Definido = cv.ConvertToSI(su.heat_transf_coeff, double.Parse(sender.Text)); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddTextBoxRow(container, nf, "Ambient Temperature (" + su.temperature + ")", cv.ConvertFromSI(su.temperature, profile.Temp_amb_definir), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.Temp_amb_definir = cv.ConvertToSI(su.temperature, double.Parse(sender.Text)); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddTextBoxRow(container, nf, "Ambient Temperature Gradient (" + su.deltaT + "/" + su.distance + ")", cv.ConvertFromSI(su.deltaT, profile.AmbientTemperatureGradient) / cv.ConvertFromSI(su.distance, 1), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.AmbientTemperatureGradient = cv.ConvertToSI(su.deltaT, double.Parse(sender.Text)) / cv.ConvertToSI(su.distance, 1); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddLabelRow(container, "Defined Heat Exchange Parameters"); s.CreateAndAddTextBoxRow(container, nf, "Heat Exchanged (" + su.heatflow + ")", cv.ConvertFromSI(su.heatflow, profile.Calor_trocado), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.Calor_trocado = cv.ConvertToSI(su.heatflow, double.Parse(sender.Text)); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddLabelRow(container, "Calculated HTC Parameters"); s.CreateAndAddTextBoxRow(container, nf, "Ambient Temperature (" + su.temperature + ")", cv.ConvertFromSI(su.temperature, profile.Temp_amb_estimar), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.Temp_amb_estimar = cv.ConvertToSI(su.temperature, double.Parse(sender.Text)); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddTextBoxRow(container, nf, "Ambient Temperature Gradient (" + su.deltaT + "/" + su.distance + ")", cv.ConvertFromSI(su.deltaT, profile.AmbientTemperatureGradient_EstimateHTC) / cv.ConvertFromSI(su.distance, 1), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.AmbientTemperatureGradient_EstimateHTC = cv.ConvertToSI(su.deltaT, double.Parse(sender.Text)) / cv.ConvertToSI(su.distance, 1); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddCheckBoxRow(container, "Include Pipe Walls", profile.Incluir_paredes, (sender, e) => { profile.Incluir_paredes = sender.Checked.GetValueOrDefault(); }); s.CreateAndAddCheckBoxRow(container, "Include Internal HTC", profile.Incluir_cti, (sender, e) => { profile.Incluir_cti = sender.Checked.GetValueOrDefault(); }); s.CreateAndAddCheckBoxRow(container, "Include Insulation", profile.Incluir_isolamento, (sender, e) => { profile.Incluir_isolamento = sender.Checked.GetValueOrDefault(); }); s.CreateAndAddDropDownRow(container, "Insulation Material", Shared.StringArrays.insulationmaterial().ToList(), profile.Material, (sender, e) => { profile.Material = sender.SelectedIndex; switch (sender.SelectedIndex) { case 0: profile.Condtermica = 0.7; break; case 1: profile.Condtermica = 1.0; break; case 2: profile.Condtermica = 0.018; break; case 3: profile.Condtermica = 0.04; break; case 4: profile.Condtermica = 0.035; break; case 5: profile.Condtermica = 0.036; break; case 6: profile.Condtermica = 0.08; break; case 7: break; } }); s.CreateAndAddTextBoxRow(container, nf, "Insulation Thickness (" + su.thickness + ")", cv.ConvertFromSI(su.thickness, profile.Espessura), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.Espessura = cv.ConvertToSI(su.thickness, double.Parse(sender.Text)); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddTextBoxRow(container, nf, "User-Def. Thermal Cond. (" + su.thermalConductivity + ")", cv.ConvertFromSI(su.thermalConductivity, profile.Condtermica), (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.Condtermica = cv.ConvertToSI(su.thermalConductivity, double.Parse(sender.Text)); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddCheckBoxRow(container, "Include External HTC", profile.Incluir_cte, (sender, e) => { profile.Incluir_cte = sender.Checked.GetValueOrDefault(); }); s.CreateAndAddDropDownRow(container, "External Environment", Shared.StringArrays.external_env().ToList(), profile.Meio, (sender, e) => { profile.Meio = sender.SelectedIndex; }); s.CreateAndAddTextBoxRow(container, nf, "Velocity/Deepness (m/s | m)", profile.Velocidade, (sender, e) => { if (s.IsValidDouble(sender.Text)) { profile.Velocidade = double.Parse(sender.Text); } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)SimObject.GetFlowsheet()).HighLevelSolve.Invoke(); } }); s.CreateAndAddEmptySpace(container); s.CreateAndAddEmptySpace(container); }
public void Init() { loaded = false; Pages.Clear(); // connections if (obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.EnergyStream && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Controller_PID && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.LevelGauge && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.AnalogGauge && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.DigitalGauge && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Input && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Switch && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec) { var tab1 = new DocumentPage { Closable = false }; tab1.Text = "Connections"; var cont0 = UI.Shared.Common.GetDefaultContainer(); UI.Shared.Common.CreateAndAddLabelRow(cont0, "Object Connections Editor".Localize()); UI.Shared.Common.CreateAndAddDescriptionRow(cont0, "ConnectorsEditorDescription".Localize()); new DWSIM.UI.Desktop.Editors.ConnectionsEditor(obj, cont0); cont0.Width = this.Width - 30; var scr1 = new Scrollable() { Content = cont0 }; tab1.Content = scr1; Pages.Add(tab1); PageConnections = tab1; } // properties var tab2 = new DocumentPage { Closable = false }; tab2.Text = "Properties"; Pages.Add(tab2); var cont = UI.Shared.Common.GetDefaultContainer(); cont.Width = this.Width - 30; if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream) { new DWSIM.UI.Desktop.Editors.MaterialStreamEditor(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn) { new DWSIM.UI.Desktop.Editors.DistillationColumnEditor(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn) { new DWSIM.UI.Desktop.Editors.AbsorptionColumnEditor(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust) { DWSIM.UI.Desktop.Editors.LogicalBlocks.AdjustEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Controller_PID) { DWSIM.UI.Desktop.Editors.LogicalBlocks.PIDControllerEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec) { DWSIM.UI.Desktop.Editors.LogicalBlocks.SpecEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Recycle) { DWSIM.UI.Desktop.Editors.LogicalBlocks.RecycleEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_EnergyRecycle) { DWSIM.UI.Desktop.Editors.LogicalBlocks.EnergyRecycleEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.LevelGauge) { DWSIM.UI.Desktop.Editors.LogicalBlocks.LevelGaugeEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AnalogGauge) { DWSIM.UI.Desktop.Editors.LogicalBlocks.AnalogGaugeEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DigitalGauge) { DWSIM.UI.Desktop.Editors.LogicalBlocks.DigitalGaugeEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Switch) { DWSIM.UI.Desktop.Editors.LogicalBlocks.SwitchEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Input) { DWSIM.UI.Desktop.Editors.LogicalBlocks.InputEditor.Populate(obj, cont); } else { new DWSIM.UI.Desktop.Editors.GeneralEditors(obj, cont); } tab2.Content = new Scrollable() { Content = cont, Width = this.Width - 30 }; if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Pipe) { tab2.Text = "General"; var cont2 = UI.Shared.Common.GetDefaultContainer(); cont2.Tag = "Hydraulic Profile"; cont2.Width = this.Width - 30; new PipeHydraulicProfile(obj, cont2); Pages.Add(new DocumentPage(new Scrollable() { Content = cont2, Width = this.Width - 30 }) { Text = "Hydraulic Profile", Closable = false }); var cont3 = UI.Shared.Common.GetDefaultContainer(); cont3.Tag = "Thermal Profile"; cont3.Width = this.Width - 30; new PipeThermalProfile(obj, ((Pipe)obj).ThermalProfile, cont3); Pages.Add(new DocumentPage(new Scrollable() { Content = cont3, Width = this.Width - 30 }) { Text = "Thermal Profile", Closable = false }); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.CustomUO) { tab2.Text = "General"; var cont2 = new TableLayout { Padding = new Padding(10), Spacing = new Size(5, 5) }; cont2.Tag = "Python Script"; cont2.Width = this.Width - 30; if (Application.Instance.Platform.IsWpf) { var scripteditor = new Eto.Forms.Controls.Scintilla.Shared.ScintillaControl() { ScriptText = ((CustomUO)obj).ScriptText }; var dyn1 = new DynamicLayout(); dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) => { ((CustomUO)obj).ScriptText = scripteditor.ScriptText; }); dyn1.Width = this.Width - 30; cont2.Rows.Add(new TableRow(dyn1)); cont2.Rows.Add(new TableRow(scripteditor)); } else if (Application.Instance.Platform.IsMac || Application.Instance.Platform.IsGtk) { var scripteditor = new Eto.Forms.Controls.Scintilla.Shared.ScintillaControl() { ScriptText = ((CustomUO)obj).ScriptText }; scripteditor.SetKeywords(1, ((FlowsheetBase.FlowsheetBase)obj.GetFlowsheet()).ScriptKeywordsU); var dyn1 = new DynamicLayout(); dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) => { ((CustomUO)obj).ScriptText = scripteditor.ScriptText; }); dyn1.Width = this.Width - 30; cont2.Rows.Add(new TableRow(dyn1)); cont2.Rows.Add(new TableRow(scripteditor)); } Pages.Add(new DocumentPage(new Scrollable() { Content = cont2, Width = this.Width - 30 }) { Text = "Python Script", Closable = false }); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.HeatExchanger) { tab2.Text = "General"; var dyn1 = new ShellAndTubePropertiesView(obj); dyn1.Width = this.Width - 30; Pages.Add(new DocumentPage(new Scrollable() { Content = dyn1, Width = this.Width - 30 }) { Text = "Shell and Tube Properties", Closable = false }); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn) { tab2.Text = "General"; var dyn2 = RigorousColumnShared.GetInitialEstimatesEditor((Column)obj); dyn2.Width = this.Width - 30; Pages.Add(new DocumentPage(new Scrollable() { Content = dyn2, Width = this.Width - 30 }) { Text = "Initial Estimates", Closable = false }); } PageEditor = tab2; // dynamics if ((obj.SupportsDynamicMode && obj.HasPropertiesForDynamicMode) || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream) { if (obj.ExtraPropertiesDescriptions.Count() > 0 || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream) { var tabd = new DocumentPage { Closable = false }; tabd.Text = "Dynamics"; var contd = UI.Shared.Common.GetDefaultContainer(); contd.Width = this.Width - 30; new DynamicPropertiesEditor(obj, contd); tabd.Content = new Scrollable() { Content = contd, Width = this.Width - 30 }; PageDynamics = tabd; Pages.Add(tabd); } } // results var tabr = new DocumentPage { Closable = false }; tabr.Text = "Results"; var container = new TableLayout(); new DWSIM.UI.Desktop.Editors.Results(obj, container); tabr.Content = new Scrollable() { Content = container, Width = this.Width - 30 }; PageResults = tabr; Pages.Add(tabr); if (obj.GraphicObject is ShapeGraphic) { var tabx = new DocumentPage { Closable = false }; tabx.Text = "Appearance"; var editor = new ObjectAppearanceEditorView(obj.GetFlowsheet(), (ShapeGraphic)obj.GraphicObject); editor.Width = this.Width - 30; tabx.Content = new Scrollable() { Content = editor, Width = this.Width - 30 }; Pages.Add(tabx); } if (SelectedPanel >= 0) { SelectedIndex = SelectedPanel; } loaded = true; }
public static void Populate(ISimulationObject simobj, DynamicLayout container) { var su = simobj.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = simobj.GetFlowsheet().FlowsheetOptions.NumberFormat; var spec = (Spec)simobj; s.CreateAndAddLabelRow(container, "Object Details"); s.CreateAndAddTwoLabelsRow(container, "Status", simobj.GraphicObject.Active ? "Active" : "Inactive"); s.CreateAndAddStringEditorRow(container, "Name", simobj.GraphicObject.Tag, (TextBox arg3, EventArgs ev) => { simobj.GraphicObject.Tag = arg3.Text; }); var objlist = spec.GetFlowsheet().SimulationObjects.Values.Select((x2) => x2.GraphicObject.Tag).ToList(); objlist.Insert(0, ""); List <string> proplist = new List <string>(); s.CreateAndAddLabelRow(container, "Source Object"); DropDown spin1 = null, spin2 = null; Label txtval1 = null, txtval2 = null; spin1 = s.CreateAndAddDropDownRow(container, "Source Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (spec.GetFlowsheet().SimulationObjects.ContainsKey(spec.SourceObjectData.ID)) { var prevobj = spec.GetFlowsheet().SimulationObjects[spec.SourceObjectData.ID]; prevobj.IsSpecAttached = false; prevobj.AttachedSpecId = ""; prevobj.SpecVarType = SpecVarType.None; } var obj = spec.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); spec.SourceObjectData.ID = obj.Name; obj.IsSpecAttached = true; obj.AttachedSpecId = spec.Name; obj.SpecVarType = SpecVarType.Source; spec.SourceObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)obj; ((SpecGraphic)spec.GraphicObject).ConnectedToSv = (GraphicObject)obj.GraphicObject; proplist = obj.GetProperties(PropertyType.ALL).ToList(); proplist.Insert(0, ""); spin2.Items.Clear(); spin2.Items.AddRange(proplist.Select(x => new ListItem() { Text = spec.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (spec.SourceObjectData.PropertyName != "" && proplist.Contains(spec.SourceObjectData.PropertyName)) { spin2.SelectedIndex = (proplist.IndexOf(spec.SourceObjectData.PropertyName)); } } else { spin2.Items.Clear(); } }); spin2 = s.CreateAndAddDropDownRow(container, "Source Property", proplist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { spec.SourceObjectData.PropertyName = proplist[sender.SelectedIndex]; var obj = spec.GetFlowsheet().SimulationObjects[spec.SourceObjectData.ID]; var currval = Convert.ToDouble(obj.GetPropertyValue(proplist[sender.SelectedIndex], su)).ToString(nf) + " " + obj.GetPropertyUnit(proplist[sender.SelectedIndex], su); txtval1.Text = "Current Value: " + currval; } }); txtval1 = container.CreateAndAddLabelRow2("Current Value: N/A"); if (spec.SourceObjectData.ID != "" && spec.GetFlowsheet().SimulationObjects.ContainsKey(spec.SourceObjectData.ID)) { spin1.SelectedIndex = (objlist.IndexOf(spec.GetFlowsheet().SimulationObjects[spec.SourceObjectData.ID].GraphicObject.Tag)); } List <string> proplist2 = new List <string>(); s.CreateAndAddLabelRow(container, "Target Object"); DropDown spin3 = null, spin4 = null; spin3 = s.CreateAndAddDropDownRow(container, "Target Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (spec.GetFlowsheet().SimulationObjects.ContainsKey(spec.TargetObjectData.ID)) { var prevobj = spec.GetFlowsheet().SimulationObjects[spec.TargetObjectData.ID]; prevobj.IsSpecAttached = false; prevobj.AttachedSpecId = ""; prevobj.SpecVarType = SpecVarType.None; } var obj = spec.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); spec.TargetObjectData.ID = obj.Name; obj.IsSpecAttached = true; obj.AttachedSpecId = spec.Name; obj.SpecVarType = SpecVarType.Target; spec.TargetObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)spec.GetFlowsheet().SimulationObjects[spec.TargetObjectData.ID]; ((SpecGraphic)spec.GraphicObject).ConnectedToTv = (GraphicObject)spec.TargetObject.GraphicObject; proplist2 = spec.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]).GetProperties(PropertyType.WR).ToList(); proplist2.Insert(0, ""); spin4.Items.Clear(); spin4.Items.AddRange(proplist2.Select(x => new ListItem() { Text = spec.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (spec.TargetObjectData.PropertyName != "" && proplist2.Contains(spec.TargetObjectData.PropertyName)) { spin4.SelectedIndex = (proplist2.IndexOf(spec.TargetObjectData.PropertyName)); } } else { spin4.Items.Clear(); } }); spin4 = s.CreateAndAddDropDownRow(container, "Target Property", proplist2, 0, (sender, e) => { if (sender.SelectedIndex > 0) { spec.TargetObjectData.PropertyName = proplist2[sender.SelectedIndex]; var obj = spec.GetFlowsheet().SimulationObjects[spec.TargetObjectData.ID]; var currval = Convert.ToDouble(obj.GetPropertyValue(proplist2[sender.SelectedIndex], su)).ToString(nf) + " " + obj.GetPropertyUnit(proplist2[sender.SelectedIndex], su); txtval2.Text = "Current Value: " + currval; } }); txtval2 = container.CreateAndAddLabelRow2("Current Value: N/A"); if (spec.TargetObjectData.ID != "" && spec.GetFlowsheet().SimulationObjects.ContainsKey(spec.TargetObjectData.ID)) { spin3.SelectedIndex = (objlist.IndexOf(spec.GetFlowsheet().SimulationObjects[spec.TargetObjectData.ID].GraphicObject.Tag)); } container.CreateAndAddLabelRow("Expression"); container.CreateAndAddStringEditorRow2("Y = f(X) = ", "enter a math expression using X as the only variable", spec.Expression, (sender, e) => spec.Expression = sender.Text); }
public static void Populate(ISimulationObject simobj, DynamicLayout container) { var su = simobj.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = simobj.GetFlowsheet().FlowsheetOptions.NumberFormat; var adjust = (Adjust)simobj; s.CreateAndAddLabelRow(container, "Object Details"); s.CreateAndAddTwoLabelsRow(container, "Status", simobj.GraphicObject.Active ? "Active" : "Inactive"); s.CreateAndAddStringEditorRow(container, "Name", simobj.GraphicObject.Tag, (TextBox arg3, EventArgs ev) => { simobj.GraphicObject.Tag = arg3.Text; }); var objlist = adjust.GetFlowsheet().SimulationObjects.Values.Select((x2) => x2.GraphicObject.Tag).ToList(); objlist.Insert(0, ""); List <string> proplist = new List <string>(); s.CreateAndAddLabelRow(container, "Manipulated Object"); DropDown spin1 = null, spin2 = null; spin1 = s.CreateAndAddDropDownRow(container, "Manipulated Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ManipulatedObjectData.ID)) { var prevobj = adjust.GetFlowsheet().SimulationObjects[adjust.ManipulatedObjectData.ID]; prevobj.IsAdjustAttached = false; prevobj.AttachedAdjustId = ""; prevobj.AdjustVarType = AdjustVarType.None; } var obj = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); adjust.ManipulatedObjectData.ID = obj.Name; obj.IsAdjustAttached = true; obj.AttachedAdjustId = adjust.Name; obj.AdjustVarType = AdjustVarType.Manipulated; adjust.ManipulatedObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)obj; ((AdjustGraphic)adjust.GraphicObject).ConnectedToMv = (GraphicObject)obj.GraphicObject; proplist = obj.GetProperties(PropertyType.WR).ToList(); proplist.Insert(0, ""); spin2.Items.Clear(); spin2.Items.AddRange(proplist.Select(x => new ListItem() { Text = adjust.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (adjust.ManipulatedObjectData.PropertyName != "" && proplist.Contains(adjust.ManipulatedObjectData.PropertyName)) { spin2.SelectedIndex = (proplist.IndexOf(adjust.ManipulatedObjectData.PropertyName)); } } else { spin2.Items.Clear(); } }); spin2 = s.CreateAndAddDropDownRow(container, "Manipulated Property", proplist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { adjust.ManipulatedObjectData.PropertyName = proplist[sender.SelectedIndex]; } }); if (adjust.ManipulatedObjectData.ID != "" && adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ManipulatedObjectData.ID)) { spin1.SelectedIndex = (objlist.IndexOf(adjust.GetFlowsheet().SimulationObjects[adjust.ManipulatedObjectData.ID].GraphicObject.Tag)); } List <string> proplist2 = new List <string>(); s.CreateAndAddLabelRow(container, "Controlled Object"); DropDown spin3 = null, spin4 = null; spin3 = s.CreateAndAddDropDownRow(container, "Controlled Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ControlledObjectData.ID)) { var prevobj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; prevobj.IsAdjustAttached = false; prevobj.AttachedAdjustId = ""; prevobj.AdjustVarType = AdjustVarType.None; } var obj = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); adjust.ControlledObjectData.ID = obj.Name; obj.IsAdjustAttached = true; obj.AttachedAdjustId = adjust.Name; obj.AdjustVarType = AdjustVarType.Controlled; adjust.ControlledObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; ((AdjustGraphic)adjust.GraphicObject).ConnectedToCv = (GraphicObject)adjust.ControlledObject.GraphicObject; proplist2 = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]).GetProperties(PropertyType.ALL).ToList(); proplist2.Insert(0, ""); spin4.Items.Clear(); spin4.Items.AddRange(proplist2.Select(x => new ListItem() { Text = adjust.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (adjust.ControlledObjectData.PropertyName != "" && proplist2.Contains(adjust.ControlledObjectData.PropertyName)) { spin4.SelectedIndex = (proplist2.IndexOf(adjust.ControlledObjectData.PropertyName)); } } else { spin4.Items.Clear(); } }); Label txtval = null; spin4 = s.CreateAndAddDropDownRow(container, "Controlled Property", proplist2, 0, (sender, e) => { if (sender.SelectedIndex > 0) { adjust.ControlledObjectData.PropertyName = proplist2[sender.SelectedIndex]; var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; var currval = Convert.ToDouble(obj.GetPropertyValue(proplist2[sender.SelectedIndex], su)).ToString(nf) + " " + obj.GetPropertyUnit(proplist2[sender.SelectedIndex], su); txtval.Text = "Current Value: " + currval; } }); txtval = s.CreateAndAddLabelRow(container, "Current Value: N/A"); var txtvalue = s.CreateAndAddTextBoxRow(container, nf, "Target Value", 0.0f, (sender, e) => { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ControlledObjectData.ID)) { var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; if (s.IsValidDouble(sender.Text)) { adjust.AdjustValue = cv.ConvertToSI(obj.GetPropertyUnit(adjust.ControlledObjectData.PropertyName, su), Double.Parse(sender.Text)); } } }); if (adjust.ControlledObjectData.ID != "" && adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ControlledObjectData.ID)) { spin3.SelectedIndex = (objlist.IndexOf(adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID].GraphicObject.Tag)); var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; txtvalue.Text = cv.ConvertFromSI(obj.GetPropertyUnit(adjust.ControlledObjectData.PropertyName, su), adjust.AdjustValue).ToString(nf); } s.CreateAndAddCheckBoxRow(container, "Run with the Simultaneous Adjust Solver", adjust.SimultaneousAdjust, (sender, e) => adjust.SimultaneousAdjust = sender.Checked.GetValueOrDefault()); }
public static void Populate(ISimulationObject simobj, DynamicLayout container) { var su = simobj.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = simobj.GetFlowsheet().FlowsheetOptions.NumberFormat; var adjust = (Adjust)simobj; s.CreateAndAddLabelRow(container, "Object Details"); s.CreateAndAddTwoLabelsRow(container, "Status", simobj.GraphicObject.Active ? "Active" : "Inactive"); s.CreateAndAddStringEditorRow(container, "Name", simobj.GraphicObject.Tag, (TextBox arg3, EventArgs ev) => { simobj.GraphicObject.Tag = arg3.Text; }); var objlist = adjust.GetFlowsheet().SimulationObjects.Values.Select((x2) => x2.GraphicObject.Tag).ToList(); objlist.Insert(0, ""); List <string> proplist = new List <string>(); s.CreateAndAddLabelRow(container, "Manipulated Object"); DropDown spin1 = null, spin2 = null; Label lblMv = null, lblCv = null, lblRv = null; spin1 = s.CreateAndAddDropDownRow(container, "Manipulated Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ManipulatedObjectData.ID)) { var prevobj = adjust.GetFlowsheet().SimulationObjects[adjust.ManipulatedObjectData.ID]; prevobj.IsAdjustAttached = false; prevobj.AttachedAdjustId = ""; prevobj.AdjustVarType = AdjustVarType.None; } var obj = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); adjust.ManipulatedObjectData.ID = obj.Name; obj.IsAdjustAttached = true; obj.AttachedAdjustId = adjust.Name; obj.AdjustVarType = AdjustVarType.Manipulated; adjust.ManipulatedObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)obj; ((AdjustGraphic)adjust.GraphicObject).ConnectedToMv = (GraphicObject)obj.GraphicObject; proplist = obj.GetProperties(PropertyType.WR).ToList(); proplist.Insert(0, ""); spin2.Items.Clear(); spin2.Items.AddRange(proplist.Select(x => new ListItem() { Text = adjust.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (adjust.ManipulatedObjectData.PropertyName != "" && proplist.Contains(adjust.ManipulatedObjectData.PropertyName)) { spin2.SelectedIndex = (proplist.IndexOf(adjust.ManipulatedObjectData.PropertyName)); } } else { spin2.Items.Clear(); } }); spin2 = s.CreateAndAddDropDownRow(container, "Manipulated Property", proplist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { adjust.ManipulatedObjectData.PropertyName = proplist[sender.SelectedIndex]; var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ManipulatedObjectData.ID]; var currval = Convert.ToDouble(obj.GetPropertyValue(proplist[sender.SelectedIndex], su)).ToString(nf) + " " + obj.GetPropertyUnit(proplist[sender.SelectedIndex], su); lblMv.Text = "Current Value: " + currval; } }); lblMv = s.CreateAndAddLabelRow2(container, ""); List <string> proplist2 = new List <string>(); s.CreateAndAddLabelRow(container, "Controlled Object"); DropDown spin3 = null, spin4 = null; spin3 = s.CreateAndAddDropDownRow(container, "Controlled Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ControlledObjectData.ID)) { var prevobj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; prevobj.IsAdjustAttached = false; prevobj.AttachedAdjustId = ""; prevobj.AdjustVarType = AdjustVarType.None; } var obj = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); adjust.ControlledObjectData.ID = obj.Name; obj.IsAdjustAttached = true; obj.AttachedAdjustId = adjust.Name; obj.AdjustVarType = AdjustVarType.Controlled; adjust.ControlledObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; ((AdjustGraphic)adjust.GraphicObject).ConnectedToCv = (GraphicObject)adjust.ControlledObject.GraphicObject; proplist2 = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]).GetProperties(PropertyType.ALL).ToList(); proplist2.Insert(0, ""); spin4.Items.Clear(); spin4.Items.AddRange(proplist2.Select(x => new ListItem() { Text = adjust.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (adjust.ControlledObjectData.PropertyName != "" && proplist2.Contains(adjust.ControlledObjectData.PropertyName)) { spin4.SelectedIndex = (proplist2.IndexOf(adjust.ControlledObjectData.PropertyName)); } } else { spin4.Items.Clear(); } }); spin4 = s.CreateAndAddDropDownRow(container, "Controlled Property", proplist2, 0, (sender, e) => { if (sender.SelectedIndex > 0) { adjust.ControlledObjectData.PropertyName = proplist2[sender.SelectedIndex]; var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; var currval = Convert.ToDouble(obj.GetPropertyValue(proplist2[sender.SelectedIndex], su)).ToString(nf) + " " + obj.GetPropertyUnit(proplist2[sender.SelectedIndex], su); lblCv.Text = "Current Value: " + currval; } }); lblCv = s.CreateAndAddLabelRow2(container, ""); List <string> proplist3 = new List <string>(); s.CreateAndAddLabelRow(container, "Referenced Object"); s.CreateAndAddCheckBoxRow(container, "Use Referenced Object", adjust.Referenced, (sender, e) => { adjust.Referenced = sender.Checked.GetValueOrDefault(); }); s.CreateAndAddDescriptionRow(container, "When a Reference Object is used, the Adjust/Controller block will change the Manipulated Variable so the Controlled Variable matches the Referenced value plus/minus the defined Set-Point/Offset."); DropDown spin5 = null, spin6 = null; spin5 = s.CreateAndAddDropDownRow(container, "Referenced Object", objlist, 0, (sender, e) => { if (sender.SelectedIndex > 0) { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ReferencedObjectData.ID)) { var prevobj = adjust.GetFlowsheet().SimulationObjects[adjust.ReferencedObjectData.ID]; prevobj.IsAdjustAttached = false; prevobj.AttachedAdjustId = ""; prevobj.AdjustVarType = AdjustVarType.None; } var obj = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]); adjust.ReferencedObjectData.ID = obj.Name; obj.IsAdjustAttached = true; obj.AttachedAdjustId = adjust.Name; obj.AdjustVarType = AdjustVarType.Reference; adjust.ReferenceObject = (DWSIM.SharedClasses.UnitOperations.BaseClass)adjust.GetFlowsheet().SimulationObjects[adjust.ReferencedObjectData.ID]; ((AdjustGraphic)adjust.GraphicObject).ConnectedToRv = (GraphicObject)adjust.ReferenceObject.GraphicObject; proplist3 = adjust.GetFlowsheet().GetFlowsheetSimulationObject(objlist[sender.SelectedIndex]).GetProperties(PropertyType.ALL).ToList(); proplist3.Insert(0, ""); spin6.Items.Clear(); spin6.Items.AddRange(proplist3.Select(x => new ListItem() { Text = adjust.GetFlowsheet().GetTranslatedString(x) }).ToList()); if (adjust.ReferencedObjectData.PropertyName != "" && proplist3.Contains(adjust.ReferencedObjectData.PropertyName)) { spin6.SelectedIndex = (proplist3.IndexOf(adjust.ReferencedObjectData.PropertyName)); } } else { spin6.Items.Clear(); } }); spin6 = s.CreateAndAddDropDownRow(container, "Referenced Property", proplist3, 0, (sender, e) => { if (sender.SelectedIndex > 0) { adjust.ReferencedObjectData.PropertyName = proplist3[sender.SelectedIndex]; var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ReferencedObjectData.ID]; var currval = Convert.ToDouble(obj.GetPropertyValue(proplist3[sender.SelectedIndex], su)).ToString(nf) + " " + obj.GetPropertyUnit(proplist3[sender.SelectedIndex], su); lblRv.Text = "Current Value: " + currval; } }); lblRv = s.CreateAndAddLabelRow2(container, ""); s.CreateAndAddLabelRow(container, "Controller Parameters"); var txtvalue = s.CreateAndAddTextBoxRow(container, nf, "Set-Point/Offset", 0.0f, (sender, e) => { if (adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ControlledObjectData.ID)) { var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; if (s.IsValidDouble(sender.Text)) { if (adjust.Referenced) { obj = adjust.GetFlowsheet().SimulationObjects[adjust.ReferencedObjectData.ID]; var punit = obj.GetPropertyUnit(adjust.ReferencedObjectData.PropertyName, su); if (su.GetUnitType(punit) == UnitOfMeasure.temperature) { adjust.AdjustValue = cv.ConvertToSI(punit + ".", Double.Parse(sender.Text)); } else { adjust.AdjustValue = cv.ConvertToSI(punit, Double.Parse(sender.Text)); } } else { adjust.AdjustValue = cv.ConvertToSI(obj.GetPropertyUnit(adjust.ControlledObjectData.PropertyName, su), Double.Parse(sender.Text)); } } } }, () => { if (GlobalSettings.Settings.CallSolverOnEditorPropertyChanged) { ((Shared.Flowsheet)adjust.GetFlowsheet()).HighLevelSolve.Invoke(); } }); if (adjust.ManipulatedObjectData.ID != "" && adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ManipulatedObjectData.ID)) { spin1.SelectedIndex = (objlist.IndexOf(adjust.GetFlowsheet().SimulationObjects[adjust.ManipulatedObjectData.ID].GraphicObject.Tag)); } if (adjust.ControlledObjectData.ID != "" && adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ControlledObjectData.ID)) { spin3.SelectedIndex = (objlist.IndexOf(adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID].GraphicObject.Tag)); var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ControlledObjectData.ID]; txtvalue.Text = cv.ConvertFromSI(obj.GetPropertyUnit(adjust.ControlledObjectData.PropertyName, su), adjust.AdjustValue).ToString(nf); } if (adjust.ReferencedObjectData.ID != "" && adjust.GetFlowsheet().SimulationObjects.ContainsKey(adjust.ReferencedObjectData.ID)) { spin5.SelectedIndex = (objlist.IndexOf(adjust.GetFlowsheet().SimulationObjects[adjust.ReferencedObjectData.ID].GraphicObject.Tag)); var obj = adjust.GetFlowsheet().SimulationObjects[adjust.ReferencedObjectData.ID]; txtvalue.Text = cv.ConvertFromSI(obj.GetPropertyUnit(adjust.ReferencedObjectData.PropertyName, su), adjust.AdjustValue).ToString(nf); } s.CreateAndAddCheckBoxRow(container, "Run with the Simultaneous Adjust Solver", adjust.SimultaneousAdjust, (sender, e) => adjust.SimultaneousAdjust = sender.Checked.GetValueOrDefault()); }
void Initialize() { var su = SimObject.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = SimObject.GetFlowsheet().FlowsheetOptions.NumberFormat; if (SimObject is Pipe) { var pipe = (Pipe)SimObject; string[] datatype = { "Length", "Inclination", "Pressure", "Temperature", "Liquid Velocity", "Vapor Velocity", "Heat Flow", "Liquid Holdup", "Overall HTC", "Internal HTC", "Wall k/L", "Insulation k/L", "External HTC" }; string[] units = { su.distance, "degrees", su.pressure, su.temperature, su.velocity, su.velocity, su.heatflow, "", su.heat_transf_coeff, su.heat_transf_coeff, su.heat_transf_coeff, su.heat_transf_coeff, su.heat_transf_coeff }; var btn = new Button { Text = "View Pipe Properties Profile" }; container.Rows.Add(new TableRow(btn)); btn.Click += (sender, e) => { var plotcontainer = s.GetDefaultContainer(); var chart = new Eto.OxyPlot.Plot() { Height = 400, BackgroundColor = Colors.White }; chart.Visible = true; List <double> px, py; var txtres = s.CreateAndAddMultilineMonoSpaceTextBoxRow(plotcontainer, "", 400, true, null); s.CreateAndAddLabelRow(plotcontainer, "Pipe Segment Profiles: " + SimObject.GraphicObject.Tag); var xsp = s.CreateAndAddDropDownRow(plotcontainer, "X Axis Data", datatype.ToList(), 0, null); var ysp = s.CreateAndAddDropDownRow(plotcontainer, "Y Axis Data", datatype.ToList(), 2, null); s.CreateAndAddButtonRow(plotcontainer, "Update Chart/Table", null, (sender2, e2) => { px = PopulateData(pipe, xsp.SelectedIndex); py = PopulateData(pipe, ysp.SelectedIndex); var model = CreatePipeResultsModel(px.ToArray(), py.ToArray(), datatype[xsp.SelectedIndex] + " (" + units[xsp.SelectedIndex] + ")", datatype[ysp.SelectedIndex] + " (" + units[ysp.SelectedIndex] + ")"); chart.Model = model; chart.Visible = true; chart.Model.InvalidatePlot(true); chart.Invalidate(); int i = 0; var txt = new System.Text.StringBuilder(); txt.AppendLine(datatype[xsp.SelectedIndex] + " (" + units[xsp.SelectedIndex] + ")\t\t" + datatype[ysp.SelectedIndex] + " (" + units[ysp.SelectedIndex] + ")"); for (i = 0; i <= px.Count - 1; i++) { txt.AppendLine(px[i].ToString(nf) + "\t\t" + py[i].ToString(nf)); } txtres.Text = txt.ToString(); }); s.CreateAndAddLabelRow(plotcontainer, "Results Chart"); s.CreateAndAddControlRow(plotcontainer, chart); s.CreateAndAddEmptySpace(plotcontainer); s.CreateAndAddLabelRow(plotcontainer, "Results Table"); s.CreateAndAddControlRow(plotcontainer, txtres); var form = s.GetDefaultEditorForm("Pipe Properties Profile: " + SimObject.GraphicObject.Tag, 400, 500, plotcontainer); form.Topmost = true; form.Show(); }; } else if (SimObject is Column) { var column = (Column)SimObject; string[] datatype = { "Stage", "Pressure", "Temperature", "Vapor Molar Flow", "Liquid Molar Flow" }; string[] units = { "", su.pressure, su.temperature, su.molarflow, su.molarflow }; var btn = new Button { Text = "View Column Properties Profile" }; container.Rows.Add(new TableRow(btn)); btn.Click += (sender, e) => { var plotcontainer = s.GetDefaultContainer(); var chart = new Eto.OxyPlot.Plot() { Height = 400, BackgroundColor = Colors.White }; chart.Visible = true; List <double> px, py; s.CreateAndAddLabelRow(plotcontainer, "Column Profile Results: " + SimObject.GraphicObject.Tag); var xsp = s.CreateAndAddDropDownRow(plotcontainer, "X Axis Data", datatype.ToList(), 2, null); var ysp = s.CreateAndAddDropDownRow(plotcontainer, "Y Axis Data", datatype.ToList(), 0, null); s.CreateAndAddButtonRow(plotcontainer, "Update Chart", null, (sender2, e2) => { px = PopulateColumnData(column, xsp.SelectedIndex); py = PopulateColumnData(column, ysp.SelectedIndex); string xunits, yunits; xunits = " (" + units[xsp.SelectedIndex] + ")"; yunits = " (" + units[ysp.SelectedIndex] + ")"; if (xsp.SelectedIndex == 0) { xunits = ""; } if (ysp.SelectedIndex == 0) { yunits = ""; } var model = CreateColumnResultsModel(px.ToArray(), py.ToArray(), datatype[xsp.SelectedIndex] + xunits, datatype[ysp.SelectedIndex] + yunits); chart.Model = model; chart.Visible = true; chart.Model.InvalidatePlot(true); chart.Invalidate(); }); s.CreateAndAddLabelRow(plotcontainer, "Results Chart"); s.CreateAndAddControlRow(plotcontainer, chart); s.CreateAndAddEmptySpace(plotcontainer); var form = s.GetDefaultEditorForm("Column Profile: " + SimObject.GraphicObject.Tag, 400, 500, plotcontainer); form.Topmost = true; form.Show(); }; } else if (SimObject is Reactor_PFR) { var reactor = (Reactor_PFR)SimObject; if (reactor.points != null && reactor.points.Count > 0) { var btn = new Button { Text = "View PFR Properties Profile" }; container.Rows.Add(new TableRow(btn)); btn.Click += (sender, e) => { var chart = new Eto.OxyPlot.Plot() { Height = 400, BackgroundColor = Colors.White }; chart.Visible = true; var model = CreatePFRResultsModel(reactor); chart.Model = model; chart.Model.InvalidatePlot(true); chart.Invalidate(); var form = new Form() { Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico"), Content = new Scrollable { Content = chart, Border = BorderType.None, ExpandContentWidth = true, ExpandContentHeight = true }, Title = "PFR Profile: " + SimObject.GraphicObject.Tag, ClientSize = new Size(800, 600), ShowInTaskbar = false, Maximizable = false, Minimizable = false, Topmost = true, Resizable = true }; form.Show(); }; } } else if (SimObject is HeatExchanger) { var hx = (HeatExchanger)SimObject; if (hx.CalculationMode == HeatExchangerCalcMode.PinchPoint && hx.HeatProfile.Length > 0) { var btn = new Button { Text = "View Heat Exchanged Profile" }; container.Rows.Add(new TableRow(btn)); btn.Click += (sender, e) => { var chart = new Eto.OxyPlot.Plot() { Height = 400, BackgroundColor = Colors.White }; chart.Visible = true; var model = s.CreatePlotModel(hx.HeatProfile.ToList().ConvertFromSI(su.heatflow).ToArray(), hx.TemperatureProfileCold.ToList().ConvertFromSI(su.temperature).ToArray(), hx.TemperatureProfileHot.ToList().ConvertFromSI(su.temperature).ToArray(), "Heat Profile", hx.GraphicObject.Tag, "Heat Exchanged (" + su.heatflow + ")", "Temperature (" + su.temperature + ")", "Cold Fluid", "Hot Fluid"); chart.Model = model; chart.Model.InvalidatePlot(true); chart.Invalidate(); var form = new Form() { Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico"), Content = new Scrollable { Content = chart, Border = BorderType.None, ExpandContentWidth = true, ExpandContentHeight = true }, Title = "Heat Profile: " + SimObject.GraphicObject.Tag, ClientSize = new Size(800, 600), ShowInTaskbar = false, Maximizable = false, Minimizable = false, Topmost = true, Resizable = true }; form.Show(); }; } } var obj = (ISimulationObject)SimObject; var structreport = obj.GetStructuredReport(); if (structreport.Count > 0) { var containerd = UI.Shared.Common.GetDefaultContainer(); container.Rows.Add(new TableRow(containerd)); foreach (var item in structreport) { switch (item.Item1) { case Interfaces.Enums.ReportItemType.Label: containerd.CreateAndAddLabelRow(item.Item2[0]); break; case Interfaces.Enums.ReportItemType.Description: containerd.CreateAndAddDescriptionRow(item.Item2[0]); break; case Interfaces.Enums.ReportItemType.SingleColumn: containerd.CreateAndAddLabelRow2(item.Item2[0]); break; case Interfaces.Enums.ReportItemType.DoubleColumn: containerd.CreateAndAddThreeLabelsRow(item.Item2[0], item.Item2[1], ""); break; case Interfaces.Enums.ReportItemType.TripleColumn: containerd.CreateAndAddThreeLabelsRow(item.Item2[0], item.Item2[1], item.Item2[2]); break; } } } else { var txtcontrol = new TextArea { ReadOnly = true }; txtcontrol.Font = GlobalSettings.Settings.RunningPlatform() == GlobalSettings.Settings.Platform.Mac ? new Font("Menlo", GlobalSettings.Settings.ResultsReportFontSize) : Fonts.Monospace(GlobalSettings.Settings.ResultsReportFontSize); container.Rows.Add(new TableRow(txtcontrol)); try { if (obj.Calculated) { txtcontrol.Text = "Object successfully calculated on " + obj.LastUpdated.ToString() + "\n\n"; txtcontrol.Text += obj.GetReport(SimObject.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem, System.Globalization.CultureInfo.InvariantCulture, SimObject.GetFlowsheet().FlowsheetOptions.NumberFormat); } else { if (obj.ErrorMessage != "") { txtcontrol.Text = "An error occured during the calculation of this object. Details:\n\n" + obj.ErrorMessage; } else { txtcontrol.Text = "This object hasn't been calculated yet."; } } } catch (Exception ex) { txtcontrol.Text = "Report generation failed. Please recalculate the flowsheet and try again."; txtcontrol.Text += "\n\nError details: " + ex.ToString(); } } }
void Initialize() { var profile = (PipeProfile)((Pipe)SimObject).Profile; profile.Status = PipeEditorStatus.OK; var flowsheet = SimObject.GetFlowsheet(); var su = flowsheet.FlowsheetOptions.SelectedUnitSystem; var nf = flowsheet.FlowsheetOptions.NumberFormat; var sectioncontainer = new StackLayout { Orientation = Orientation.Horizontal, Padding = new Eto.Drawing.Padding(10), Spacing = 10 }; s.CreateAndAddButtonRow(container, "Add Segment", null, (arg1, arg2) => { var ps = new PipeSection() { Indice = profile.Sections.Count + 1, Incrementos = 10, Comprimento = 1, Quantidade = 1 }; profile.Sections.Add(ps.Indice, ps); var pscontainer = new DynamicLayout(); var slcontainer = new StackLayoutItem(pscontainer); //pscontainer.BackgroundColor = Eto.Drawing.Colors.White; var editor = new PipeSectionEditor(flowsheet, (Pipe)SimObject, profile.Sections[ps.Indice], pscontainer); var btnRemove = s.CreateAndAddButtonRow(pscontainer, "Remove Segment", null, null); btnRemove.Click += (sender, e) => { if (MessageBox.Show("Remove segment?", MessageBoxButtons.YesNo, MessageBoxType.Question, MessageBoxDefaultButton.No) == DialogResult.Yes) { profile.Sections.Remove(ps.Indice); sectioncontainer.Items.Remove(slcontainer); } ; }; sectioncontainer.Items.Add(slcontainer); }); s.CreateAndAddButtonRow(container, "Remove All Segments", null, (arg1, arg2) => { if (MessageBox.Show("Remove all segments?", MessageBoxButtons.YesNo, MessageBoxType.Question, MessageBoxDefaultButton.No) == DialogResult.Yes) { profile.Sections.Clear(); sectioncontainer.RemoveAll(); sectioncontainer.Items.Clear(); } ; }); container.Add(new Scrollable { Border = BorderType.None, Content = sectioncontainer }); foreach (var section in profile.Sections.Values) { var pscontainer = new DynamicLayout(); var slcontainer = new StackLayoutItem(pscontainer); //pscontainer.BackgroundColor = Eto.Drawing.Colors.White; var editor = new PipeSectionEditor(flowsheet, (Pipe)SimObject, section, pscontainer); var btnRemove = s.CreateAndAddButtonRow(pscontainer, "Remove Segment", null, null); btnRemove.Click += (sender, e) => { if (MessageBox.Show("Remove segment?", MessageBoxButtons.YesNo, MessageBoxType.Question, MessageBoxDefaultButton.No) == DialogResult.Yes) { profile.Sections.Remove(section.Indice); sectioncontainer.Items.Remove(slcontainer); } ; }; sectioncontainer.Items.Add(slcontainer); } }
void Init() { Padding = new Eto.Drawing.Padding(10); var su = SimObject.GetFlowsheet().FlowsheetOptions.SelectedUnitSystem; var nf = SimObject.GetFlowsheet().FlowsheetOptions.NumberFormat; var st = ((HeatExchanger)SimObject).STProperties; this.CreateAndAddLabelRow("Shell Side Properties"); var tbShellsInSeries = this.CreateAndAddTextBoxRow(nf, "Shells in Series", 0, null); var tbNumberOfShellPasses = this.CreateAndAddTextBoxRow(nf, "Shell Passes", 0, null); var tbShellDi = this.CreateAndAddTextBoxRow(nf, "Internal Diameter" + " (" + su.diameter + ")", 0, null); var tbShellFoulingFactor = this.CreateAndAddTextBoxRow(nf, "Fouling Factor" + " (" + su.foulingfactor + ")", 0, null); var tbBaffleSpacing = this.CreateAndAddTextBoxRow(nf, "Baffle Spacing" + " (" + su.thickness + ")", 0, null); var tbBaffleCut = this.CreateAndAddTextBoxRow(nf, "Baffle Cut (% diameter)", 0, null); var cbBaffleType = this.CreateAndAddDropDownRow("Baffle Type", new List <string>() { "Single", "Double", "Triple", "Quadruple" }, 0, null); var cbBaffleOrientation = this.CreateAndAddDropDownRow("Baffle Orientation", new List <string>() { "Horizontal", "Vertical" }, 0, null); cbBaffleType.Enabled = false; cbBaffleOrientation.Enabled = false; this.CreateAndAddLabelRow("Tube Side Properties"); var tbTubeDi = this.CreateAndAddTextBoxRow(nf, "Internal Diameter" + " (" + su.diameter + ")", 0, null); var tbTubeDe = this.CreateAndAddTextBoxRow(nf, "External Diameter" + " (" + su.diameter + ")", 0, null); var tbTubeLength = this.CreateAndAddTextBoxRow(nf, "Length" + " (" + su.distance + ")", 0, null); var tbTubeFoulingFactor = this.CreateAndAddTextBoxRow(nf, "Fouling Factor" + " (" + su.foulingfactor + ")", 0, null); var tbTubeRoughness = this.CreateAndAddTextBoxRow(nf, "Roughness" + " (" + su.diameter + ")", 0, null); var tbTubeThermalCond = this.CreateAndAddTextBoxRow(nf, "Thermal Conductivity" + " (" + su.thermalConductivity + ")", 0, null); var tbTubePassesPerShell = this.CreateAndAddTextBoxRow(nf, "Passes per Shell", 0, null); var tbNumberOfTubesPerShell = this.CreateAndAddTextBoxRow(nf, "Tubes per Shell", 0, null); var tbTubePitch = this.CreateAndAddTextBoxRow(nf, "Tube Spacing" + " (" + su.thickness + ")", 0, null); var cbTubeLayout = this.CreateAndAddDropDownRow("Tube Layout", new List <string>() { "Triangle", "Rotated Triangle", "Square", "Rotated Square" }, 0, null); var cbFluidInTubes = this.CreateAndAddDropDownRow("Fluid in Tubes", new List <string>() { "Hot", "Cold" }, 0, null); this.CreateAndAddEmptySpace(); this.CreateAndAddEmptySpace(); tbBaffleCut.Text = st.Shell_BaffleCut.ToString(nf); tbBaffleSpacing.Text = cv.ConvertFromSI(su.thickness, st.Shell_BaffleSpacing).ToString(nf); tbNumberOfShellPasses.Text = st.Shell_NumberOfPasses.ToString(); tbNumberOfTubesPerShell.Text = st.Tube_NumberPerShell.ToString(); tbShellDi.Text = cv.ConvertFromSI(su.diameter, st.Shell_Di).ToString(nf); tbShellFoulingFactor.Text = cv.ConvertFromSI(su.foulingfactor, st.Shell_Fouling).ToString(nf); tbShellsInSeries.Text = st.Shell_NumberOfShellsInSeries.ToString(); tbTubeDe.Text = cv.ConvertFromSI(su.diameter, st.Tube_De).ToString(nf); tbTubeDi.Text = cv.ConvertFromSI(su.diameter, st.Tube_Di).ToString(nf); tbTubeFoulingFactor.Text = cv.ConvertFromSI(su.foulingfactor, st.Tube_Fouling).ToString(nf); tbTubeLength.Text = cv.ConvertFromSI(su.distance, st.Tube_Length).ToString(nf); tbTubePassesPerShell.Text = st.Tube_PassesPerShell.ToString(); tbTubePitch.Text = cv.ConvertFromSI(su.thickness, st.Tube_Pitch).ToString(nf); tbTubeRoughness.Text = cv.ConvertFromSI(su.diameter, st.Tube_Roughness).ToString(nf); tbTubeThermalCond.Text = cv.ConvertFromSI(su.thermalConductivity, st.Tube_ThermalConductivity).ToString(nf); cbBaffleOrientation.SelectedIndex = st.Shell_BaffleOrientation; cbBaffleType.SelectedIndex = st.Shell_BaffleType; cbTubeLayout.SelectedIndex = st.Tube_Layout; cbFluidInTubes.SelectedIndex = st.Tube_Fluid; tbBaffleCut.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Shell_BaffleCut = ((TextBox)sender).Text.ToDoubleFromCurrent(); } }; tbBaffleSpacing.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Shell_BaffleSpacing = cv.ConvertToSI(su.thickness, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbNumberOfShellPasses.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Shell_NumberOfPasses = (int)((TextBox)sender).Text.ToDoubleFromCurrent(); } }; tbNumberOfTubesPerShell.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_NumberPerShell = (int)((TextBox)sender).Text.ToDoubleFromCurrent(); } }; tbShellDi.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Shell_Di = cv.ConvertToSI(su.diameter, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbShellFoulingFactor.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Shell_Fouling = cv.ConvertToSI(su.foulingfactor, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbShellsInSeries.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Shell_NumberOfShellsInSeries = (int)((TextBox)sender).Text.ToDoubleFromCurrent(); } }; tbTubeDe.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_De = cv.ConvertToSI(su.diameter, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbTubeDi.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_Di = cv.ConvertToSI(su.diameter, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbTubeFoulingFactor.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_Fouling = cv.ConvertToSI(su.foulingfactor, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbTubeLength.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_Length = cv.ConvertToSI(su.distance, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbTubePassesPerShell.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_PassesPerShell = (int)((TextBox)sender).Text.ToDoubleFromCurrent(); } }; tbTubePitch.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_Pitch = cv.ConvertToSI(su.thickness, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbTubeRoughness.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_Roughness = cv.ConvertToSI(su.diameter, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; tbTubeThermalCond.TextChanged += (sender, e) => { if (((TextBox)sender).Text.IsValidDouble()) { st.Tube_ThermalConductivity = cv.ConvertToSI(su.thermalConductivity, ((TextBox)sender).Text.ToDoubleFromCurrent()); } }; cbBaffleOrientation.SelectedIndexChanged += (sender, e) => st.Shell_BaffleOrientation = cbBaffleOrientation.SelectedIndex; cbBaffleType.SelectedIndexChanged += (sender, e) => st.Shell_BaffleType = cbBaffleType.SelectedIndex; cbTubeLayout.SelectedIndexChanged += (sender, e) => st.Tube_Layout = cbTubeLayout.SelectedIndex; cbFluidInTubes.SelectedIndexChanged += (sender, e) => st.Tube_Fluid = cbFluidInTubes.SelectedIndex; }
public void Init() { loaded = false; Pages.Clear(); // connections if (obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.EnergyStream && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust && obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec) { var tab1 = new TabPage(); tab1.Text = "Connections"; var cont0 = UI.Shared.Common.GetDefaultContainer(); UI.Shared.Common.CreateAndAddDescriptionRow(cont0, "ConnectorsEditorDescription".Localize()); new DWSIM.UI.Desktop.Editors.ConnectionsEditor(obj, cont0); cont0.Width = this.Width - 30; var scr1 = new Scrollable() { Content = cont0 }; tab1.Content = scr1; Pages.Add(tab1); } // properties var tab2 = new TabPage(); tab2.Text = "Properties"; Pages.Add(tab2); var cont = UI.Shared.Common.GetDefaultContainer(); cont.Width = this.Width - 30; if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream) { new DWSIM.UI.Desktop.Editors.MaterialStreamEditor(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn) { new DWSIM.UI.Desktop.Editors.DistillationColumnEditor(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn) { new DWSIM.UI.Desktop.Editors.AbsorptionColumnEditor(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust) { DWSIM.UI.Desktop.Editors.LogicalBlocks.AdjustEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec) { DWSIM.UI.Desktop.Editors.LogicalBlocks.SpecEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Recycle) { DWSIM.UI.Desktop.Editors.LogicalBlocks.RecycleEditor.Populate(obj, cont); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_EnergyRecycle) { DWSIM.UI.Desktop.Editors.LogicalBlocks.EnergyRecycleEditor.Populate(obj, cont); } else { new DWSIM.UI.Desktop.Editors.GeneralEditors(obj, cont); } tab2.Content = new Scrollable() { Content = cont, Width = this.Width - 30 }; if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Pipe) { tab2.Text = "General"; var cont2 = UI.Shared.Common.GetDefaultContainer(); cont2.Tag = "Hydraulic Profile"; cont2.Width = this.Width - 30; new PipeHydraulicProfile(obj, cont2); Pages.Add(new TabPage(new Scrollable() { Content = cont2, Width = this.Width - 30 }) { Text = "Hydraulic Profile" }); var cont3 = UI.Shared.Common.GetDefaultContainer(); cont3.Tag = "Thermal Profile"; cont3.Width = this.Width - 30; new PipeThermalProfile(obj, cont3); Pages.Add(new TabPage(new Scrollable() { Content = cont3, Width = this.Width - 30 }) { Text = "Thermal Profile" }); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.CustomUO) { tab2.Text = "General"; var cont2 = new TableLayout { Padding = new Padding(10), Spacing = new Size(5, 5) }; cont2.Tag = "Python Script"; cont2.Width = this.Width - 30; var scripteditor = new DWSIM.UI.Controls.CodeEditorControl() { Text = ((CustomUO)obj).ScriptText }; var dyn1 = new DynamicLayout(); dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) => { ((CustomUO)obj).ScriptText = scripteditor.Text; }); dyn1.Width = this.Width - 30; cont2.Rows.Add(new TableRow(dyn1)); cont2.Rows.Add(new TableRow(scripteditor)); Pages.Add(new TabPage(new Scrollable() { Content = cont2, Width = this.Width - 30 }) { Text = "Python Script" }); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.HeatExchanger) { tab2.Text = "General"; var dyn1 = new UI.Desktop.Editors.ShellAndTubePropertiesView(obj); dyn1.Width = this.Width - 30; Pages.Add(new TabPage(new Scrollable() { Content = dyn1, Width = this.Width - 30 }) { Text = "Shell and Tube Properties" }); } else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn) { tab2.Text = "General"; var dyn2 = UI.Desktop.Editors.RigorousColumnShared.GetInitialEstimatesEditor((Column)obj); dyn2.Width = this.Width - 30; Pages.Add(new TabPage(new Scrollable() { Content = dyn2, Width = this.Width - 30 }) { Text = "Initial Estimates" }); } PageEditor = tab2; var tabr = new TabPage(); tabr.Text = "Results"; var container = new TableLayout(); new DWSIM.UI.Desktop.Editors.Results(obj, container); tabr.Content = new Scrollable() { Content = container, Width = this.Width - 30 }; PageResults = tabr; Pages.Add(tabr); if (obj.GraphicObject is ShapeGraphic) { var tabx = new TabPage(); tabx.Text = "Appearance"; var editor = new ObjectAppearanceEditorView(obj.GetFlowsheet(), (ShapeGraphic)obj.GraphicObject); editor.Width = this.Width - 30; tabx.Content = new Scrollable() { Content = editor, Width = this.Width - 30 }; Pages.Add(tabx); } if (SelectedPanel >= 0) { SelectedIndex = SelectedPanel; } loaded = true; }