feat: Adds cooling interpolation tests.
This commit is contained in:
193
Sources/Models/CoolingInterpolation.swift
Normal file
193
Sources/Models/CoolingInterpolation.swift
Normal file
@@ -0,0 +1,193 @@
|
||||
public enum CoolingInterpolation {
|
||||
|
||||
public struct Request: Codable, Equatable, Sendable {
|
||||
|
||||
public let elevation: Int?
|
||||
public let summerDesignInfo: DesignInfo.Summer
|
||||
public let coolingLoad: Models.Capacity.Cooling
|
||||
public let systemType: SystemType
|
||||
public let interpolation: InterpolationRequest
|
||||
|
||||
public init(
|
||||
elevation: Int? = nil,
|
||||
summerDesignInfo: DesignInfo.Summer,
|
||||
coolingLoad: Capacity.Cooling,
|
||||
systemType: SystemType,
|
||||
interpolation: InterpolationRequest
|
||||
) {
|
||||
self.elevation = elevation
|
||||
self.summerDesignInfo = summerDesignInfo
|
||||
self.coolingLoad = coolingLoad
|
||||
self.systemType = systemType
|
||||
self.interpolation = interpolation
|
||||
}
|
||||
}
|
||||
|
||||
public struct Response: Codable, Equatable, Sendable {
|
||||
|
||||
public let failed: Bool
|
||||
public let failures: [String]?
|
||||
public let interpolatedCapacity: Models.Capacity.Cooling
|
||||
public let excessLatent: Int
|
||||
public let finalCapacityAtDesign: Models.Capacity.Cooling
|
||||
public let altitudeDerating: AdjustmentMultiplier?
|
||||
public let capacityAsPercentOfLoad: Models.Capacity.Cooling
|
||||
public let sizingLimits: SizingLimits.Response
|
||||
|
||||
public init(
|
||||
failures: [String]? = nil,
|
||||
interpolatedCapacity: Models.Capacity.Cooling,
|
||||
excessLatent: Int,
|
||||
finalCapacityAtDesign: Models.Capacity.Cooling,
|
||||
altitudeDerating: AdjustmentMultiplier? = nil,
|
||||
capacityAsPercentOfLoad: Capacity.Cooling,
|
||||
sizingLimits: SizingLimits.Response
|
||||
) {
|
||||
self.failed = failures != nil ? failures!.count > 0 : false
|
||||
self.failures = failures
|
||||
self.interpolatedCapacity = interpolatedCapacity
|
||||
self.excessLatent = excessLatent
|
||||
self.finalCapacityAtDesign = finalCapacityAtDesign
|
||||
self.altitudeDerating = altitudeDerating
|
||||
self.capacityAsPercentOfLoad = capacityAsPercentOfLoad
|
||||
self.sizingLimits = sizingLimits
|
||||
}
|
||||
}
|
||||
|
||||
public enum InterpolationRequest: Codable, Equatable, Sendable {
|
||||
case noInterpolation(Models.Capacity.ManufacturersCooling, AdjustmentMultiplier? = nil)
|
||||
case oneWayIndoor(OneWayIndoor)
|
||||
case oneWayOutdoor(OneWayOutdoor)
|
||||
case twoWay(TwoWay)
|
||||
}
|
||||
|
||||
public struct OneWayIndoor: Codable, Equatable, Sendable {
|
||||
|
||||
public let airflow: Int
|
||||
public let outdoorTemperature: Int
|
||||
public let capacities: Capacities
|
||||
public let adjustmentMultipliers: AdjustmentMultiplier?
|
||||
|
||||
public init(
|
||||
airflow: Int,
|
||||
outdoorTemperature: Int,
|
||||
capacities: CoolingInterpolation.OneWayIndoor.Capacities,
|
||||
adjustmentMultipliers: AdjustmentMultiplier? = nil
|
||||
) {
|
||||
self.airflow = airflow
|
||||
self.outdoorTemperature = outdoorTemperature
|
||||
self.capacities = capacities
|
||||
self.adjustmentMultipliers = adjustmentMultipliers
|
||||
}
|
||||
|
||||
public struct Capacities: Codable, Equatable, Sendable {
|
||||
|
||||
public let aboveDewpoint: Models.Capacity.ManufacturersContainer
|
||||
public let belowDewpoint: Models.Capacity.ManufacturersContainer
|
||||
|
||||
public init(
|
||||
aboveDewpoint: Models.Capacity.ManufacturersContainer,
|
||||
belowDewpoint: Models.Capacity.ManufacturersContainer
|
||||
) {
|
||||
self.aboveDewpoint = aboveDewpoint
|
||||
self.belowDewpoint = belowDewpoint
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct OneWayOutdoor: Codable, Equatable, Sendable {
|
||||
|
||||
public let airflow: Int
|
||||
public let wetBulb: Int
|
||||
public let capacities: Capacities
|
||||
public let adjustmentMultipliers: AdjustmentMultiplier?
|
||||
|
||||
public init(
|
||||
airflow: Int,
|
||||
wetBulb: Int,
|
||||
capacities: CoolingInterpolation.OneWayOutdoor.Capacities,
|
||||
adjustmentMultipliers: AdjustmentMultiplier? = nil
|
||||
) {
|
||||
self.airflow = airflow
|
||||
self.wetBulb = wetBulb
|
||||
self.capacities = capacities
|
||||
self.adjustmentMultipliers = adjustmentMultipliers
|
||||
}
|
||||
|
||||
public struct Capacities: Codable, Equatable, Sendable {
|
||||
|
||||
public let aboveOutdoor: Capacity
|
||||
public let belowOutdoor: Capacity
|
||||
|
||||
public init(
|
||||
aboveOutdoor: CoolingInterpolation.OneWayOutdoor.Capacities.Capacity,
|
||||
belowOutdoor: CoolingInterpolation.OneWayOutdoor.Capacities.Capacity
|
||||
) {
|
||||
self.aboveOutdoor = aboveOutdoor
|
||||
self.belowOutdoor = belowOutdoor
|
||||
}
|
||||
|
||||
public struct Capacity: Codable, Equatable, Sendable {
|
||||
|
||||
public let outdoorTemperature: Int
|
||||
public let totalCapacity: Int
|
||||
public let sensibleCapacity: Int
|
||||
|
||||
public init(outdoorTemperature: Int, totalCapacity: Int, sensibleCapacity: Int) {
|
||||
self.outdoorTemperature = outdoorTemperature
|
||||
self.totalCapacity = totalCapacity
|
||||
self.sensibleCapacity = sensibleCapacity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct TwoWay: Codable, Equatable, Sendable {
|
||||
|
||||
public let airflow: Int
|
||||
public let capacities: Capacities
|
||||
public let adjustmentMultipliers: AdjustmentMultiplier?
|
||||
|
||||
public init(
|
||||
airflow: Int,
|
||||
capacities: CoolingInterpolation.TwoWay.Capacities,
|
||||
adjustmentMultipliers: AdjustmentMultiplier? = nil
|
||||
) {
|
||||
self.airflow = airflow
|
||||
self.capacities = capacities
|
||||
self.adjustmentMultipliers = adjustmentMultipliers
|
||||
}
|
||||
|
||||
public struct Capacities: Codable, Equatable, Sendable {
|
||||
|
||||
public let above: CapacityContainer
|
||||
public let below: CapacityContainer
|
||||
|
||||
public init(
|
||||
above: CoolingInterpolation.TwoWay.Capacities.CapacityContainer,
|
||||
below: CoolingInterpolation.TwoWay.Capacities.CapacityContainer
|
||||
) {
|
||||
self.above = above
|
||||
self.below = below
|
||||
}
|
||||
|
||||
public struct CapacityContainer: Codable, Equatable, Sendable {
|
||||
|
||||
public let outdoorTemperature: Int
|
||||
public let aboveDewPoint: Models.Capacity.ManufacturersContainer
|
||||
public let belowDewPoint: Models.Capacity.ManufacturersContainer
|
||||
|
||||
public init(
|
||||
outdoorTemperature: Int,
|
||||
aboveDewPoint: Models.Capacity.ManufacturersContainer,
|
||||
belowDewPoint: Models.Capacity.ManufacturersContainer
|
||||
) {
|
||||
self.outdoorTemperature = outdoorTemperature
|
||||
self.aboveDewPoint = aboveDewPoint
|
||||
self.belowDewPoint = belowDewPoint
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user