feat: Initial commit
This commit is contained in:
148
Sources/Models/Interpolate.swift
Normal file
148
Sources/Models/Interpolate.swift
Normal file
@@ -0,0 +1,148 @@
|
||||
public enum Interpolate {
|
||||
|
||||
public struct Request: Codable, Equatable, Sendable {
|
||||
|
||||
public let designInfo: DesignInfo
|
||||
public let houseLoad: HouseLoad
|
||||
public let systemType: SystemType
|
||||
public let manufacturersCapacity: Capacity.ManufacturersCooling
|
||||
|
||||
public init(
|
||||
designInfo: DesignInfo,
|
||||
houseLoad: HouseLoad,
|
||||
systemType: SystemType,
|
||||
manufacturersCapacity: Capacity.ManufacturersCooling
|
||||
) {
|
||||
self.designInfo = designInfo
|
||||
self.houseLoad = houseLoad
|
||||
self.systemType = systemType
|
||||
self.manufacturersCapacity = manufacturersCapacity
|
||||
}
|
||||
}
|
||||
|
||||
public struct Response: Codable, Equatable, Sendable {
|
||||
|
||||
public let failed: Bool
|
||||
public let failures: [String]?
|
||||
public let interpolationType: InterpolationType
|
||||
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,
|
||||
interpolationType: InterpolationType,
|
||||
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.interpolationType = interpolationType
|
||||
self.interpolatedCapacity = interpolatedCapacity
|
||||
self.excessLatent = excessLatent
|
||||
self.finalCapacityAtDesign = finalCapacityAtDesign
|
||||
self.altitudeDerating = altitudeDerating
|
||||
self.capacityAsPercentOfLoad = capacityAsPercentOfLoad
|
||||
self.sizingLimits = sizingLimits
|
||||
}
|
||||
}
|
||||
|
||||
public enum InterpolationType2: Codable, Equatable, Sendable {
|
||||
case noInterpolation(Capacity.ManufacturersCooling)
|
||||
case oneWayIndoor(OneWayIndoor)
|
||||
case oneWayOutdoor(OneWayOutdoor)
|
||||
}
|
||||
|
||||
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: Interpolate.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: Interpolate.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: Interpolate.OneWayOutdoor.Capacities.Capacity,
|
||||
belowOutdoor: Interpolate.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 enum InterpolationType: String, CaseIterable, Codable, Equatable, Sendable {
|
||||
case noInterpolation
|
||||
case oneWayIndoor
|
||||
case oneWayOutdoor
|
||||
case twoWay
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user