diff --git a/Package.swift b/Package.swift index e7e18f9..17a1719 100644 --- a/Package.swift +++ b/Package.swift @@ -1,26 +1,23 @@ // 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"] - ), - ], - 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" - ), - .testTarget( - name: "swift-manual-dTests", - dependencies: ["swift-manual-d"] - ), - ] + name: "swift-manual-d", + products: [ + .library(name: "swift-manual-d", targets: ["swift-manual-d"]), + .library(name: "ManualDCore", targets: ["ManualDCore"]), + ], + targets: [ + .target( + name: "swift-manual-d" + ), + .target( + name: "ManualDCore" + ), + .testTarget( + name: "swift-manual-dTests", + dependencies: ["swift-manual-d"] + ), + ] ) diff --git a/Sources/ManualDCore/ComponentPressureLosses.swift b/Sources/ManualDCore/ComponentPressureLosses.swift new file mode 100644 index 0000000..d796d99 --- /dev/null +++ b/Sources/ManualDCore/ComponentPressureLosses.swift @@ -0,0 +1,7 @@ +import Foundation + +public typealias ComponentPressureLosses = [String: Double] + +extension ComponentPressureLosses { + public var totalLosses: Double { values.reduce(0) { $0 + $1 } } +} diff --git a/Sources/ManualDCore/CoolingLoad.swift b/Sources/ManualDCore/CoolingLoad.swift new file mode 100644 index 0000000..f018e9e --- /dev/null +++ b/Sources/ManualDCore/CoolingLoad.swift @@ -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 + } +} diff --git a/Sources/ManualDCore/EquipmentInfo.swift b/Sources/ManualDCore/EquipmentInfo.swift new file mode 100644 index 0000000..4019c07 --- /dev/null +++ b/Sources/ManualDCore/EquipmentInfo.swift @@ -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 + } +} diff --git a/Sources/ManualDCore/Room.swift b/Sources/ManualDCore/Room.swift new file mode 100644 index 0000000..2dd6b2c --- /dev/null +++ b/Sources/ManualDCore/Room.swift @@ -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 + } +}