Precedure a Start Microsoft Excel. Open the Visual Basic Ednor. Create a new mod
ID: 3746375 • Letter: P
Question
Precedure a Start Microsoft Excel. Open the Visual Basic Ednor. Create a new module. You are going to create a moody friction factor fanction using the Haaland aquation Change the module name trom modalel to Friction b. Create function haaland f Re, eod) The function will determine the friction factoe given the Reynolds Number and the relative roughness (D) Make sure you specify that variables Nr and cod are Double, and the function rctum valac is Double Laminar Flow Equation (Re c-2000) Re Turbulent Flow Equation (Re4000) 691 3.7 Transition Flow Equation (2000 ReExplanation / Answer
Code:
'c) part of the problem'
Function log10_f (x As Double) As Double
log10_f = log(x)/log(10#)
End Function
' b) part of the problem'
Dim pow As Double
'please enter the value of pow here which is not clear in the image attached'
pow = (1.38#) 'please check with the question it is not clear in the image attached in the question sorry for the inconvenience'
Function haaland_f(Nr As Double, eod As Double) As Double
If (Nr <=0 ) Then
haaland_f = 0#
ElseIf(Nr <=2000)Then
haaland_f = 64#/Nr
ElseIf(Nr>=4000) Then
haaland_f = (1/(-1.8*(log10_f((eod/3.7)^pow+(6.91/Nr))))^2
Else
Dim val_laminar , var_Turbulent As Double
val_laminar = haaland_f(4000-Nr,eod)
var_Turbulent = haaland_f(Nr-2000)
haaland_f = (var_laminar + var_Turbulent)/(2000#)
End Function
'd) graph for Haaland friction factor'
Option Explicit
sub createchart()
Dim chart1 As Chart
set chart1 = Charts.Add
chart1.setSourceData source :=workspace("Sheet1").range("A1").CurrentRegion,plotby:=xlColumns
chart1.chartType = xlColumnClustered
End Sub
Code:
'c) part of the problem'
Function log10_f (x As Double) As Double
log10_f = log(x)/log(10#)
End Function
' b) part of the problem'
Dim pow As Double
'please enter the value of pow here which is not clear in the image attached'
pow = (1.38#) 'please check with the question it is not clear in the image attached in the question sorry for the inconvenience'
Function haaland_f(Nr As Double, eod As Double) As Double
If (Nr <=0 ) Then
haaland_f = 0#
ElseIf(Nr <=2000)Then
haaland_f = 64#/Nr
ElseIf(Nr>=4000) Then
haaland_f = (1/(-1.8*(log10_f((eod/3.7)^pow+(6.91/Nr))))^2
Else
Dim val_laminar , var_Turbulent As Double
val_laminar = haaland_f(4000-Nr,eod)
var_Turbulent = haaland_f(Nr-2000)
haaland_f = (var_laminar + var_Turbulent)/(2000#)
End Function
'd) graph for Haaland friction factor'
Option Explicit
sub createchart()
Dim chart1 As Chart
set chart1 = Charts.Add
chart1.setSourceData source :=workspace("Sheet1").range("A1").CurrentRegion,plotby:=xlColumns
chart1.chartType = xlColumnClustered
End Sub
Description:
Description:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.