Previous Next        Current Page: NeXtMidas Training / Macros - Part 1 (Basics) / Procedures and Subroutines / Lab 1 - Macro Procedures / Instructions
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
   + Macro Basics   
   + Loops and Control Structures   
   - Procedures and Subroutines   
      - PROCEDURE   
      - SUBROUTINE   
      - CALL   
      - Lab 1 - Macro Procedures   
         - Instructions   
         - Solution   
      - Lab 2* - Macro Procedures   
         - Instructions   
         - Solution   
   + Pipes in a Macro   
   + Messages in a Macro   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 1 - Macro Procedures:
    • For this lab you will write a macro that will list the values in a state vector at given times through the day.
    • Three sample State Vector files are provided in the dat area of the SYS option tree (sv1.prm, sv2.prm, and sv3.prm).
    • A template for this macro is provided (be sure to save the file with the correct name):
    • The macro takes in four parameters:
        IN=     - The input file (no default value)
        START=  - The start time (default is 00:00:00)
        END=    - The end time   (default is 24:00:00)
        DELTA=  - The delta between entries in seconds (default is 3600).
      
      Use UPDATE to add this command to the dictionary.
    • Will need to do the following in the macro:
      • In the DO loop there is a place to call the printStateVector procedure. Add in the call to printStateVector. It should be called with the single parameter sv.
      • In the printStateVector procedure, fill in the section that formats the numbers for TIME, LON, LAT, and ALT. Here is an example of how to do it for the ALT value:
          invoke altStr altFormat.format(stateVector.alt)
        
        If you are unsure what parameters are in the stateVector do a RES stateVector in the printStateVector procedure, it will print out all the values you need.
    • Try running the macro. For example:
      nM> proclab1 sv3.prm 00:00:00 12:00:00 2:00:00
      00:00:00.000: 136'55'17.921W 017'42'53.010N  25152090m
      02:00:00.000: 128'19'14.927W 057'02'56.486N  20001890m
      04:00:00.000: 041'58'50.918W 030'10'07.824N  14310786m
      06:00:00.000: 020'13'14.114W 050'43'45.819S  16789154m
      08:00:00.000: 056'13'10.695E 052'01'49.926S  23076766m
      10:00:00.000: 055'28'49.007E 016'59'38.182S  26278971m
      12:00:00.000: 042'53'30.995E 018'19'05.710N  25097732m
      nM>