# File: strop.src
#
# Runs MDI structure program in different modes.
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/strop1.src"
descr "strop - Structure Program Demonstration"
#
display "strop.src"

#perf ldstr                        ## Load Tables/Lists/Queue
perf runstr1                       ## start MDI standard seq
tcblock mbdpflgs 16 0xffff 0      ## Clear IP Error count

tcb mbsqreg 65  1
tcb mbsqreg 53  5                 ## ALT Repeats (DEP Reg)
tcb mbipldin 0x140 1349  5        ## ALT Repeats (IP reg)
tcb mbsqreg 54  5                 ## ALT Cadence (60)
tcb mbsqreg 64  1                 ## Set New Prime Table Flag

open d

wait time 720

display "Magnetogram Campaign"
tcb mbsqreg 65 0
tcb mbsqreg 3  1
tcb mbsqreg 5  1
tcb mbsqreg 4  1
tcb mbsqreg 66 1

wait time 300
tcb mbsqreg 4  0              ## Cmpg Flag Off
tcb mbsqreg 5  0              ## High Rate D/L Flag Off
tcb mbsqreg 66 0              ## Real Cmpg Flag Off
wait time 120
    
display "Dynamics Mode: Downlinking magnetograms in 5k"
tcb mbsqreg 65 1              ## Enable ALT
tcb mbsqreg 3  1
tcb mbsqreg 5  0
wait time 840                ## Mag downlink in 5k (Dynamics Mode)

display "Structure Mode: Storing Magnetograms"
tcb mbsqreg 3 0               ## Store Magnetograms (Structure Mode)
tcb mbsqreg 5 0
wait time 2400              

display "Downlinking stored magnetograms"
tcb mbsqreg 3  1              ## Enable High Rate Channel
tcb mbipldin 0x140 1448 1     ## Request Stored Mag D/L
wait time 240

display "Downlinking magnetograms in 160k"
tcb mbsqreg 5  1              ## Mag D/L in 160k
wait time 1800

tcb mbsqreg 54  40            ## ALT Cadence (60)
tcb mbsqreg 64  1             ## Set New Prime Table Flag

for !LI0 = 1 to 4 
    display "Structure Mode: Storing Magnetograms"
    tcb mbsqreg 65 1
    tcb mbsqreg 3 0               ## Store Magnetograms (Structure Mode)
    tcb mbsqreg 5 0
    halt
#    wait time 11700               ## 3h 15 min

    display "Downlinking stored magnetograms"
    tcb mbsqreg 3  1              ## Enable High Rate Channel
    tcb mbipldin 0x140 1448 1     ## Request Stored Mag D/L
    halt
#    wait time 300

    display "Downlinking magnetograms in 160k"
    tcb mbsqreg 5  1              ## Mag D/L in 160k
    halt
#    wait time 4800                ## 1h 20m

    display "Dynamics Mode: Downlinking magnetograms in 5k"
    tcb mbsqreg 3  1
    tcb mbsqreg 5  0
    tcb mbsqreg 65 0
    halt
#    wait time  6000               ## 1h 40m

    display "Magnetogram Campaign"
    tcb mbsqreg 3  1
    tcb mbsqreg 5  1
    tcb mbsqreg 4  1
    tcb mbsqreg 66 1
    halt
#    wait time  1080               ## 0h 18m

    tcb mbsqreg 4  0              ## Cmpg Flag Off
    tcb mbsqreg 5  0              ## High Rate D/L Flag Off
    tcb mbsqreg 66 0              ## Real Cmpg Flag Off
    wait time 120                 ## 0h 02m
end for

tcb mbsqend
wait time 60
close d

tcb mbdpmod 1
return
