feat: Starts manual-d client and adds friction rate calculation and tests.

This commit is contained in:
2025-12-19 11:57:21 -05:00
parent 5b67792051
commit 0aabd612b2
11 changed files with 228 additions and 9 deletions

View File

@@ -2,6 +2,16 @@ import Foundation
public typealias ComponentPressureLosses = [String: Double]
extension ComponentPressureLosses {
public var totalLosses: Double { values.reduce(0) { $0 + $1 } }
}
#if DEBUG
extension ComponentPressureLosses {
public static var mock: Self {
[
"evaporator-coil": 0.2,
"filter": 0.1,
"supply-outlet": 0.03,
"return-grille": 0.03,
"balancing-damper": 0.03,
]
}
}
#endif

View File

@@ -1,6 +1,6 @@
import Foundation
public struct CoolingLoad: Codable, Equatable {
public struct CoolingLoad: Codable, Equatable, Sendable {
public let total: Double
public let sensible: Double
public var latent: Double { total - sensible }

View File

@@ -2,7 +2,7 @@ import Foundation
// TODO: Add other description / label for items that have same group & letter, but
// different effective length.
public struct EffectiveLengthGroup: Codable, Equatable {
public struct EffectiveLengthGroup: Codable, Equatable, Sendable {
public let group: Int
public let letter: String
public let effectiveLength: Int
@@ -24,7 +24,7 @@ public struct EffectiveLengthGroup: Codable, Equatable {
extension EffectiveLengthGroup {
public enum Category: String, Codable, Equatable {
public enum Category: String, Codable, Equatable, Sendable {
case any
case supply
case `return`
@@ -32,7 +32,7 @@ extension EffectiveLengthGroup {
}
public let effectiveLengthsLookup: [String: EffectiveLengthGroup] {
public let effectiveLengthsLookup: [String: EffectiveLengthGroup] = {
[
"1a": .init(group: 1, letter: "a", effectiveLength: 35, category: .supply),
"1b": .init(group: 1, letter: "b", effectiveLength: 10, category: .supply),
@@ -625,4 +625,4 @@ public let effectiveLengthsLookup: [String: EffectiveLengthGroup] {
"12u": .init(group: 12, letter: "u", effectiveLength: 25, category: .any),
"12v": .init(group: 12, letter: "v", effectiveLength: 30, category: .any),
]
}
}()

View File

@@ -1,6 +1,6 @@
import Foundation
public struct Room: Codable, Equatable {
public struct Room: Codable, Equatable, Sendable {
public let name: String
public let heatingLoad: Double
public let coolingLoad: CoolingLoad