diff --git a/Helios/Models/ConfiguratorInput.cs b/Helios/Models/ConfiguratorInput.cs index bc10b3a5915bfd94a666d9002352917a4db4dc67..519758c1db8fa7772483e0dc36f6f6004a1ce2e4 100644 --- a/Helios/Models/ConfiguratorInput.cs +++ b/Helios/Models/ConfiguratorInput.cs @@ -5,7 +5,7 @@ namespace Helios.Models { public class ConfiguratorInput { - public Roof Roof { get; set; } + public List<Roof> Roofs { get; set; } [DisplayName("Energy usage in KwH?")] public int PowerRequired { get; set; } diff --git a/Helios/Source/ConfiguratorService.cs b/Helios/Source/ConfiguratorService.cs index 27d5ca409fe3b8815771d69d995c21c97876075d..ce47bfabef544c38d7f18b934640da554e1f56f1 100644 --- a/Helios/Source/ConfiguratorService.cs +++ b/Helios/Source/ConfiguratorService.cs @@ -24,22 +24,25 @@ namespace Helios.Source foreach (SolarPanel panel in _solarPanels) { - ConfiguratorResult result = new ConfiguratorResult(); - - int summerElevationAngle = input.Roof.GetElevationAngle(_maxElevation.SummerElevation); - int winterElevationAngle = input.Roof.GetElevationAngle(_maxElevation.WinterElevation); - - result.RoofArea = input.Roof.Area; - result.RoofAngle = input.Roof.Elevation; - result.PanelEfficiency = panel.Efficiency * 100; - result.InstallationCost = panel.GetInstallationCost(input.Roof.Area); - result.PowerGeneratedSummer = Math.Round(panel.GetPowerOutput(input.Roof.Area, summerElevationAngle), 2); - result.PowerGeneratedWinter = Math.Round(panel.GetPowerOutput(input.Roof.Area, winterElevationAngle), 2); - result.GeneratesRequiredPower = GeneratesRequiredPower(input.PowerRequired, result.PowerGeneratedWinter); - result.ExceedsMaximumPower = ExceedsPowerLimit(input.MaximumPower, result.PowerGeneratedWinter); - result.WithinBudget = WithinBudget(input.Budget, result.InstallationCost); - - results.Add(result); + foreach (Roof roof in input.Roofs) + { + ConfiguratorResult result = new ConfiguratorResult(); + + int summerElevationAngle = roof.GetElevationAngle(_maxElevation.SummerElevation); + int winterElevationAngle = roof.GetElevationAngle(_maxElevation.WinterElevation); + + result.RoofArea = roof.Area; + result.RoofAngle = roof.Elevation; + result.PanelEfficiency = panel.Efficiency * 100; + result.InstallationCost = panel.GetInstallationCost(roof.Area); + result.PowerGeneratedSummer = Math.Round(panel.GetPowerOutput(roof.Area, summerElevationAngle), 2); + result.PowerGeneratedWinter = Math.Round(panel.GetPowerOutput(roof.Area, winterElevationAngle), 2); + result.GeneratesRequiredPower = GeneratesRequiredPower(input.PowerRequired, result.PowerGeneratedWinter); + result.ExceedsMaximumPower = ExceedsPowerLimit(input.MaximumPower, result.PowerGeneratedWinter); + result.WithinBudget = WithinBudget(input.Budget, result.InstallationCost); + + results.Add(result); + } } return results; diff --git a/Helios/Views/Configurator/ConfiguratorResult.cshtml b/Helios/Views/Configurator/ConfiguratorResult.cshtml index 74267a6fb5f7f55fbd0f3fb4f2331d2bb317c439..8ca3354aa22f89a25f5057576bcf48f71b2806c7 100644 --- a/Helios/Views/Configurator/ConfiguratorResult.cshtml +++ b/Helios/Views/Configurator/ConfiguratorResult.cshtml @@ -4,6 +4,9 @@ ViewData["Title"] = "Configuration Results"; } +<h4>Configurator Results</h4> +<hr /> + <table class="table"> <tr> <th> diff --git a/Helios/Views/Configurator/Index.cshtml b/Helios/Views/Configurator/Index.cshtml index e699b9e14178fc1c1338d3c42e0f9017a04dbb3f..0e2ed14d28bfb03415776e8d646613696af767aa 100644 --- a/Helios/Views/Configurator/Index.cshtml +++ b/Helios/Views/Configurator/Index.cshtml @@ -12,22 +12,44 @@ @Html.ValidationSummary(true, "", new { @class = "text-danger" }) + <h5>Roof #1</h5> + <div class="form-group"> - @Html.LabelFor(model => model.Roof.Area, htmlAttributes: new { @class = "control-label col-md-2" }) + @Html.LabelFor(model => model.Roofs[0].Area, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> - @Html.EditorFor(model => model.Roof.Area, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.Roof.Area, "", new { @class = "text-danger" }) + @Html.EditorFor(model => model.Roofs[0].Area, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Roofs[0].Area, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> - @Html.LabelFor(model => model.Roof.Elevation, htmlAttributes: new { @class = "control-label col-md-2" }) + @Html.LabelFor(model => model.Roofs[0].Elevation, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Roofs[0].Elevation, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Roofs[0].Elevation, "", new { @class = "text-danger" }) + </div> + </div> + + <h5>Roof #2</h5> + + <div class="form-group"> + @Html.LabelFor(model => model.Roofs[1].Area, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> - @Html.EditorFor(model => model.Roof.Elevation, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.Roof.Elevation, "", new { @class = "text-danger" }) + @Html.EditorFor(model => model.Roofs[1].Area, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Roofs[1].Area, "", new { @class = "text-danger" }) </div> </div> + <div class="form-group"> + @Html.LabelFor(model => model.Roofs[1].Elevation, htmlAttributes: new { @class = "control-label col-md-2" }) + <div class="col-md-10"> + @Html.EditorFor(model => model.Roofs[1].Elevation, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.Roofs[1].Elevation, "", new { @class = "text-danger" }) + </div> + </div> + + <h5>Energy Information</h5> + <div class="form-group"> @Html.LabelFor(model => model.PowerRequired, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10">