feat: Adds thermal balance point, still need to implement economic balance point.

This commit is contained in:
2025-03-04 12:46:44 -05:00
parent d22beb9375
commit 6c31a9db09
11 changed files with 362 additions and 40 deletions

View File

@@ -1,3 +1,5 @@
import CoreModels
public enum HeatingBalancePoint {
public static let description: String = """
@@ -17,21 +19,24 @@ public enum HeatingBalancePoint {
public let systemSize: Double
public let capacityAt47: Double?
public let capacityAt17: Double?
public let heatingDesignTemperature: Double
public let heatingDesignTemperature: Double?
public let buildingHeatLoss: HeatingBalancePoint.HeatLoss
public let climateZone: ClimateZone?
public init(
systemSize: Double,
capacityAt47: Double? = nil,
capacityAt17: Double? = nil,
heatingDesignTemperature: Double,
buildingHeatLoss: HeatingBalancePoint.HeatLoss
heatingDesignTemperature: Double? = nil,
buildingHeatLoss: HeatingBalancePoint.HeatLoss,
climateZone: ClimateZone? = nil
) {
self.systemSize = systemSize
self.capacityAt47 = capacityAt47
self.capacityAt17 = capacityAt17
self.heatingDesignTemperature = heatingDesignTemperature
self.buildingHeatLoss = buildingHeatLoss
self.climateZone = climateZone
}
}
}
@@ -44,11 +49,27 @@ public enum HeatingBalancePoint {
public let capacityAt47: Double
public let capacityAt17: Double
public let balancePointTemperature: Double
public let heatLoss: Double
public let heatLossMode: HeatLoss.Mode
public let heatingDesignTemperature: Double
public let warnings: [String]
public init(capacityAt47: Double, capacityAt17: Double, balancePointTemperature: Double) {
public init(
capacityAt47: Double,
capacityAt17: Double,
balancePointTemperature: Double,
heatLoss: Double,
heatLossMode: HeatLoss.Mode,
heatingDesignTemperature: Double,
warnings: [String]
) {
self.capacityAt47 = capacityAt47
self.capacityAt17 = capacityAt17
self.balancePointTemperature = balancePointTemperature
self.heatLoss = heatLoss
self.heatLossMode = heatLossMode
self.heatingDesignTemperature = heatingDesignTemperature
self.warnings = warnings
}
}
}
@@ -62,5 +83,36 @@ public enum HeatingBalancePoint {
case known(btu: Double)
case estimated(squareFeet: Double)
public var mode: Mode {
switch self {
case .known: return .known
case .estimated: return .estimated
}
}
}
}
#if DEBUG
public extension HeatingBalancePoint.Response {
static func mock(mode: HeatingBalancePoint.Mode) -> Self {
switch mode {
case .economic:
fatalError()
case .thermal:
return .thermal(.init(
capacityAt47: 24600,
capacityAt17: 15100,
balancePointTemperature: 38.5,
heatLoss: 49667,
heatLossMode: .known,
heatingDesignTemperature: 5,
warnings: [
"Design temperature is estimated based on climate zone."
]
))
}
}
}
#endif