ScubaMath.psm1
<# .Synopsis Math is hard! .DESCRIPTION Long description .NOTES Yes. You can dive without a computer, even with Nitrox... .COMPONENT Scuba diving .ROLE Gas @ pressure math .FUNCTIONALITY Saftey calculations, and dive planning #> #region NITROX Function Get-NitroxMOD { <# .SYNOPSIS Gets the maximum operating depth in feet, based on F02, and desired P02 .DESCRIPTION Calculations based on the magic circle method .PARAMETER P02 Desired partial pressure for your dive. Warmer water, you can max out @ 1.6... colder water, suggest 1.4 .PARAMETER F02 Oxygen percentage your tank is filled with, in decimal form .EXAMPLE Get-NitroxMOD -P02 1.4 -F02 .36 Returns the maximum depth for your dive. .LINK Watch the video https://www.youtube.com/watch?v=Ho3erOkNEXQ .INPUTS Double .OUTPUTS PSObject #> Param ( [Double] $P02 = 1.4, [Double] $F02 = .32 ) # We need to get our absolute atmospheric pressure, then convert it to depth $Atmosphere = $P02 / $F02 - 1 $MOD = $Atmosphere * 33 $properties = [Ordered] @{ #'MOD' = '{0:N1}' -f $MOD 'MOD' = $MOD 'P02' = $P02 'F02' = $F02 'Atmospheric_Pressure' = $Atmosphere } $retVal = New-Object -TypeName PSObject -Property $properties $retVal } Function Get-NitroxF02 { <# .SYNOPSIS Gets the fraction of oxygen, based on p02, and planned depth .DESCRIPTION Calculations based on the magic circle method. This method of finding the best EAN mix, is good for planning to dive a destination i.e. wreck dive. .PARAMETER P02 Desired partial pressure for your dive. Warmer water, you can max out @ 1.6... colder water, suggest 1.4 .PARAMETER MOD Maximum Operating Depth at which you plan to dive. .EXAMPLE Get-NitroxMOD -P02 1.6 -Depth 100 If you planned to dive 100 ft, and your desired partial pressure is 1.6, this would return the optimal F02, to fill your tank with .LINK Watch the video https://www.youtube.com/watch?v=Ho3erOkNEXQ .INPUTS Double .OUTPUTS PSObject #> Param ( [Double] $P02 = 1.4, [Parameter( Mandatory = $true, Position = 1, HelpMessage = 'Max depth you plan to dive' )] [Double] $MOD ) # We need to get our absolute atmospheric pressure from the depth $Atmosphere = $MOD / 33 + 1 $F02 = $P02 / $Atmosphere $properties = [Ordered] @{ #'MOD' = '{0:N1}' -f $MOD 'MOD' = $MOD 'P02' = $P02 'F02' = $F02 'Atmospheric_Pressure' = $Atmosphere } $retVal = New-Object -TypeName PSObject -Property $properties $retVal } Function Get-NitroxP02 { <# .SYNOPSIS Gets the partial pressure based on depth and gas mix .DESCRIPTION Calculations based on the magic circle method. Use to double check your P02 based on your tank fill, and dive plan. Always ensure you'll be safe... check it twice! .PARAMETER F02 Oxygen percentage your tank is filled with, in decimal form .PARAMETER MOD Maximum Operating Depth at which you plan to dive. .EXAMPLE Get-NitroxMOD -F02 .40 -Depth 100 If you planned to dive 100 ft, and your tank is filled with EAN40, this would return the P02 which you would experience at the MOD .LINK Watch the video https://www.youtube.com/watch?v=Ho3erOkNEXQ .INPUTS Double .OUTPUTS PSObject #> Param ( [Double] $F02 = .32, [Parameter( Mandatory = $true, Position = 1, HelpMessage = 'Max depth you plan to dive' )] [Double] $MOD ) # We need to get our absolute atmospheric pressure from the depth $Atmosphere = $MOD / 33 + 1 $P02 = $F02 * $Atmosphere $properties = [Ordered] @{ #'MOD' = '{0:N1}' -f $MOD 'MOD' = $MOD 'P02' = $P02 'F02' = $F02 'Atmospheric_Pressure' = $Atmosphere } $retVal = New-Object -TypeName PSObject -Property $properties $retVal } #endregion |