feat: Initial commit
This commit is contained in:
50
Sources/SharedModels/RatedEnvelope.swift
Normal file
50
Sources/SharedModels/RatedEnvelope.swift
Normal file
@@ -0,0 +1,50 @@
|
||||
import Foundation
|
||||
|
||||
public struct RatedEnvelope<Rating>: Equatable {
|
||||
public var maximum: Double
|
||||
public var minimum: Double
|
||||
public var rated: Double
|
||||
|
||||
public init(
|
||||
maximum: Double,
|
||||
minimum: Double,
|
||||
rated: Double
|
||||
) {
|
||||
self.maximum = maximum
|
||||
self.minimum = minimum
|
||||
self.rated = rated
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Namespaces
|
||||
public enum StaticPressure { }
|
||||
public enum AirflowPerTon { }
|
||||
public enum AirflowLimits { }
|
||||
|
||||
// MARK: - Static Pressures
|
||||
public typealias RatedStaticPressures = RatedEnvelope<StaticPressure>
|
||||
extension RatedStaticPressures {
|
||||
public init() {
|
||||
self.init(maximum: 0.8, minimum: 0.3, rated: 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Airflow Per Ton
|
||||
public typealias RatedAirflowPerTon = RatedEnvelope<AirflowPerTon>
|
||||
extension RatedAirflowPerTon {
|
||||
public init() {
|
||||
self.init(maximum: 500, minimum: 350, rated: 400)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Airflow Limits
|
||||
public typealias RatedAirflowLimits = RatedEnvelope<AirflowLimits>
|
||||
extension RatedAirflowLimits {
|
||||
public init(tons: CoolingCapacity, using airflowPerTon: RatedAirflowPerTon = .init()) {
|
||||
self.init(
|
||||
maximum: airflowPerTon.maximum * tons.rawValue,
|
||||
minimum: airflowPerTon.minimum * tons.rawValue,
|
||||
rated: airflowPerTon.rated * tons.rawValue
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user