feat: Begins manual d core models.

This commit is contained in:
2025-12-18 21:36:46 -05:00
parent 5d6e50a983
commit 25736638eb
5 changed files with 74 additions and 20 deletions

View File

@@ -1,23 +1,20 @@
// swift-tools-version: 6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "swift-manual-d",
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "swift-manual-d",
targets: ["swift-manual-d"]
),
.library(name: "swift-manual-d", targets: ["swift-manual-d"]),
.library(name: "ManualDCore", targets: ["ManualDCore"]),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "swift-manual-d"
),
.target(
name: "ManualDCore"
),
.testTarget(
name: "swift-manual-dTests",
dependencies: ["swift-manual-d"]

View File

@@ -0,0 +1,7 @@
import Foundation
public typealias ComponentPressureLosses = [String: Double]
extension ComponentPressureLosses {
public var totalLosses: Double { values.reduce(0) { $0 + $1 } }
}

View File

@@ -0,0 +1,13 @@
import Foundation
public struct CoolingLoad: Codable, Equatable {
public let total: Double
public let sensible: Double
public var latent: Double { total - sensible }
public var shr: Double { sensible / total }
public init(total: Double, sensible: Double) {
self.total = total
self.sensible = sensible
}
}

View File

@@ -0,0 +1,17 @@
import Foundation
public struct EquipmentInfo: Codable, Equatable {
public let staticPressure: Double
public let heatingCFM: Int
public let coolingCFM: Int
public init(
staticPressure: Double = 0.5,
heatingCFM: Int,
coolingCFM: Int
) {
self.staticPressure = staticPressure
self.heatingCFM = heatingCFM
self.coolingCFM = coolingCFM
}
}

View File

@@ -0,0 +1,20 @@
import Foundation
public struct Room: Codable, Equatable {
public let name: String
public let heatingLoad: Double
public let coolingLoad: CoolingLoad
public let registerCount: Int
public init(
name: String,
heatingLoad: Double,
coolingLoad: CoolingLoad,
registerCount: Int = 1
) {
self.name = name
self.heatingLoad = heatingLoad
self.coolingLoad = coolingLoad
self.registerCount = registerCount
}
}