Visual Basic Code For Simulating the GS/GOGAT Cycle

Private Sub Command1_Click()
Unload Form1
End Sub

Private Sub Command2_Click()
Mx = Text13.Text
My2 = Text14.Text
My3 = Text15.Text
Label17.Caption = Text13.Text
Picture2.Refresh
Picture3.Refresh
z = Mx / 5000
a1 = Text17.Text
a2 = Text18.Text
TC = Text16.Text
r1 = Text5.Text
r2 = Text6.Text
r3 = Text12.Text
r4 = Text8.Text
r5 = Text9.Text
r6 = Text21.Text
r7 = Text7.Text
r8 = Text11.Text
r9 = Text22.Text
r10 = Text23.Text
r11 = Text24.Text
r12 = Text25.Text
r13 = Text30.Text
r14 = Text31.Text
r15 = Text32.Text
b1 = 0
b2 = Text1.Text
b3 = 0
b4 = Text2.Text
b5 = 0
b6 = Text19.Text
b7 = 0
b8 = Text10.Text
c1 = 0
c2 = Text3.Text
c3 = 0
c4 = Text4.Text
c5 = 0
c6 = Text20.Text
c7 = 0
c8 = Text26.Text
d1 = 0
d2 = Text1.Text
d3 = 0
d4 = Text2.Text
d5 = 0
d6 = Text19.Text
d7 = 0
d8 = Text10.Text
e1 = 0
e2 = Text27.Text
e3 = 0
e4 = Text28.Text
e5 = 0
e6 = Text29.Text
f1 = 0
f2 = Text33.Text
For t = 0 To Mx Step z
If t > TC Then a1 = a2
b1 = (b1 * b2 + a1 * z * r1) / (b2 + z * r1)
b2 = b2 + z * r1
b1 = (b1 * b2 - b1 * z * r1) / (b2 - z * r1)
b2 = b2 - z * r1
c1 = (c1 * c2 + b1 * z * r1) / (c2 + z * r1)
c2 = c2 + z * r1
c1 = (c1 * c2 + d1 * z * r1) / (c2 + z * r1)
c2 = c2 + z * r1
c1 = (c1 * c2 - c1 * z * 2 * r1) / (c2 - z * 2 * r1)
c2 = c2 - z * 2 * r1
d1 = (d1 * d2 + c1 * z * r1) / (d2 + z * r1)
d2 = d2 + z * r1
d1 = (d1 * d2 - d1 * z * r1) / (d2 - z * r1)
d2 = d2 - z * r1
c3 = (c3 * c4 + c1 * z * r1) / (c4 + z * r1)
c4 = c4 + z * r1
c3 = (c3 * c4 + e1 * z * r9) / (c4 + z * r9)
c4 = c4 + z * r9
c3 = (c3 * c4 + f1 * z * r14) / (c4 + z * r14)
c4 = c4 + z * r14
c3 = (c3 * c4 - c3 * z * r2) / (c4 - z * r2)
c4 = c4 - z * r2
c3 = (c3 * c4 - c3 * z * r6) / (c4 - z * r6)
c4 = c4 - z * r6
c3 = (c3 * c4 - c3 * z * r7) / (c4 - z * r7)
c4 = c4 - z * r7
c3 = (c3 * c4 - c3 * z * r8) / (c4 - z * r8)
c4 = c4 - z * r8
c3 = (c3 * c4 - c3 * z * r10) / (c4 - z * r10)
c4 = c4 - z * r10
c3 = (c3 * c4 - c3 * z * r13) / (c4 - z * r13)
c4 = c4 - z * r13
b3 = (b3 * b4 + a1 * z * r2) / (b4 + z * r2)
b4 = b4 + z * r2
b3 = (b3 * b4 - b3 * z * r3) / (b4 - z * r3)
b4 = b4 - z * r3
b3 = (b3 * b4 - b3 * z * r4) / (b4 - z * r4)
b4 = b4 - z * r4
b3 = (b3 * b4 - b3 * z * r5) / (b4 - z * r5)
b4 = b4 - z * r5
d3 = (d3 * d4 + c3 * z * r2) / (d4 + z * r2)
d4 = d4 + z * r2
d3 = (d3 * d4 - d3 * z * r3) / (d4 - z * r3)
d4 = d4 - z * r3
d3 = (d3 * d4 - d3 * z * r4) / (d4 - z * r4)
d4 = d4 - z * r4
d3 = (d3 * d4 - d3 * z * r5) / (d4 - z * r5)
d4 = d4 - z * r5
e1 = (e1 * e2 + c3 * z * r10) / (e2 + z * r10)
e2 = e2 + z * r10
e1 = (e1 * e2 - e1 * z * r9) / (e2 - z * r9)
e2 = e2 - z * r9
e1 = (e1 * e2 - e1 * z * r11) / (e2 - z * r11)
e2 = e2 - z * r11
e1 = (e1 * e2 - e1 * z * r12) / (e2 - z * r12)
e2 = e2 - z * r12
e3 = (e3 * e4 + e1 * z * r12) / (e4 + z * r12)
e4 = e4 + z * r12
e5 = (e5 * e6 + e1 * z * r11) / (e6 + z * r11)
e6 = e6 + z * r11
f1 = (f1 * f2 + c3 * z * r13) / (f2 + z * r13)
f2 = f2 + z * r13
f1 = (f1 * f2 - f1 * z * r14) / (f2 - z * r14)
f2 = f2 - z * r14
f1 = (f1 * f2 - f1 * z * r15) / (f2 - z * r15)
f2 = f2 - z * r15
c5 = (c5 * c6 + c3 * z * r7) / (c6 + z * r7)
c6 = c6 + z * r7
b5 = (b5 * b6 + b3 * z * r4) / (b6 + z * r4)
b6 = b6 + z * r4
d5 = (d5 * d6 + d3 * z * r4) / (d6 + z * r4)
d6 = d6 + z * r4
c7 = (c7 * c8 + c3 * z * r6) / (c8 + z * r6)
c8 = c8 + z * r6
b7 = (b7 * b8 + b3 * z * r5) / (b8 + z * r5)
b8 = b8 + z * r5
d7 = (d7 * d8 + d3 * z * r5) / (d8 + z * r5)
d8 = d8 + z * r5
x = t
If Option4.Value = True Then Y = ((b1 * b2) + (b3 * b4) + (b5 * b6)) / (b2 + b4 + b6)
If Option1.Value = True Then Y = b1
If Option2.Value = True Then Y = b3
If Option3.Value = True Then Y = b5
If Option5.Value = True Then Y = b7
x = (x * 2000 / Mx)
Y = 2000 - (Y * 2000 / My2)
Picture2.PSet (x, Y), QBColor(10)
If Option4.Value = True Then Y = ((c1 * c2) + (c3 * c4) + (c5 * c6)) / (c2 + c4 + c6)
If Option1.Value = True Then Y = c1
If Option2.Value = True Then Y = c3
If Option3.Value = True Then Y = c5
If Option5.Value = True Then Y = c7
Y = 2000 - (Y * 2000 / My2)
Picture2.PSet (x, Y), QBColor(12)
If Option4.Value = True Then Y = ((d1 * d2) + (d3 * d4) + (d5 * d6)) / (d2 + d4 + d6)
If Option1.Value = True Then Y = d1
If Option2.Value = True Then Y = d3
If Option3.Value = True Then Y = d5
If Option5.Value = True Then Y = d7
Y = 2000 - (Y * 2000 / My2)
Picture2.PSet (x, Y), QBColor(13)
If Option4.Value = True Then Y = ((e1 * e2) + (e3 * e4)) / (e2 + e4)
If Option2.Value = True Then Y = e1
If Option3.Value = True Then Y = e3
If Option5.Value = True Then Y = e5
Y = 2000 - (Y * 2000 / My2)
Picture2.PSet (x, Y), QBColor(9)
If Option4.Value = True Then Y = f1
If Option2.Value = True Then Y = f1
Y = 2000 - (Y * 2000 / My2)
Picture2.PSet (x, Y), QBColor(7)
If Option4.Value = True Then Y = b2 + b4 + b6
If Option1.Value = True Then Y = b2
If Option2.Value = True Then Y = b4
If Option3.Value = True Then Y = b6
If Option5.Value = True Then Y = b8
Y = 2000 - (Y * 2000 / My3)
Picture3.PSet (x, Y), QBColor(10)
If Option4.Value = True Then Y = c2 + c4 + c6
If Option1.Value = True Then Y = c2
If Option2.Value = True Then Y = c4
If Option3.Value = True Then Y = c6
If Option5.Value = True Then Y = c8
Y = 2000 - (Y * 2000 / My3)
Picture3.PSet (x, Y), QBColor(12)
If Option4.Value = True Then Y = d2 + d4 + d6
If Option1.Value = True Then Y = d2
If Option2.Value = True Then Y = d4
If Option3.Value = True Then Y = d6
If Option5.Value = True Then Y = d8
Y = 2000 - (Y * 2000 / My3)
Picture3.PSet (x, Y), QBColor(13)
If Option4.Value = True Then Y = e2 + e4
If Option2.Value = True Then Y = e2
If Option3.Value = True Then Y = e4
If Option5.Value = True Then Y = e6
Y = 2000 - (Y * 2000 / My3)
Picture3.PSet (x, Y), QBColor(9)
If Option4.Value = True Then Y = f2
If Option2.Value = True Then Y = f2
Y = 2000 - (Y * 2000 / My3)
Picture3.PSet (x, Y), QBColor(7)
Next t
Y = 200
For x = 100 To 500 Step 1
Picture4.PSet (x, Y), QBColor(10)
Next x
Y = 300
For x = 100 To 500 Step 1
Picture4.PSet (x, Y), QBColor(12)
Next x
Y = 400
For x = 100 To 500 Step 1
Picture4.PSet (x, Y), QBColor(13)
Next x
Y = 500
For x = 100 To 500 Step 1
Picture4.PSet (x, Y), QBColor(9)
Next x
Y = 600
For x = 100 To 500 Step 1
Picture4.PSet (x, Y), QBColor(7)
Next x
End Sub