I´ve made a code on visual basic for a wind calc. but can't run a random value, as the results are not random. I´ve run it twice just to check if values are random but not at all. Lot of time working on this code and need some help pls
Please see my code below (if you spot others mistakes, please let me know, much appreciate)
For j = 1 To n_p
ti = 0
For i = 0 To n_t
ti = delta_t * i
Sum2 = 0
For m = 1 To j
Sum1 = 0
For l = 1 To n_f
w_lm = (l - 1 + m / n_p) * delta_w
C = Exp(-lbd * w_lm * delta_L / (2 * Pi * U_m))
If j < m Then
G = 0
ElseIf m = 1 Then
G = C ^ Abs(j - m)
ElseIf m <= j And m >= 2 Then
G = C ^ Abs(j - m) * Sqr(1 - C ^ 2)
End If
fu = L_u * w_lm / (2 * Pi * U_m)
S = 4 * fu * S_v ^ 2 / (w_lm * (1 + 70.8 * fu ^ 2) ^ (5 / 6))
fi = Rnd() * 2 * Pi
Sum1 = Sum1 + Sqr(S) * G * Cos(w_lm * ti + fi)
Next l
Sum2 = Sum2 + Sum1
Next m
Vi = Sqr(2 * delta_w) * Sum2
Aucun commentaire:
Enregistrer un commentaire