Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

576 hotfix hourly energy systems #634

Merged
merged 13 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified GrasshopperExamples/LectureExercises/EaCS3_E04_Hive_Template.gh
Binary file not shown.
Binary file modified setup/Setup_Hive.exe
Binary file not shown.
7 changes: 3 additions & 4 deletions setup/build.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
@REM Script to build all solutions and create installer

@REM Change these paths accordingly

@REM Requires python 2.7, likely from conda env.
SET PYTHON=python
SET IPY=%PROGRAMFILES%\IronPython 2.7.8\ipy.exe
SET HB=C:\Users\Maxence\Documents\_ETH\2_Jobs\_Hive\honey-badger\honey-badger.py
SET IPY=%PROGRAMFILES%\IronPython 2.7\ipy.exe
SET HB=C:\Users\Christoph\Documents\GitHub\honey-badger\honey-badger.py
SET MSBUILD=%PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
SET MAKENSIS=%PROGRAMFILES(X86)%\NSIS\makensis.exe

SET HIVEWIKIPY=C:\Users\Maxence\Documents\_ETH\2_Jobs\_Hive\hive.wiki\hbwiki.py
SET HIVEWIKIPY=C:\Users\Christoph\Documents\GitHub\hive.wiki\hbwiki.py

@REM Build Hive.Core
echo Building Hive.Core...
Expand Down
194 changes: 163 additions & 31 deletions src/Hive.IO/Hive.IO/Building/Zone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,42 @@ public struct StructInternalLoads
/// </summary>
[JsonProperty]
public double[] HeatingLoadsMonthly { get; private set; }
/// <summary>
/// in kWh per hour
/// </summary>
[JsonProperty]
public double [] HeatingLoadsHourly { get; private set; }

/// <summary>
/// in kWh per month
/// </summary>
[JsonProperty]
public double[] DHWLoadsMonthly { get; private set; }
/// <summary>
/// in kWh per hour
/// </summary>
[JsonProperty]
public double [] DHWLoadsHourly { get; private set; }
/// <summary>
/// in kWh per month
/// </summary>
[JsonProperty]
public double[] CoolingLoadsMonthly { get; private set; }
/// <summary>
/// in kWh per hour
/// </summary>
[JsonProperty]
public double [] CoolingLoadsHourly { get; private set; }
/// <summary>
/// in kWh per month
/// </summary>
[JsonProperty]
public double[] ElectricityLoadsMonthly { get; private set; }
/// <summary>
/// in kWh per hour
/// </summary>
[JsonProperty]
public double [] ElectricityLoadsHourly { get; private set; }

/// <summary>
/// Differs from ElectricityLoadsMonthly, which can be negative (surplus electricity from e.g. PV). ConsumedElectricityMonthly is what we really consume in the zone
Expand All @@ -161,17 +182,29 @@ public struct StructInternalLoads

#region Losses and Gains
[JsonProperty]
public double[] OpaqueTransmissionHeatLosses { get; private set; }
public double[] OpaqueTransmissionHeatLossesMonthly { get; private set; }
[JsonProperty]
public double [] TransparentTransmissionHeatLosses { get; private set; }
public double[] OpaqueTransmissionHeatLossesHourly { get; private set; }
[JsonProperty]
public double[] VentilationHeatLosses { get; private set; }
public double [] TransparentTransmissionHeatLossesMonthly { get; private set; }
[JsonProperty]
public double[] InternalHeatGains { get; private set; }
public double[] TransparentTransmissionHeatLossesHourly { get; private set; }
[JsonProperty]
public double[] SolarGains { get; private set; }

public double [][] MonthlySolarGainsPerWindow { get; private set; }
public double[] VentilationHeatLossesMonthly { get; private set; }
[JsonProperty]
public double[] VentilationHeatLossesHourly { get; private set; }
[JsonProperty]
public double[] InternalHeatGainsMonthly { get; private set; }
[JsonProperty]
public double[] InternalHeatGainsHourly { get; private set; }
[JsonProperty]
public double[] SolarGainsMonthly { get; private set; }
[JsonProperty]
public double[] SolarGainsHourly { get; private set; }
[JsonProperty]
public double [][] SolarGainsPerWindowMonthly { get; private set; }
[JsonProperty]
public double[][] SolarGainsPerWindowHourly { get; private set; }
#endregion


Expand Down Expand Up @@ -343,53 +376,152 @@ public Zone(rg.Brep zone_geometry, int index, double tolerance, string roomType,
#region Setters


// data should be put into each Window element
// can't do it yet, because I am losing windows order within the Core
public void SetMonthlyWindowIrradiance(double[][] Q_s_per_window)
/// <summary>
///
/// </summary>
/// <param name="Q_s_per_window"></param>
public void SetWindowIrradiance(double[][] Q_s_per_window)
{
this.MonthlySolarGainsPerWindow = new double[Q_s_per_window.Length][];
this.SolarGainsPerWindowMonthly = new double[Q_s_per_window.Length][];
this.SolarGainsPerWindowHourly = new double[Q_s_per_window.Length][];
for (int i = 0; i < Q_s_per_window.Length; i++)
{
this.MonthlySolarGainsPerWindow[i] = new double[Q_s_per_window[i].Length];
for (int j = 0; j < Q_s_per_window[i].Length; j++)
this.MonthlySolarGainsPerWindow[i][j] = Q_s_per_window[i][j];
this.SolarGainsPerWindowMonthly[i] = new double[Misc.MonthsPerYear];
if (Q_s_per_window[i].Length == Misc.HoursPerYear)
{
this.SolarGainsPerWindowHourly[i] = new double[Misc.HoursPerYear];
Q_s_per_window[i].CopyTo(this.SolarGainsPerWindowHourly[i],0);
Misc.GetCumulativeMonthlyValue(Q_s_per_window[i]).CopyTo(this.SolarGainsPerWindowMonthly[i],0);
}else
{
Q_s_per_window[i].CopyTo(this.SolarGainsPerWindowMonthly[i], 0);
}
}
}


/// <summary>
/// Setting monthly energy demands of this zone. Loads have to be computed externally, e.g. with Hive.Core SIA380
/// Setting energy demands of this zone. Loads have to be computed externally, e.g. with Hive.Core SIA380
/// </summary>
/// <param name="heatingLoads"></param>
/// <param name="dhwLoads"></param>
/// <param name="coolingLoads"></param>
/// <param name="electricityLoads"></param>
public void SetEnergyDemandsMonthly(double[] heatingLoads, double[] dhwLoads, double[] coolingLoads, double[] electricityLoads)
public void SetEnergyDemands(double[] heatingLoads, double[] dhwLoads, double[] coolingLoads, double[] electricityLoads)
{
this.HeatingLoadsMonthly = new double[Misc.MonthsPerYear];
this.DHWLoadsMonthly = new double[Misc.MonthsPerYear];
this.CoolingLoadsMonthly = new double[Misc.MonthsPerYear];
this.ElectricityLoadsMonthly = new double[Misc.MonthsPerYear];

heatingLoads.CopyTo(this.HeatingLoadsMonthly, 0);
dhwLoads.CopyTo(this.DHWLoadsMonthly, 0);
coolingLoads.CopyTo(this.CoolingLoadsMonthly, 0);
electricityLoads.CopyTo(this.ElectricityLoadsMonthly, 0);
if (heatingLoads.Length == Misc.HoursPerYear)
{
this.HeatingLoadsHourly = new double[Misc.HoursPerYear];
heatingLoads.CopyTo(this.HeatingLoadsHourly,0);
Misc.GetCumulativeMonthlyValue(heatingLoads).CopyTo(this.HeatingLoadsMonthly, 0);
}
else
{
heatingLoads.CopyTo(this.HeatingLoadsMonthly, 0);
}
christophwaibel marked this conversation as resolved.
Show resolved Hide resolved

if (dhwLoads.Length == Misc.HoursPerYear)
{
this.DHWLoadsHourly = new double[Misc.HoursPerYear];
dhwLoads.CopyTo(this.DHWLoadsHourly,0);
Misc.GetCumulativeMonthlyValue(dhwLoads).CopyTo(this.DHWLoadsMonthly,0);
}
else
{
dhwLoads.CopyTo(this.DHWLoadsMonthly, 0);
}

if (coolingLoads.Length == Misc.HoursPerYear)
{
this.CoolingLoadsHourly=new double[Misc.HoursPerYear];
coolingLoads.CopyTo(this.CoolingLoadsHourly,0);
Misc.GetCumulativeMonthlyValue(coolingLoads).CopyTo(this.CoolingLoadsMonthly,0);
}
else
{
coolingLoads.CopyTo(this.CoolingLoadsMonthly, 0);
}

if (electricityLoads.Length == Misc.HoursPerYear)
{
this.ElectricityLoadsHourly=new double[Misc.HoursPerYear];
electricityLoads.CopyTo(this.ElectricityLoadsHourly,0);
Misc.GetCumulativeMonthlyValue(electricityLoads).CopyTo(this.ElectricityLoadsMonthly,0);
}
else
{
electricityLoads.CopyTo(this.ElectricityLoadsMonthly, 0);
}
}


public void SetLossesAndGains(double[] Qt_opaque, double [] Qt_transparent, double[] Qv, double[] Qi, double[] Qs)
{
this.OpaqueTransmissionHeatLosses = new double[Misc.MonthsPerYear];
this.TransparentTransmissionHeatLosses = new double[Misc.MonthsPerYear];
this.VentilationHeatLosses = new double[Misc.MonthsPerYear];
this.InternalHeatGains = new double[Misc.MonthsPerYear];
this.SolarGains = new double[Misc.MonthsPerYear];

Qt_opaque.CopyTo(this.OpaqueTransmissionHeatLosses, 0);
Qt_transparent.CopyTo(this.TransparentTransmissionHeatLosses, 0);
Qv.CopyTo(this.VentilationHeatLosses, 0);
Qi.CopyTo(this.InternalHeatGains, 0);
Qs.CopyTo(this.SolarGains, 0);
this.OpaqueTransmissionHeatLossesMonthly = new double[Misc.MonthsPerYear];
this.TransparentTransmissionHeatLossesMonthly = new double[Misc.MonthsPerYear];
this.VentilationHeatLossesMonthly = new double[Misc.MonthsPerYear];
this.InternalHeatGainsMonthly = new double[Misc.MonthsPerYear];
this.SolarGainsMonthly = new double[Misc.MonthsPerYear];

if (Qt_opaque.Length == Misc.HoursPerYear)
{
this.OpaqueTransmissionHeatLossesHourly=new double[Misc.HoursPerYear];
Qt_opaque.CopyTo(this.OpaqueTransmissionHeatLossesHourly,0);
Misc.GetCumulativeMonthlyValue(Qt_opaque).CopyTo(this.OpaqueTransmissionHeatLossesMonthly,0);
}
else
{
Qt_opaque.CopyTo(this.OpaqueTransmissionHeatLossesMonthly, 0);
}

if (Qt_transparent.Length == Misc.HoursPerYear)
{
this.TransparentTransmissionHeatLossesHourly = new double[Misc.HoursPerYear];
Qt_transparent.CopyTo(this.TransparentTransmissionHeatLossesHourly,0);
Misc.GetCumulativeMonthlyValue(Qt_transparent).CopyTo(this.TransparentTransmissionHeatLossesMonthly,0);
}
else
{
Qt_transparent.CopyTo(this.TransparentTransmissionHeatLossesMonthly, 0);
}

if (Qv.Length == Misc.HoursPerYear)
{
this.VentilationHeatLossesHourly=new double[Misc.HoursPerYear];
Qv.CopyTo(this.VentilationHeatLossesHourly,0);
Misc.GetCumulativeMonthlyValue(Qv).CopyTo(this.VentilationHeatLossesMonthly,0);
}
else
{
Qv.CopyTo(this.VentilationHeatLossesMonthly, 0);
}

if (Qi.Length == Misc.HoursPerYear)
{
this.InternalHeatGainsHourly=new double[Misc.HoursPerYear];
Qi.CopyTo(this.InternalHeatGainsHourly,0);
Misc.GetCumulativeMonthlyValue(Qi).CopyTo(this.InternalHeatGainsMonthly,0);
}
else
{
Qi.CopyTo(this.InternalHeatGainsMonthly, 0);
}

if (Qs.Length == Misc.HoursPerYear)
{
this.SolarGainsHourly=new double[Misc.HoursPerYear];
Qs.CopyTo(this.SolarGainsHourly,0);
Misc.GetCumulativeMonthlyValue(Qs).CopyTo(this.SolarGainsMonthly,0);
}
else
{
Qs.CopyTo(this.SolarGainsMonthly, 0);
}
}

#endregion
Expand Down
Loading