Guidance
指路人
g.yi.org
software / rapidq / Examples / Algorithm & Maths / Atmosphere Model NRLMSISE / StdAtmosphere.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'------------------------------------------------------------------------------------------'
'    Atmosphere Model 11Sept04                                                             '
'    Based on the NRLMSISE Fortran Code                                                    '
'    By: puddlduk<<>>yahoo.com                                                             '
'          Rev2. (g/cm^3 was Kg/cm^3)                                                      '
'------------------------------------------------------------------------------------------'
'
'    1- Calls fortran dll from RapidQ to calculate atmosphere conditions.
'    2- Fortran Source code for model is at:
'        http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm
'    3- Fortran Source code was modified to remove driver and test run.
'    3- MinGw G77 fortran is used to compile the DLL: www.MinGw.org.
'    4- make.bat file to compile (adjust your paths as needed).
'          C:\msys\1.0\mingw\bin\g77 -c NRLMSISE.f
'          C:\msys\1.0\mingw\bin\dllwrap --driver-name g77 --export-all-symbols NRLMSISE.o -o NRLMSISE.dll
'          C:\msys\1.0\mingw\bin\strip --strip-all NRLMSISE.dll
'          del *.o
'
'
     $INCLUDE "RAPIDQ.INC"
     $TYPECHECK ON
     $OPTIMIZE ON
     DEFSTR output, space
     DEFSNG SEC,ALT,GLAT,GLONG,STL,F107A,F107,AP(9),D(9),T(2),TC
     DEFINT i,IYD,MASS

'for i = 1 to 9
'    D(i) = 100
'next i

     DIM m_D AS QMEMORYSTREAM
     DIM m_T AS QMEMORYSTREAM
     DIM m_AP AS QMEMORYSTREAM

     DECLARE SUB GTD7D LIB "NRLMSISE.dll" ALIAS "gtd7d_"  (byref IYD AS INTEGER, _
      byref SEC AS SINGLE, BYREF ALT AS SINGLE, BYREF GLAT AS SINGLE, BYREF GLONG AS SINGLE, _
      BYREF STL AS SINGLE, BYREF F107A AS SINGLE, BYREF F107 AS SINGLE, pointer AS LONG, _
      BYREF MASS AS INTEGER, POINTER AS LONG, POINTER AS LONG)

     DECLARE SUB ModelAtmosphere(Sender AS QBUTTON)

     CREATE Form AS QFORM
      CAPTION = "NRLMSISE Standard Atmosphere Model"
      Width = 500
      Height = 600
      Center
      CREATE Label1 AS QLABEL
       CAPTION = "DAY *"
       Left = 150
       Top = 20
       Transparent = 1
      END CREATE
      CREATE Label2 AS QLABEL
       CAPTION = "UT(SEC) *"
       Left = 150
       Top = 60
       Transparent = 1
      END CREATE
      CREATE Label3 AS QLABEL
       CAPTION = "ALTITUDE(KM) *"
       Left = 150
       Top = 100
       Transparent = 1
      END CREATE
      CREATE Label4 AS QLABEL
       CAPTION = "GEODETIC LATITUDE(DEG) *"
       Left = 150
       Top = 140
       Transparent = 1
      END CREATE
      CREATE Label5 AS QLABEL
       CAPTION = "GEODETIC LONGITUDE(DEG) *"
       Left = 150
       Top = 180
       Transparent = 1
      END CREATE
      CREATE Label6 AS QLABEL
       CAPTION = "LOCAL APPARENT SOLAR TIME(HRS) *"
       Left = 150
       Top = 220
       Transparent = 1
      END CREATE
      CREATE Label7 AS QLABEL
       CAPTION = "81 day AVERAGE OF F10.7 FLUX *"
       Left = 150
       Top = 260
       Transparent = 1
      END CREATE
      CREATE Label8 AS QLABEL
       CAPTION = "DAILY F10.7 FLUX FOR PREVIOUS DAY *"
       Left = 150
       Top = 300
       Transparent = 1
      END CREATE
      CREATE Label9 AS QLABEL
       CAPTION = "AP - MAGNETIC INDEX(DAILY) *"
       Left = 150
       Top = 340
       Transparent = 1
      END CREATE
      CREATE Label10 AS QLABEL
       CAPTION = "MASS - MASS NUMBER *"
       Left = 150
       Top = 380
       Transparent = 1
       visible = false
      END CREATE
      CREATE Edit1 AS QEDIT
       Text = "172"
       Left = 20
       Top = 15
      END CREATE
      CREATE Edit2 AS QEDIT
       Text = "29000"
       Left = 20
       Top = 55
       TabOrder = 9
      END CREATE
      CREATE Edit3 AS QEDIT
       Text = "1"
       Left = 20
       Top = 95
       TabOrder = 10
      END CREATE
      CREATE Edit4 AS QEDIT
       Text = "60"
       Left = 20
       Top = 135
       TabOrder = 11
      END CREATE
      CREATE Edit5 AS QEDIT
       Text = "120"
       Left = 20
       Top = 175
       TabOrder = 12
      END CREATE
      CREATE Edit6 AS QEDIT
       Text = "16"
       Left = 20
       Top = 215
       TabOrder = 13
      END CREATE
      CREATE Edit7 AS QEDIT
       Text = "150"
       Left = 20
       Top = 255
       TabOrder = 14
      END CREATE
      CREATE Edit8 AS QEDIT
       Text = "150"
       Left = 20
       Top = 295
       TabOrder = 15
      END CREATE
      CREATE Edit9 AS QEDIT
       Text = "4"
       Left = 20
       Top = 335
       TabOrder = 16
      END CREATE
      CREATE Edit10 AS QEDIT
       Text = "48"
       Left = 20
       Top = 375
       TabOrder = 17
       visible=false
      END CREATE
      CREATE Button1 AS QBUTTON
       CAPTION = "Model Atmosphere"
       Left = 20
       Top = 530
       Width = 450
       TabOrder = 18
       ONCLICK = ModelAtmosphere
      END CREATE
      CREATE RichEdit1 AS QRICHEDIT
       Left = 20
       Top = 400
       Width = 450
       Height = 120
       TabOrder = 19
       ScrollBars = 3
       AddStrings "*  See notes at:"
       AddStrings "   http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm"
       AddStrings ""
      END CREATE
     END CREATE

     Form.SHOWMODAL

     SUB ModelAtmosphere(Sender AS QBUTTON)

      IYD =  VAL(edit1.text)
      SEC =  VAL(edit2.text)
      ALT =  VAL(edit3.text)
      GLAT = VAL(edit4.text)
      GLONG= VAL(edit5.text)
      STL =  VAL(edit6.text)
      F107A= VAL(edit7.text)
      F107 = VAL(edit8.text)
    'AP = val(edit9.text)
      MASS = VAL(edit10.text)

      FOR i = 1 TO 7
       AP(i) = VAL(edit9.text)
      NEXT i

      m_AP.savearray(AP(1),UBOUND(AP))
      m_D.savearray(D(1),UBOUND(D))
      m_T.savearray(T(1),UBOUND(T))

      GTD7D(IYD,SEC,ALT,GLAT,GLONG,STL,F107A,F107,m_AP.pointer,MASS,m_D.pointer,m_T.pointer)

      m_D.position = 0
      m_D.loadarray(D(1),UBOUND(D))
      m_T.position = 0
      m_T.loadarray(T(1),UBOUND(T))

      space = "  "
      Richedit1.addstrings space
      output = STR$(D(6)) + "   mass density (g/cm^3)"
      Richedit1.addstrings output
      TC = T(2)-273
      output = STR$(TC) + "   Temperature (Deg C)"
      Richedit1.addstrings output
      RichEdit1.SelStart = LEN(RichEdit1.Text)           ' auto scrole
      SendMessage(RichEdit1.Handle, &HB7, 0, 0)

     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2023-1-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:42:02