Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21237

I want to get my Results as an array then Send them to an excel Sheet !!

$
0
0
Hi, I'm a Civil Engineer and I'm new to VB
I've this assingment that should be delivered after 9 hours :cry:

I should make an " Interaction Diagram " and that is some sort of a diagram between variabels ( x = Mu , y = Pu )

I ,thank god, made the VB form ... not the best of course :(


-- All That I Need is :
1- get the "200 points or less " from output as an Array ( Pu & Mu )
2- Create an EXCEL sheet of the results (( 200 points * 2 Columns ))
3- Draw a line to link between these Points & Shaw it in the VB "Picture Box"



this is the Form Code :

Code:

Private Sub Command1_Click()

'rem Input data
' b , t , cover , As1 , As2 , Fcu , Fy , Es
'===========================================

b = Val(txtbreadth.Text)
t = Val(txtdepth.Text)
cover = Val(txtCover.Text)
As1 = Val(txtAs1.Text)
As2 = Val(txtAs2.Text)
Fcu = Val(txtFcu.Text)
Fy = Val(txtFy.Text)
Es = Val(txtEs.Text)

'rem
'      Calculations
'===========================================

z = 200
GamaC = 1.75
GamaS = 1.35
c = t + z

For z = z To z = 0 Step -1
Do
  epsC = 0.002 * (t + z) / ((2 * t / 3) + z)
  eps1 = 0.002 * (z + cover) / ((2 * t / 3) + z)
  eps2 = 0.002 * (z + t - cover) / ((2 * t / 3) + z)
 
  Fs1 = eps1 * Es
  Fs2 = eps2 * Es
  If Fs1 >= Fy Then Fs1 = Fy
  If Fs2 >= Fy Then Fs1 = Fy
 
  c = t + z
  a = 0.8 * c
  If c > t Then c = t
 
  Pu = (0.67 * Fcu * b * a / GamaC) + (As1 * Fs1 / GamaS) + (As2 * Fs2 / GamaS)
  Mu = (0.67 * Fcu * b * a / GamaC) * (t / 2 - a / 2) - (As1 * Fs1 / GamaS) * (t / 2 - cover) + (As2 * Fs2 / GamaS) * (t / 2 - cover)
 
  e = Mu / Pu
  GamaC1 = 1.5 * (7 / 6 - e / t / 3)
  GamaS1 = 1.15 * (7 / 6 - e / t / 3)
  If GamaC1 <= 1.5 Then GamaC1 = 1.5
  If GamaS1 <= 1.15 Then GamaS1 = 1.15
 
  Error1 = Abs(GamaC - GamaC1) / GamaC
  Error2 = Abs(GamaS - GamaS1) / GamaS
  GamaC = GamaC1
  GamaS = GamaS1

Loop Until Error1 <= 0.01 And Error2 <= 0.01

Pu = (0.67 * Fcu * b * a / GamaC) + (As1 * Fs1 / GamaS) + (As2 * Fs2 / GamaS)
Mu = (0.67 * Fcu * b * a / GamaC) * (t / 2 - a / 2) - (As1 * Fs1 / GamaS) * (t / 2 - cover) + (As2 * Fs2 / GamaS) * (t / 2 - cover)

Next z

For z = 0 To z = t - cover Step -1
Do
  c = t - z
  a = 0.8 * c
  epsC = 0.003
  eps1 = 0.003 / c * (cover - t + c)
  eps2 = 0.003 / c * (c - cover)

  Fs1 = eps1 * Es
  Fs2 = eps2 * Es
  If Fs1 >= Fy Then Fs1 = Fy
  If Fs2 >= Fy Then Fs2 = Fy

  Pu = (0.67 * Fcu * b * a / GamaC) + (As1 * Fs1 / GamaS) + (As2 * Fs2 / GamaS)
  Mu = (0.67 * Fcu * b * a / GamaC) * (t / 2 - a / 2) - (As1 * Fs1 / GamaS) * (t / 2 - cover) + (As2 * Fs2 / GamaS) * (t / 2 - cover)

  e = Mu / Pu
  GamaC1 = 1.5 * (7 / 6 - e / t / 3)
  GamaS1 = 1.15 * (7 / 6 - e / t / 3)
  If GamaC1 <= 1.5 Then GamaC1 = 1.5
  If GamaS1 <= 1.15 Then GamaS1 = 1.15

  Error1 = Abs(GamaC - GamaC1) / GamaC
  Error2 = Abs(GamaS - GamaS1) / GamaS
  GamaC = GamaC1
  GamaS = GamaS1

 Loop Until Error1 <= 0.01 And Error2 <= 0.01

 Pu = (0.67 * Fcu * b * a / GamaC) + (As1 * Fs1 / GamaS) + (As2 * Fs2 / GamaS)
 Mu = (0.67 * Fcu * b * a / GamaC) * (t / 2 - a / 2) - (As1 * Fs1 / GamaS) * (t / 2 - cover) + (As2 * Fs2 / GamaS) * (t / 2 - cover)
Next z
       
    If z >= cover Then
For z = t - cover To z = cover Step -1
   
  Do
    c = z
    a = 0.8 * c
    epsC = 0.003
    eps1 = 0.003 / c * (t - c - cover)
    eps2 = 0.003 / c * (c - cover)

    Fs1 = eps1 * Es
    Fs2 = eps2 * Es
    If Fs1 >= Fy Then Fs1 = Fy
    If Fs2 >= Fy Then Fs1 = Fy

    Pu = (0.67 * Fcu * b * a / GamaC) - (As1 * Fs1 / GamaS) + (As2 * Fs2 / GamaS)
    Mu = (0.67 * Fcu * b * a / GamaC) * (t / 2 - a / 2) + (As1 * Fs1 / GamaS) * (t / 2 - cover) + (As2 * Fs2 / GamaS) * (t / 2 - cover)

    e = Mu / Pu
    GamaC1 = 1.5 * (7 / 6 - e / t / 3)
    GamaS1 = 1.15 * (7 / 6 - e / t / 3)
    If GamaC1 <= 1.5 Then GamaC1 = 1.5
    If GamaS1 <= 1.15 Then GamaS1 = 1.15

    Error1 = Abs(GamaC - GamaC1) / GamaC
    Error2 = Abs(GamaS - GamaS1) / GamaS
    GamaC = GamaC1
    GamaS = GamaS1

Loop Until Error1 <= 0.01 And Error2 <= 0.01

Pu = (0.67 * Fcu * b * a / GamaC) - (As1 * Fs1 / GamaS) + (As2 * Fs2 / GamaS)
Mu = (0.67 * Fcu * b * a / GamaC) * (t / 2 - a / 2) + (As1 * Fs1 / GamaS) * (t / 2 - cover) + (As2 * Fs2 / GamaS) * (t / 2 - cover)
   
Next z

End If
 

'rem ouput
'========================================



End Sub

Any help will be appreciated
thank you all in advance :)

Viewing all articles
Browse latest Browse all 21237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>