This isn't a good place to ask for programming advice for languages other
than vba or sql, the languages used by Microsoft Access databases.
My definition of a "good place to ask for programming advice" is where
I can get correct answers to honest questions. And thank you for your
reply!
BTW, the port is to VBA (Access), so, the C folks don't think Access
questions belong in C forums and the VBA folks don't think C questions
belong in Access forums. For future reference and for those who are
upset by my "improper" posting, where should I post these type of
questions?
Thanks, Chris & Dirk
Curbie
Option Compare Database
Option Explicit
Public Function transpoa(poa As Single, dn As Single, inc As Single)
As Single
' Calculates the irradiance transmitted thru a PV module cover.
' Uses King polynomial coefficients for glass from 2nd World
Conference Paper, July 6-10, 1998. Bill Marion 12/8/1998
Static b0 As Single ' polynomial coefficient
b0 (ASE300-init loads 1#)
Static b1 As Single ' polynomial coefficient
b1 (ASE300-init loads -0.002438)
Static b2 As Single ' polynomial coefficient
b2 (ASE300-init loads 0.0003103)
Static b3 As Single ' polynomial coefficient
b3 (ASE300-init loads -0.00001246)
Static b4 As Single ' polynomial coefficient
b4 (ASE300-init loads 0.0000002112)
Static b5 As Single ' polynomial coefficient
b5 (ASE300-init loads -0.000000001359)
Static DTOR As Single ' degress to radians
init loads 0.017453293
Static Init As Boolean ' function initalization
flag
Dim x As Single '
If Not Init Then GoSub Init ' if function variables
NOT initalized, do it
inc = inc / DTOR ' convert in incident
angle to degrees
If (inc > 50# And inc < 90#) Then ' if incident angle
between 50 and 90 degrees
x = b0 + b1 * inc
x = x + b2 * inc * inc
x = x + b3 * inc * inc * inc
x = x + b4 * inc * inc * inc * inc
x = x + b5 * inc * inc * inc * inc * inc
poa = poa - (1# - x) * dn * Cos(inc * DTOR) ' Adjust for relection
between 50 and 90 degrees
If (poa < 0#) Then poa = 0# '
End If ' if incident angle
between 50 and 90 degrees
transpoa = poa ' return irradiance
transmitted thru a PV module cover
Exit Function ' all done
Init: ' initalize function
variables
b0 = 1# ' initalize variable
b1 = -0.002438 ' initalize variable
b2 = 0.0003103 ' initalize variable
b3 = -0.00001246 ' initalize variable
b4 = 0.0000002112 ' initalize variable
b5 = -0.000000001359 ' initalize variable
DTOR = 0.017453293 ' initalize variable
Init = True ' function variables
initalized, we don't need to do it again
Return ' back to caller
End Function