feat: Completes hvac-system-performance views and api call.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Dependencies
|
||||
import PsychrometricClient
|
||||
|
||||
public enum HVACSystemPerformance {
|
||||
@@ -51,6 +52,7 @@ public enum HVACSystemPerformance {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add delta-enthalpy.
|
||||
public struct Capacity: Codable, Equatable, Sendable {
|
||||
|
||||
public let total: Double
|
||||
@@ -70,18 +72,52 @@ public enum HVACSystemPerformance {
|
||||
public let cfmPerTon: Double
|
||||
public let targetTemperatureSplit: Double
|
||||
public let actualTemperatureSplit: Double
|
||||
public let condensationRate: Double
|
||||
public let condensationRatePoundsPerHour: Double // lb/hr
|
||||
public let condensationRateGallonsPerHour: Double // gal/hr
|
||||
|
||||
public init(
|
||||
cfmPerTon: Double,
|
||||
targetTemperatureSplit: Double,
|
||||
actualTemperatureSplit: Double,
|
||||
condensationRate: Double
|
||||
condensationRatePoundsPerHour: Double
|
||||
) {
|
||||
self.cfmPerTon = cfmPerTon
|
||||
self.targetTemperatureSplit = targetTemperatureSplit
|
||||
self.actualTemperatureSplit = actualTemperatureSplit
|
||||
self.condensationRate = condensationRate
|
||||
self.condensationRatePoundsPerHour = condensationRatePoundsPerHour
|
||||
self.condensationRateGallonsPerHour = condensationRatePoundsPerHour * 0.12
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
public extension HVACSystemPerformance.Response {
|
||||
|
||||
static func mock() async throws -> Self {
|
||||
@Dependency(\.psychrometricClient) var psychrometricClient
|
||||
|
||||
return try await .init(
|
||||
returnAirProperties: psychrometricClient.psychrometricProperties(.dryBulb(75, relativeHumidity: 50%)),
|
||||
supplyAirProperties: psychrometricClient.psychrometricProperties(.dryBulb(55, relativeHumidity: 87%)),
|
||||
capacity: .mock,
|
||||
systemMetrics: .mock
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public extension HVACSystemPerformance.Capacity {
|
||||
static var mock: Self {
|
||||
.init(total: 24000, sensible: 19000, latent: 5000)
|
||||
}
|
||||
}
|
||||
|
||||
public extension HVACSystemPerformance.SystemMetrics {
|
||||
static let mock = Self(
|
||||
cfmPerTon: 400,
|
||||
targetTemperatureSplit: 20.8,
|
||||
actualTemperatureSplit: 18.7,
|
||||
condensationRatePoundsPerHour: 16981.3
|
||||
)
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user