Hello,
I want to use this proc. as function under VB6, forget FunargIAU(), TWOPI,amodulo,A2R, and other Const... JulCity, J2000.
Then i need help to convert it to VB6 function, will be glad for assistance.
sub GetDpsiDeps(jed as double, dpsi as double, deps as double, _
dpsidot as double, depsdot as double) static
'----- Subprogram to compute dpsi, deps, dpsidot,
'----- and depsdot.
'----- Input: jed Julian day number on TDB scale
'----- Output: dpsi nutation in longitude
'----- deps nutation in obliquity
'----- dpsidot derivative of dpsi in
'----- radians/day
'----- depsdot derivative of deps in
'----- radians/day
'-------------------------------------------------------------------------
dim jedZ as double
dim NutTermsRead as integer
dim nc(min,2) as double
dim FunArg(min,1) as double
dim j as integer
dim k as integer
dim L as double
dim Ldot as double
dim lp as double
dim lpdot as double
dim f as double
dim fdot as double
dim d as double
dim ddot as double
dim n as double
dim ndot as double
dim LL as double
dim LLdot as double
dim t as double
dim c1 as double
dim c2 as double
dim c3 as double
dim c4 as double
dim c5 as double
dim lamp as double
dim oamp as double
dim ls as double
dim os as double
dim arg as double
dim argdot as double
'----- Read the coefficients from the data statements
'----- only if not already done.
if (NutTermsRead = 0) then
redim nc(1 to 106, 1 to 9)
redim FunArg(1 to 12)
restore Terms
for j = 1 to 106
for k = 1 to 9
read nc(j,k)
next k
next j
NutTermsRead = 1
end if
Re: convert a peace of code from powerbasic to VB6
VB6 doesn’t support these data statements, so you have to come with an alternative.
Also you have to check the other methods which are not supported by VB6
Re: convert a peace of code from powerbasic to VB6
You could dump the data in a csv and load the array from that data. I'll give it a go.
EDIT:
Just changed a couple things to make VB6 happy, everything else here is just copying the calcs you want into this:
Code:
Static Sub GetDpsiDeps(jed As Double, dpsi As Double, deps As Double, dpsidot As Double, depsdot As Double)
Dim jedZ As Double
Dim NutTermsRead As Integer
Dim nc() As Double
Dim FunArg(1, 1) As Double
Dim j As Integer
Dim k As Integer
Dim L As Double
Dim Ldot As Double
Dim lp As Double
Dim lpdot As Double
Dim f As Double
Dim fdot As Double
Dim d As Double
Dim ddot As Double
Dim n As Double
Dim ndot As Double
Dim LL As Double
Dim LLdot As Double
Dim t As Double
Dim c1 As Double
Dim c2 As Double
Dim c3 As Double
Dim c4 As Double
Dim c5 As Double
Dim lamp As Double
Dim oamp As Double
Dim ls As Double
Dim os As Double
Dim arg As Double
Dim argdot As Double
' open the text file that contains the data
Dim fs As FileSystemObject ' ******* need to reference Microsoft Scripting Runtime
Dim coefficientsFile As TextStream
Dim textFileData() As String
Set fs = New FileSystemObject
Set coefficientsFile = fs.OpenTextFile("C:\Temp\coefficients_for_IAU_1980_nutation_theory.csv", ForReading)
'----- Read the coefficients from the data statements
'----- only if not already done.
If (NutTermsRead = 0) Then
ReDim nc(1 To 106, 1 To 9) As Double
'ReDim FunArg(1 To 12) As Double
For j = 1 To 106
textFileData = Split(coefficientsFile.ReadLine, ",")
For k = 1 To 9
nc(j, k) = CDbl(textFileData(k - 1))
Next k
Next j
NutTermsRead = 1
End If
coefficientsFile.Close
Set coefficientsFile = Nothing
Set fs = Nothing
End Sub
copy this into a text file, name it and change the code to open it