feat: Finishes economic balance point.
This commit is contained in:
@@ -12,8 +12,29 @@ public enum HeatingBalancePoint {
|
||||
}
|
||||
|
||||
public enum Request: Codable, Equatable, Sendable {
|
||||
case economic(Economic)
|
||||
case thermal(Thermal)
|
||||
|
||||
public struct Economic: Codable, Equatable, Sendable {
|
||||
|
||||
public let fuelType: FuelType
|
||||
public let fuelCostPerUnit: Double
|
||||
public let fuelAFUE: Double
|
||||
public let costPerKW: Double
|
||||
|
||||
public init(
|
||||
fuelType: HeatingBalancePoint.FuelType,
|
||||
fuelCostPerUnit: Double,
|
||||
fuelAFUE: Double,
|
||||
costPerKW: Double
|
||||
) {
|
||||
self.fuelType = fuelType
|
||||
self.fuelCostPerUnit = fuelCostPerUnit
|
||||
self.fuelAFUE = fuelAFUE
|
||||
self.costPerKW = costPerKW
|
||||
}
|
||||
}
|
||||
|
||||
public struct Thermal: Codable, Equatable, Sendable {
|
||||
|
||||
public let systemSize: Double
|
||||
@@ -42,8 +63,32 @@ public enum HeatingBalancePoint {
|
||||
}
|
||||
|
||||
public enum Response: Codable, Equatable, Sendable {
|
||||
case economic(Economic)
|
||||
case thermal(Thermal)
|
||||
|
||||
public struct Economic: Codable, Equatable, Sendable {
|
||||
|
||||
public let balancePointTemperature: Double
|
||||
public let fuelCostPerMMBTU: Double
|
||||
public let electricCostPerMMBTU: Double
|
||||
public let copAtBalancePoint: Double
|
||||
public let electricFuelRatio: Double
|
||||
|
||||
public init(
|
||||
balancePointTemperature: Double,
|
||||
fuelCostPerMMBTU: Double,
|
||||
electricCostPerMMBTU: Double,
|
||||
copAtBalancePoint: Double,
|
||||
electricFuelRatio: Double
|
||||
) {
|
||||
self.balancePointTemperature = balancePointTemperature
|
||||
self.fuelCostPerMMBTU = fuelCostPerMMBTU
|
||||
self.electricCostPerMMBTU = electricCostPerMMBTU
|
||||
self.copAtBalancePoint = copAtBalancePoint
|
||||
self.electricFuelRatio = electricFuelRatio
|
||||
}
|
||||
}
|
||||
|
||||
public struct Thermal: Codable, Equatable, Sendable {
|
||||
|
||||
public let capacityAt47: Double
|
||||
@@ -91,6 +136,26 @@ public enum HeatingBalancePoint {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FuelType: String, CaseIterable, Codable, Equatable, Sendable {
|
||||
case naturalGas
|
||||
case propane
|
||||
case oil
|
||||
|
||||
public var label: String {
|
||||
switch self {
|
||||
case .propane, .oil: return "\(rawValue.capitalized)"
|
||||
case .naturalGas: return "Natural Gas"
|
||||
}
|
||||
}
|
||||
|
||||
public var units: String {
|
||||
switch self {
|
||||
case .propane, .oil: return "gallons"
|
||||
case .naturalGas: return "therm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
@@ -99,7 +164,13 @@ public enum HeatingBalancePoint {
|
||||
static func mock(mode: HeatingBalancePoint.Mode) -> Self {
|
||||
switch mode {
|
||||
case .economic:
|
||||
fatalError()
|
||||
return .economic(.init(
|
||||
balancePointTemperature: -10.8,
|
||||
fuelCostPerMMBTU: 27.6,
|
||||
electricCostPerMMBTU: 38.1,
|
||||
copAtBalancePoint: 2.24,
|
||||
electricFuelRatio: 1.38
|
||||
))
|
||||
case .thermal:
|
||||
return .thermal(.init(
|
||||
capacityAt47: 24600,
|
||||
|
||||
Reference in New Issue
Block a user