DKEnrichedAir
public final class DKEnrichedAir : DiveCalculator
A DiveCalculator to perform calculations involving Enriched Air Nitrox, EANx.
Since
1.0-
Calculates the maximum operating depth of a specified gas and maximum partial pressure of oxygen.
Example
let enrichedAirCalculator = DKEnrichedAir.init(with: diveKit) do { let gas = try Gas.enrichedAir(32) // Calculate MOD for EANx32 with maximum fraction oxygen of 1.4 let maximumOperatingDepth = try enrichedAirCalculator.maximumOperatingDepth(fractionOxygen: 1.4, gas: gas) print(maximumOperatingDepth.value) // 111.375 } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Swift
public func maximumOperatingDepth( fractionOxygen: FractionOxygen, gas: Gas ) throws -> CalculationParameters
fractionOxygenDouble representing the maximum partial pressure of oxygen.
gasGasrepresenting the gas to be used for calculation.Return Value
Calculationrepresenting the maximum operating depth for specified gas and maximum partial pressure of oxygen. -
Calculates the equivalent air depth of a specified gas and maximum partial pressure of oxygen.
Example
let enrichedAirCalculator = DKEnrichedAir.init(with: diveKit) do { let gas = try Gas.enrichedAir(32) // Calculate EAD for EANx32 at 109 feet let equivalentAirDepth = try enrichedAirCalculator.equivalentAirDepth(depth: 109, gas: gas) print(equivalentAirDepth) // 89.23 } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Swift
public func equivalentAirDepth( for depth: Depth, with gas: Gas ) throws -> CalculationParameters
depthDouble representing the depth to be used for calculation.
gasGasrepresenting the gas to be used for calculation.Return Value
Calculationrepresenting the equivalent air depth for specified gas and depth. -
Calculates the best blend of enriched air, EANx, for a given fraction of oxygen and a given depth.
Throws
DiveKit.ErrorExample
let enrichedAirCalc = DKEnrichedAir.init(waterType: .saltWater, measurementUnit: .imperial) do { // Calculate 'best blend' for to 90 feet with maximum fraction oxygen of 1.4 let bestBlend = try enrichedAirCalc.bestBlend(for: 90, fractionOxygen: 1.4) print(bestBlend.percentOxygen) // 37.0 (% oxygen) } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Swift
public func bestBlend( for depth: Depth, fractionOxygen: FractionOxygen ) throws -> GasParameters
depthDouble presenting a depth.
fractionOxygenDouble representing the fraction of oxygen.
Return Value
Gasrepresenting the calculated best blend for the given dive. -
Calculates if the specified blend of enriched air, EANx, exceeds the maximum operating depth of specified depth and maximum partial pressure of oxygen.
Example
let enrichedAirCalc = DKEnrichedAir.init(waterType: .saltWater, measurementUnit: .imperial) do { let gas = try Gas.enrichedAir(32) // Calculate if 127 feet exceeds MOD for EANx32 at maximum fraction of oxygen of 1.4 let exceedsMod = enrichedAirCalc.exceedsMaximumOperatingDepth(with: gas, fractionOxygen: 1.4, depth: 127) print(exceedsMod) // true } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Swift
public func exceedsMaximumOperatingDepth( with gas: Gas, fractionOxygen: FractionOxygen, depth: Depth ) -> BoolParameters
fractionOxygenDouble representing the maximum partial pressure oxygen.
depthDouble presenting a depth.
gasGasrepresenting the gas to be used for calculation.Return Value
Boolean determining if depth exceeds maximum operating depth for specified
Gas. -
Calculates the maximum operating depth of a specified gas and maximum partial pressure of oxygen.
Example
let enrichedAirCalc = DKEnrichedAir.init(waterType: .saltWater, measurementUnit: .imperial) let gas = DKGas.enrichedAir(percentage: 32) do { // Calculate MOD for EANx32 with maximum fraction oxygen of 1.4 let mod = try enrichedAirCalc.maximumOperatingDepth(fractionOxygen: 1.4, gas: gas) print(mod) // 111 (feet) } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Swift
@available(*, deprecated, renamed: "maximumOperatingDepth(fractionOxygen:gas:﹚") public func maximumOperatingDepth( fractionOxygen: FractionOxygen, gas: Gas, decimalPlaces: Int = 2 ) throws -> DoubleParameters
fractionOxygenDouble representing the maximum partial pressure of oxygen.
gasGasrepresenting the gas to be used for calculation.decimalPlacesInteger representing the desired number of decimal places to return.
Return Value
Double representing the maximum operating depth for specified gas and maximum partial pressure of oxygen.
-
Calculates the equivalent air depth of a specified gas and maximum partial pressure of oxygen.
Example
let enrichedAirCalc = DKEnrichedAir.init(waterType: .saltWater, measurementUnit: .imperial) let gas = DKGas.enrichedAir(percentage: 32) do { // Calculate EAD for EANx32 at 109 feet let ead = try enrichedAirCalc.equivalentAirDepth(depth: 109, gas: gas) print(ead) // 89 (feet) } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Parameters
depthDouble representing the depth to be used for calculation.
gasDKGasrepresenting the gas to be used for calculation.decimalPlacesInteger representing the desired number of decimal places to return.
Return Value
Double representing the equivalent air depth for specified gas and depth.
DKEnrichedAir Class Reference