WIP: Cleans up ManualDClient and adds some more document strings.
Some checks failed
CI / Linux Tests (push) Failing after 7m3s
Some checks failed
CI / Linux Tests (push) Failing after 7m3s
This commit is contained in:
@@ -11,7 +11,7 @@ extension ManualDClient: DependencyKey {
|
||||
let fr = pow(frictionRate.rawValue, 0.5)
|
||||
let ductulatorSize = pow(Double(cfm.rawValue) / (3.12 * fr), 0.38)
|
||||
let finalSize = try roundSize(ductulatorSize)
|
||||
let flexSize = try flexSize(cfm, frictionRate)
|
||||
let flexSize = try flexSize(cfm, frictionRate.rawValue)
|
||||
return .init(
|
||||
calculatedSize: ductulatorSize,
|
||||
finalSize: finalSize,
|
||||
@@ -21,16 +21,16 @@ extension ManualDClient: DependencyKey {
|
||||
},
|
||||
frictionRate: { request in
|
||||
// Ensure the total effective length is greater than 0.
|
||||
guard request.totalEffectiveLength > 0 else {
|
||||
guard request.totalEquivalentLength > 0 else {
|
||||
throw ManualDError(message: "Total Effective Length should be greater than 0.")
|
||||
}
|
||||
|
||||
let totalComponentLosses = request.componentPressureLosses.total
|
||||
let availableStaticPressure = request.externalStaticPressure - totalComponentLosses
|
||||
let frictionRate = availableStaticPressure * 100.0 / Double(request.totalEffectiveLength)
|
||||
let frictionRate = availableStaticPressure * 100.0 / Double(request.totalEquivalentLength)
|
||||
return .init(
|
||||
availableStaticPressure: availableStaticPressure,
|
||||
value: .init(rawValue: frictionRate)
|
||||
value: frictionRate
|
||||
)
|
||||
},
|
||||
// totalEquivalentLength: { request in
|
||||
@@ -42,8 +42,8 @@ extension ManualDClient: DependencyKey {
|
||||
rectangularSize: { round, height in
|
||||
let width = (Double.pi * (pow(Double(round.rawValue) / 2.0, 2.0))) / Double(height.rawValue)
|
||||
return .init(
|
||||
height: height,
|
||||
width: .init(rawValue: Int(width.rounded(.toNearestOrEven)))
|
||||
height: height.rawValue,
|
||||
width: Int(width.rounded(.toNearestOrEven))
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user