194 lines
6.0 KiB
Swift
194 lines
6.0 KiB
Swift
public enum CoolingInterpolation {
|
|
|
|
public struct Request: Codable, Equatable, Sendable {
|
|
|
|
public let elevation: Int?
|
|
public let summerDesignInfo: DesignInfo.Summer
|
|
public let coolingLoad: 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: Capacity.Cooling
|
|
public let excessLatent: Int
|
|
public let finalCapacityAtDesign: Capacity.Cooling
|
|
public let altitudeDerating: AdjustmentMultiplier?
|
|
public let capacityAsPercentOfLoad: Capacity.Cooling
|
|
public let sizingLimits: SizingLimits.Response
|
|
|
|
public init(
|
|
failures: [String]? = nil,
|
|
interpolatedCapacity: Capacity.Cooling,
|
|
excessLatent: Int,
|
|
finalCapacityAtDesign: 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(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: Capacity.ManufacturersContainer
|
|
public let belowDewpoint: Capacity.ManufacturersContainer
|
|
|
|
public init(
|
|
aboveDewpoint: Capacity.ManufacturersContainer,
|
|
belowDewpoint: 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: CapacityContainer
|
|
public let belowOutdoor: CapacityContainer
|
|
|
|
public init(
|
|
aboveOutdoor: CoolingInterpolation.OneWayOutdoor.Capacities.CapacityContainer,
|
|
belowOutdoor: CoolingInterpolation.OneWayOutdoor.Capacities.CapacityContainer
|
|
) {
|
|
self.aboveOutdoor = aboveOutdoor
|
|
self.belowOutdoor = belowOutdoor
|
|
}
|
|
|
|
public struct CapacityContainer: 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: Capacity.ManufacturersContainer
|
|
public let belowDewPoint: Capacity.ManufacturersContainer
|
|
|
|
public init(
|
|
outdoorTemperature: Int,
|
|
aboveDewPoint: Capacity.ManufacturersContainer,
|
|
belowDewPoint: Capacity.ManufacturersContainer
|
|
) {
|
|
self.outdoorTemperature = outdoorTemperature
|
|
self.aboveDewPoint = aboveDewPoint
|
|
self.belowDewPoint = belowDewPoint
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|