0% found this document useful (0 votes)
10 views6 pages

Channel Design Calculation Tool

The document contains code for a Small Basic program that allows users to design trapezoidal and rectangular channel cross-sections. It includes subroutines to: 1) Display a main menu with option buttons for different channel designs 2) Perform calculations for a trapezoidal channel design based on user input parameters 3) Perform calculations for a rectangular channel design based on user input parameters The program displays input boxes, output boxes and buttons to trigger calculations for various channel properties.

Uploaded by

ryeue
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Channel Design Calculation Tool

The document contains code for a Small Basic program that allows users to design trapezoidal and rectangular channel cross-sections. It includes subroutines to: 1) Display a main menu with option buttons for different channel designs 2) Perform calculations for a trapezoidal channel design based on user input parameters 3) Perform calculations for a rectangular channel design based on user input parameters The program displays input boxes, output boxes and buttons to trigger calculations for various channel properties.

Uploaded by

ryeue
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lester Jr. L.

Aspilan
AE – 713 Basic Programming

Command in Small Basic

mainmenu()
[Link] = 500
[Link] = 600

Sub mainmenu
[Link] = 1200
[Link] = 600
[Link]()
[Link] = "Channel Design Calculation"
[Link] = whichbutton

butTrapezoidal = [Link]("Trapezoidal Channel


Design",25,25)

butRectangular = [Link]("Rectangular Channel Design",


25,120)

butParabolic = [Link]("Parabolic Channel Design",


25,220)

butCancel = [Link]("Cancel",350,350)

[Link]= anybutton

EndSub

Sub anybutton
linker= [Link]

If linker= butTrapezoidal Then


trapezoidalanalysis()

ElseIf linker= butRectangular then


rectangularbutton()
EndIf
EndSub

Sub trapezoidalanalysis
[Link]()
[Link] = "Dark"
[Link](25, 25,"Side Slopes")
[Link](50, 45,"Z1:")
Z1box = [Link](75,41)
[Link](50, 75,"Z2:")
Z2box = [Link](75,72)

[Link](25, 100,"Water Depth")


[Link](57, 121,"Y:")
Ybox = [Link](75,119)

[Link](25, 150,"Bottom Width")


[Link](57, 173,"b:")
bbox = [Link](75,170)

[Link](25, 200,"Manning Roughness")


[Link](57, 220,"n:")
nbox = [Link](75,218)

[Link](25, 240,"Channel Slope")


[Link](57, 262,"S:")
Sbox = [Link](75,260)

butCalculate = [Link]("Wetted Perimeter",315,5)


Calculation = [Link](315, 30)
[Link](Calculation, 150, 25)

butTCalculate = [Link]("Top Width",315,65)


CalculationT = [Link](315, 90)
[Link](CalculationT, 150, 25)

butACalculate = [Link]("Area",315,125)
CalculationA = [Link](315, 150)
[Link](CalculationA,150,25)

butHCalculate = [Link]("Hydraulic Radius",315,185)


CalculationH = [Link](315, 210)
[Link](CalculationH,250,25)

butVCalculate = [Link]("Velocity",315,240)
CalculationV = [Link](315, 265)
[Link](CalculationV,250,25)

butQCalculate = [Link]("Discharge",315,295)
CalculationQ = [Link](315, 320)
[Link](CalculationQ,250,25)
butTetaCalculate = [Link]("Angle",315,350)
CalculationTeta = [Link](315, 375)
[Link](CalculationTeta,250,25)

butFCalculate = [Link]("Froude Number",315,405)


CalculationF = [Link](315, 430)
[Link](CalculationF,250,25)

[Link]= whichbutton

EndSub

Sub whichbutton
button = [Link]

Z1 = [Link](Z1box)
Z2 = [Link](Z2box)
Y = [Link](Ybox)
b = [Link](bbox)
n = [Link](nbox)
S = [Link](sbox)

P = b + Y * (([Link](1 + [Link](Z1,2))) +
([Link](1 + [Link](Z2,2))))
T = b + Y * (Z1 + Z2)
A = Y/2 * (b + T)
R = A/P
V = (([Link](R,2/3)) * ([Link](S,1/2)))/n
Q = V*A
Teta = (S*180)/[Link]
F = V * [Link]((T/(Q*A *[Link](Teta))))

If button = butCalculate Then


[Link](Calculation, P)

ElseIf button = butTCalculate Then


[Link](CalculationT, T)

ElseIf button = butACalculate Then


[Link](CalculationA, A)

ElseIf button = butHCalculate Then


[Link](CalculationH, R)

ElseIf button = butVCalculate Then


[Link](CalculationV, V)

ElseIf button = butQCalculate Then


[Link](CalculationQ, Q)

ElseIf button = butTetaCalculate Then


[Link](CalculationTeta, Teta)

ElseIf button = butFCalculate Then


[Link](CalculationF, F)

EndIf

EndSub

Sub rectangularbutton

linkerR= [Link]

If linkerR= butRectangular Then


rectangularanalysis()

EndIf
EndSub

Sub rectangularanalysis

[Link]()
[Link] = "Dark"

[Link](25, 25,"Water Depth")


[Link](57, 52,"Y:")
RYbox = [Link](75,49)

[Link](25, 90,"Bottom Width")


[Link](57, 118,"b:")
Rbbox = [Link](75,115)

[Link](25, 155,"Manning Roughness")


[Link](57, 182,"n:")
Rnbox = [Link](75,180)

[Link](25, 220,"Channel Slope")


[Link](57, 250,"S:")
RSbox = [Link](75,248)
butRACalculate = [Link]("Area",315,25)
CalculationRA = [Link](315, 50)
[Link](CalculationRA,250,25)

butRWPCalculate = [Link]("Wetted Perimeter",315,102)


CalculationRWP = [Link](315, 127)
[Link](CalculationRWP,250,25)

butRHRCalculate = [Link]("Hydraulic Radius",315,177)


CalculationRHR = [Link](315, 202)
[Link](CalculationRHR,250,25)

butRVCalculate = [Link]("Velocity",315,250)
CalculationRV = [Link](315, 275)
[Link](CalculationRV,250,25)

butRVCalculate = [Link]("Discharge",315,325)
CalculationRV = [Link](315, 350)
[Link](CalculationRV,250,25)

[Link]= rectangularwhichbutton

EndSub

Sub rectangularwhichbutton
Rbutton = [Link]

RY = [Link](RYbox)
Rb = [Link](Rbbox)
Rn = [Link](Rnbox)
RS = [Link](RSbox)

A = (RY) * (Rb)
P = (2*RY) + Rb
R = A/P

If Rbutton = butRACalculate Then


[Link](CalculationRA, A)

ElseIf Rbutton = butRWPCalculate Then


[Link](CalculationRWP, P)

ElseIf Rbutton = butRHRCalculate Then


[Link](CalculationRHR, R)

ElseIf Rbutton = butRVCalculate Then


[Link](CalculationRV, V)

EndIf
EndSub

You might also like