//private ModelEnergyProperties ModelEnergyProperties { get; set; } public Dialog_OpsHVACs(ref HoneybeeSchema.ModelEnergyProperties libSource, HoneybeeSchema.Energy.IHvac hvac = default, bool lockedMode = false) { this.Padding = new Padding(10); Title = $"From OpenStudio HVAC library - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; if (hvac == null) // add a new system { _vm = new OpsHVACsViewModel(libSource, this); } else // edit existing system { _vm = new OpsHVACsViewModel(libSource, hvac, this); } var layout = new DynamicLayout() { DataContext = _vm }; layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(5); // add a new system from lib if (hvac == null) { // UI for system groups var hvacGroups = new DropDown(); var hvacTypes = new DropDown(); var hvacEquipments = new DropDown(); hvacGroups.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.HvacGroups); hvacGroups.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.HvacGroup); hvacTypes.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.HvacTypes); hvacTypes.ItemTextBinding = Binding.Delegate <Type, string>(t => _vm.HVACTypesDic[t]); hvacTypes.SelectedValueBinding.BindDataContext((OpsHVACsViewModel m) => m.HvacType); hvacEquipments.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.HvacEquipmentTypes); hvacEquipments.ItemTextBinding = Binding.Delegate <string, string>(t => _vm.HVACsDic[t]); hvacEquipments.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.HvacEquipmentType); layout.AddRow("HVAC Groups:"); layout.AddRow(hvacGroups); layout.AddRow("HVAC Types:"); layout.AddRow(hvacTypes); layout.AddRow("HVAC Equipment Types:"); layout.AddRow(hvacEquipments); layout.AddRow(null); } var year = new DropDown(); var nameText = new TextBox(); var economizer = new DropDown(); var sensible = new NumericStepper() { MinValue = 0, MaxValue = 1, MaximumDecimalPlaces = 2, Increment = 0.1 }; var latent = new NumericStepper() { MinValue = 0, MaxValue = 1, MaximumDecimalPlaces = 2, Increment = 0.1 }; nameText.TextBinding.BindDataContext((OpsHVACsViewModel m) => m.Name); year.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.Vintages); year.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.Vintage); var economizerTitle = new Label() { Text = "Economizer:" }; economizer.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.Economizers); economizer.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.Economizer); economizer.BindDataContext(c => c.Enabled, (OpsHVACsViewModel m) => m.EconomizerVisable); economizer.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.EconomizerVisable); economizerTitle.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.EconomizerVisable); var sensibleTitle = new Label() { Text = "Sensible Heat Recovery:" }; sensible.BindDataContext(c => c.Value, (OpsHVACsViewModel m) => m.SensibleHR); sensible.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.SensibleHRVisable); sensibleTitle.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.SensibleHRVisable); var latentTitle = new Label() { Text = "Latent Heat Recovery:" }; latent.BindDataContext(c => c.Value, (OpsHVACsViewModel m) => m.LatentHR); latent.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.LatentHRVisable); latentTitle.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.LatentHRVisable); var dcv = new CheckBox() { Text = "Demand Control Ventilation" }; dcv.Bind(_ => _.Checked, _vm, _ => _.DcvChecked); dcv.Bind(c => c.Visible, _vm, _ => _.DcvVisable); var availabilityTitle = new Label() { Text = "DOAS Availability Schedule:" }; availabilityTitle.Bind(c => c.Visible, _vm, _ => _.AvaliabilityVisable); var availability = new OptionalButton(); availability.Bind(c => c.Visible, _vm, _ => _.AvaliabilityVisable); availability.TextBinding.Bind(_vm, _ => _.AvaliabilitySchedule.BtnName); availability.Bind(_ => _.Command, _vm, _ => _.AvaliabilityCommand); availability.Bind(_ => _.RemoveCommand, _vm, _ => _.RemoveAvaliabilityCommand); availability.Bind(_ => _.IsRemoveVisable, _vm, _ => _.AvaliabilitySchedule.IsRemoveVisable); var radSettings = GenRadSettingsPanel(); var gp = new GroupBox() { Text = "HVAC System settings" }; var gpLayout = new DynamicLayout(); gpLayout.DefaultPadding = new Padding(5); // fix the height of layout in case of creating a new system, otherwise, autosize height if (hvac == null) { gpLayout.Height = 250; gpLayout.BeginScrollable(BorderType.None); } var gpGeneralLayout = new DynamicLayout(); //gpLayout.BeginGroup("HVAC System settings", new Padding(5), new Size(5, 0)); gpGeneralLayout.Spacing = new Size(5, 2); gpGeneralLayout.AddRow("Name:"); gpGeneralLayout.AddRow(nameText); gpGeneralLayout.AddRow("Vintage:"); gpGeneralLayout.AddRow(year); gpGeneralLayout.AddRow(economizerTitle); gpGeneralLayout.AddRow(economizer); gpGeneralLayout.AddRow(sensibleTitle); gpGeneralLayout.AddRow(sensible); gpGeneralLayout.AddRow(latentTitle); gpGeneralLayout.AddRow(latent); gpGeneralLayout.AddRow(availabilityTitle); gpGeneralLayout.AddRow(availability); gpGeneralLayout.AddRow(dcv); gpLayout.AddRow(gpGeneralLayout); gpLayout.AddRow(radSettings); //gpLayout.EndGroup(); gp.Content = gpLayout; layout.AddRow(gp); var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OKButton = new Button { Text = "OK", Enabled = !lockedMode }; OKButton.Click += (sender, e) => { var obj = _vm.GreateHvac(hvac); OkCommand.Execute(obj); }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); layout.AddSeparateRow(locked, null, OKButton, this.AbortButton, null, null); //layout.AddRow(null); Content = layout; }
private GroupBox GenStpPanel() { var vm = this._vm; var layout = new DynamicLayout(); layout.Bind((t) => t.Visible, vm, v => v.Setpoint.IsPanelEnabled); layout.DefaultSpacing = new Size(4, 4); //layout.DefaultPadding = new Padding(4); var sch = new Button(); sch.Width = 250; sch.TextBinding.Bind(vm, _ => _.Setpoint.CoolingSchedule.BtnName); sch.Bind(_ => _.Command, vm, _ => _.Setpoint.CoolingScheduleCommand); layout.AddRow("Cooling Schedule:"); layout.AddRow(sch); var sch2 = new Button(); sch2.TextBinding.Bind(vm, _ => _.Setpoint.HeatingSchedule.BtnName); sch2.Bind(_ => _.Command, vm, _ => _.Setpoint.HeatingScheduleCommand); layout.AddRow("Heating Schedule:"); layout.AddRow(sch2); var sch3 = new OptionalButton(); sch3.TextBinding.Bind(vm, _ => _.Setpoint.HumidifyingSchedule.BtnName); sch3.Bind(_ => _.Command, vm, _ => _.Setpoint.HumidifyingScheduleCommand); sch3.Bind(_ => _.RemoveCommand, vm, _ => _.Setpoint.RemoveHumidifyingScheduleCommand); sch3.Bind(_ => _.IsRemoveVisable, vm, _ => _.Setpoint.HumidifyingSchedule.IsRemoveVisable); layout.AddRow("Humidifying Schedule:"); layout.AddRow(sch3); var sch4 = new OptionalButton(); sch4.TextBinding.Bind(vm, _ => _.Setpoint.DehumidifyingSchedule.BtnName); sch4.Bind(_ => _.Command, vm, _ => _.Setpoint.DehumidifyingScheduleCommand); sch4.Bind(_ => _.RemoveCommand, vm, _ => _.Setpoint.RemoveDehumidifyingScheduleCommand); sch4.Bind(_ => _.IsRemoveVisable, vm, _ => _.Setpoint.DehumidifyingSchedule.IsRemoveVisable); layout.AddRow("Dehumidifying Schedule:"); layout.AddRow(sch4); layout.AddRow(null); var ltnByProgram = new CheckBox() { Text = ReservedText.Noload }; ltnByProgram.CheckedBinding.Bind(vm, _ => _.Setpoint.IsCheckboxChecked); var gp = new GroupBox() { Text = "Setpoint" }; gp.Content = new StackLayout(ltnByProgram, layout) { Spacing = 4, Padding = new Padding(4) }; return(gp); }
private GroupBox GenPplPanel() { var vm = this._vm; var layout = new DynamicLayout(); layout.Bind((t) => t.Visible, vm, v => v.People.IsPanelEnabled); layout.DefaultSpacing = new Size(4, 4); //layout.DefaultPadding = new Padding(4); var wPerArea = new DoubleText(); wPerArea.Width = 250; wPerArea.ReservedText = ReservedText.Varies; wPerArea.SetDefault(_vm.People.Default.PeoplePerArea); wPerArea.TextBinding.Bind(vm, _ => _.People.PeoplePerArea.NumberText); layout.AddRow("People/Area:"); var unit = new Label(); unit.TextBinding.Bind(vm, _ => _.People.PeoplePerArea.DisplayUnitAbbreviation); layout.AddSeparateRow(wPerArea, unit); var sch = new Button(); sch.TextBinding.Bind(vm, _ => _.People.OccupancySchedule.BtnName); sch.Bind(_ => _.Command, vm, _ => _.People.ScheduleCommand); layout.AddRow("Occupancy Schedule:"); layout.AddRow(sch); var sch2 = new OptionalButton(); sch2.TextBinding.Bind(vm, _ => _.People.ActivitySchedule.BtnName); sch2.Bind(_ => _.Command, vm, _ => _.People.ActivityScheduleCommand); sch2.Bind(_ => _.RemoveCommand, vm, _ => _.People.RemoveActivityScheduleCommand); sch2.Bind(_ => _.IsRemoveVisable, vm, _ => _.People.ActivitySchedule.IsRemoveVisable); layout.AddRow("Activity Schedule:"); layout.AddRow(sch2); var radFraction = new DoubleText(); radFraction.ReservedText = ReservedText.Varies; radFraction.SetDefault(_vm.People.Default.RadiantFraction); radFraction.TextBinding.Bind(vm, _ => _.People.RadiantFraction.NumberText); layout.AddRow("Radiant Fraction:"); layout.AddRow(radFraction); var visFraction = new DoubleText(); visFraction.ReservedText = ReservedText.Varies; visFraction.SetDefault(_vm.People.Default.LatentFraction); visFraction.TextBinding.Bind(vm, _ => _.People.LatentFraction.NumberText); visFraction.Bind(_ => _.Enabled, vm, _ => _.People.IsLatenFractionInputEnabled); var autosize = new CheckBox() { Text = "Autocalculate" }; autosize.Bind(_ => _.Checked, vm, _ => _.People.IsLatentFractionAutocalculate); layout.AddRow("Latent Fraction:"); layout.AddRow(autosize); layout.AddRow(visFraction); layout.AddRow(null); var ltnByProgram = new CheckBox() { Text = ReservedText.Noload }; ltnByProgram.CheckedBinding.Bind(vm, _ => _.People.IsCheckboxChecked); var gp = new GroupBox() { Text = "People" }; gp.Content = new StackLayout(ltnByProgram, layout) { Spacing = 4, Padding = new Padding(4) }; return(gp); }
private GroupBox GenVentPanel() { var vm = this._vm; var layout = new DynamicLayout(); layout.Bind((t) => t.Visible, vm, v => v.Ventilation.IsPanelEnabled); layout.DefaultSpacing = new Size(4, 4); //layout.DefaultPadding = new Padding(4); var wPerArea = new DoubleText(); wPerArea.Width = 250; wPerArea.ReservedText = ReservedText.Varies; wPerArea.SetDefault(_vm.Ventilation.Default.FlowPerArea); wPerArea.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerArea.NumberText); layout.AddRow("Flow/Area:"); var unit = new Label(); unit.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerArea.DisplayUnitAbbreviation); layout.AddSeparateRow(wPerArea, unit); var sch = new OptionalButton(); sch.TextBinding.Bind(vm, _ => _.Ventilation.Schedule.BtnName); sch.Bind(_ => _.Command, vm, _ => _.Ventilation.ScheduleCommand); sch.Bind(_ => _.RemoveCommand, vm, _ => _.Ventilation.RemoveScheduleCommand); sch.Bind(_ => _.IsRemoveVisable, vm, _ => _.Ventilation.Schedule.IsRemoveVisable); layout.AddRow("Schedule:"); layout.AddRow(sch); var radFraction = new DoubleText() { Width = 250 }; radFraction.ReservedText = ReservedText.Varies; radFraction.SetDefault(_vm.Ventilation.Default.FlowPerPerson); radFraction.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerPerson.NumberText); layout.AddRow("Flow/Person:"); var unit2 = new Label(); unit2.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerPerson.DisplayUnitAbbreviation); layout.AddSeparateRow(radFraction, unit2); var visFraction = new DoubleText() { Width = 250 }; visFraction.ReservedText = ReservedText.Varies; visFraction.SetDefault(_vm.Ventilation.Default.FlowPerZone); visFraction.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerZone.NumberText); layout.AddRow("Flow/Zone:"); var unit3 = new Label(); unit3.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerZone.DisplayUnitAbbreviation); layout.AddSeparateRow(visFraction, unit3); var airFraction = new DoubleText() { Width = 250 }; airFraction.ReservedText = ReservedText.Varies; airFraction.SetDefault(_vm.Ventilation.Default.AirChangesPerHour); airFraction.TextBinding.Bind(vm, _ => _.Ventilation.AirChangesPerHour.NumberText); layout.AddRow("AirChanges/Hour:"); var unit4 = new Label(); unit4.TextBinding.Bind(vm, _ => _.Ventilation.AirChangesPerHour.DisplayUnitAbbreviation); layout.AddSeparateRow(airFraction, unit4); layout.AddRow(null); var ltnByProgram = new CheckBox() { Text = ReservedText.Noload }; ltnByProgram.CheckedBinding.Bind(vm, _ => _.Ventilation.IsCheckboxChecked); var gp = new GroupBox() { Text = "Ventilation" }; gp.Content = new StackLayout(ltnByProgram, layout) { Spacing = 4, Padding = new Padding(4) }; return(gp); }
//private ModelEnergyProperties ModelEnergyProperties { get; set; } public Dialog_IdealAirLoad(ref HoneybeeSchema.ModelEnergyProperties libSource, IdealAirSystemAbridged hvac = default, bool lockedMode = false) { var sys = hvac ?? new IdealAirSystemAbridged($"IdealAirSystem_{Guid.NewGuid().ToString().Substring(0, 8)}"); var vm = new IdealAirLoadViewModel(libSource, sys, this); //Padding = new Padding(4); Title = $"Ideal Air Load - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; var layout = new DynamicLayout() { DataContext = vm }; layout.DefaultSpacing = new Size(4, 4); layout.Padding = new Padding(10); // string displayName = null, // EconomizerType economizerType = EconomizerType.DifferentialDryBulb, // bool demandControlledVentilation = false, // double sensibleHeatRecovery = 0, // double latentHeatRecovery = 0, // double heatingAirTemperature = 50, // double coolingAirTemperature = 13, // AnyOf<Autosize, NoLimit, double> heatingLimit = null, // AnyOf<Autosize, NoLimit, double> coolingLimit = null, // string heatingAvailability = null, // string coolingAvailability var nameText = new TextBox(); var economizer = new DropDown(); var DCV = new CheckBox() { Text = "Demand Controlled Ventilation" }; var sensible = new NumericStepper() { MinValue = 0, MaxValue = 1, MaximumDecimalPlaces = 2, Increment = 0.1 }; var latent = new NumericStepper() { MinValue = 0, MaxValue = 1, MaximumDecimalPlaces = 2, Increment = 0.1 }; var heatingAirT = new NumericStepper() { MinValue = -50, MaxValue = 100, MaximumDecimalPlaces = 2 }; var coolingAirT = new NumericStepper() { MinValue = -50, MaxValue = 100, MaximumDecimalPlaces = 2 }; var heatingLimitAuto = new RadioButton() { Text = "Autosize" }; var heatingLimitNoLimit = new RadioButton() { Text = "No Limit" }; var heatingLimitNumber = new RadioButton(); var heatingLimit = new NumericStepper(); var coolingLimitAuto = new RadioButton() { Text = "Autosize" }; var coolingLimitNoLimit = new RadioButton() { Text = "No Limit" }; var coolingLimitNumber = new RadioButton(); var coolingLimit = new NumericStepper(); var heatingAvailability = new OptionalButton(); heatingAvailability.TextBinding.Bind(vm, _ => _.HeatingAvaliabilitySchedule.BtnName); heatingAvailability.Bind(_ => _.Command, vm, _ => _.HeatingAvaliabilityCommand); heatingAvailability.Bind(_ => _.RemoveCommand, vm, _ => _.RemoveHeatingAvaliabilityCommand); heatingAvailability.Bind(_ => _.IsRemoveVisable, vm, _ => _.HeatingAvaliabilitySchedule.IsRemoveVisable); var coolingAvailability = new OptionalButton(); coolingAvailability.TextBinding.Bind(vm, _ => _.CoolingAvaliabilitySchedule.BtnName); coolingAvailability.Bind(_ => _.Command, vm, _ => _.CoolingAvaliabilityCommand); coolingAvailability.Bind(_ => _.RemoveCommand, vm, _ => _.RemoveCoolingAvaliabilityCommand); coolingAvailability.Bind(_ => _.IsRemoveVisable, vm, _ => _.CoolingAvaliabilitySchedule.IsRemoveVisable); nameText.TextBinding.BindDataContext((IdealAirLoadViewModel m) => m.Name); economizer.BindDataContext(c => c.DataStore, (IdealAirLoadViewModel m) => m.Economizers); economizer.SelectedKeyBinding.BindDataContext((IdealAirLoadViewModel m) => m.Economizer); DCV.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.DCV); sensible.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.SensibleHR); latent.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.LatentHR); heatingAirT.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.HeatingAirTemperature); coolingAirT.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.CoolingAirTemperature); heatingLimitAuto.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.HeatingLimitAutosized); heatingLimitNoLimit.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.HeatingLimitNoLimit); heatingLimitNumber.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.HeatingLimitNumber); heatingLimit.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.HeatingLimit); heatingLimit.BindDataContext(c => c.Enabled, (IdealAirLoadViewModel m) => m.HeatingLimitNumber); coolingLimitAuto.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.CoolingLimitAutosized); coolingLimitNoLimit.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.CoolingLimitNoLimit); coolingLimitNumber.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.CoolingLimitNumber); coolingLimit.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.CoolingLimit); coolingLimit.BindDataContext(c => c.Enabled, (IdealAirLoadViewModel m) => m.CoolingLimitNumber); layout.AddRow("Name:"); layout.AddRow(nameText); layout.AddRow("Economizer:"); layout.AddRow(economizer); layout.AddSeparateRow(DCV); layout.AddRow("Sensible Heat Recovery: [0-1]"); layout.AddRow(sensible); layout.AddRow("Latent Heat Recovery: [0-1]"); layout.AddRow(latent); layout.AddRow("Heating Supply Air Temperature: [C]"); layout.AddRow(heatingAirT); layout.AddRow("Cooling Supply Air Temperature: [C]"); layout.AddRow(coolingAirT); layout.AddRow("Heating Capacity Limit: [Watts]"); layout.AddRow(heatingLimitAuto); layout.AddRow(heatingLimitNoLimit); layout.AddSeparateRow(heatingLimitNumber, heatingLimit); layout.AddRow("Cooling Capacity Limit: [Watts]"); layout.AddRow(coolingLimitAuto); layout.AddRow(coolingLimitNoLimit); layout.AddSeparateRow(coolingLimitNumber, coolingLimit); layout.AddRow("Heating Availability"); layout.AddRow(heatingAvailability); layout.AddRow("Cooling Availability"); layout.AddRow(coolingAvailability); var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OKButton = new Button { Text = "OK", Enabled = !lockedMode }; OKButton.Click += (sender, e) => OkCommand.Execute(vm.GreateHvac(hvac)); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var hbData = new Button { Text = "Schema Data" }; hbData.Click += (sender, e) => Dialog_Message.Show(this, vm.GreateHvac(hvac).ToJson(true), "Schema Data"); layout.AddSeparateRow(locked, null, OKButton, this.AbortButton, null, hbData); layout.AddRow(null); Content = layout; }