|
##### How to run this macro ##################
# (1) Save this file in its entirety as a text file with a name such as
"rootstock1.txt"
# under the root directory of a computer (C:\) or any other directory.
#
# (2) To run this macro Within MINITAB, first make sure the user has
opened a new project
# (a blank MINITAB project). Then, type: %'C:\rootstock1.txt' on the
Session window
# and hit ENTER. The simulation results will be displayed in the global
worksheet.
#
# "C1", "C2",..., and "C10" store the simulated total below-ground plant
biomass (lb acre-1)
# corresponding to a duration of viability of 1 yr, 2 yr,..., 10 yr,
respectively,
# for the second part of the coarse roots. For each column of data, "Row
1", "Row 2",...,
# and "Row 10" represents the simulated biomass with a duration of
viability for rhzomes
# as 1 yr, 2 yr,..., 10 yr, respectively.
gmacro
rootstock1
########################################################
# This MINITAB global macro simulates the accumulation of
below-ground plant biomass
# for heavily grazed pastures (6.9 AUM ha-1) at CGREC.
#########################################################
# It takes into consideration
# the annual growth and decomposition of the three categories of
below-ground plant
# biomass: namely, fine roots, coarse rotos, and rhizomes.
# To simplify the simulation, a time step of 1 year is used for all
variables. That means
# both the growth and decomposition are assumed to occur at a 1-year time
step. The
# decomposition of fine roots starts 1 year after their production. Half
of the coarse roots
# starts to decompose after 1 year, while the another half starts to
decompose at
# variable times, ranging from 1 year to 10 years. If the coarse roots
starts to decompose
# after 1 year, we say that their "duration of viability" is 1 year. A
duration of viability
# of 10 years might not be true in reality, but we use this time just for
sumulation purpose.
# For now we don't have concrete data of the true duration of viability
for plant roots
# on pastures of this part of the Norhern Great Plains.
# Data for decay constant and initial biomass growth are based on field
measurement in 2006
# on heavily grazed pastures.
##########################################################
# To understand this MINITAB macro, one needs to know how the variables
are indexed
# in MINITAB:
# (1) In a "global" macro (where the MINITAB global worksheet is used for
storing variables),
# All constants are stored in MINITAB's global constants, such as k1, k2,
k3,..., k100,....
# That is a "k" followed (without space) by an integer.
# (2) An array of data can be stored either in a matrix or in a "column
variable",
# which is written as c1, c2, c3,..., c100,..., in MINITAB. Actually, for
this global macro,
# "c1" refers the first column of the global worksheet, and "c2" the
second column of the
# global worksheet, and so forth.
#
# The syntax of "c1(k1)" is a special way MINITAB uses to index a
particular element of an array:
# here, specifically, it refers to the k1th element of the array c1. If,
for example, k1=1,
# then it refers the first element of array c1. This type of "C-K
language" provides flexiblity
# for the macros to carry out computations based on the data stored in the
current worksheet.
#
# MINITAB also has "local macros", which are closer to some general
purpose programming languages.
# The local macros use local worksheet, which are unseen to the user but
resides on part of
# the computer memorry allocated to MINITAB.
# Local macros are more powerful and good for more complex simulations.
# However, We choose to use the global macro format for this simulation,
because the
# computation work is simple here.
let k100=7111 # initial stock of fine roots (FR) (lb acre-1)
let k101=1 # duration of viability for FR (yr)
let k102=0.8 # decay constant for FR
call accumulate
copy k51 k200 # 50 yr accumulated biomass for FR
let k100=571 # initial stock for the first part of coarse roots (CR) (lb
acre-1)
let k101=1 # duration of viability for the first part of CR (yr)
let k102=0.45 # decay constant for CR
call accumulate
copy k51 k201 # 50 yr accumulated biomass for the first part of CR
set c105
0
end
let k40=count(c105)+1 #
do k101 = 1:10 # a variable duration of viability is used for the second
part of CR (yr)
let k100=571 # initial stock for the second part of CR (lb acre-1)
let k102=0.45 # decay constant for CR
call accumulate
let c105(k40)=k51 # 50 yr accumulated biomass for second part of CR with
durations of 1-10 years
let k40=k40+1
enddo
copy c105 c105;
use 2:11.
name c105 'CR2_accum'
set c106
0
end
let k40=count(c106)+1 #
do k101 = 1:10 # duration of viability for rhizomes (RH) (yr)
let k100=703 # initial stock of RH (lb acre-1)
let k102=0.64 # decay constant for RH
call accumulate
let c106(k40)=k51 # 50 yr accumulated biomass for RH for durations of
viability of 1-10 years
let k40=k40+1
enddo
copy c106 c106;
use 2:11.
name c106 'RH_accum'
let k202=k200+k201 # the sum of 50 yr's accumulation of RH and the second
part of CR
do k20 = 1:10 # "k20" represents the second part of CR (c105)
do k21 = 1:10 # "k21" represents the RH (c106)
let ck20(k21)=k202+c105(k20)+c106(k21)
enddo
enddo
endmacro
gmacro
accumulate
set c100
1:49
end
let c101=k100*exp(-k102*c100)
set c1
k101(k100)
end
stack c1 c101 c1
copy c1 c1;
use 1:50.
do k50 = 2:50
let k49=k50-1
set ck50
k49(0)
end
stack ck50 c1 ck50
copy ck50 ck50;
use 1:50.
enddo
let k51=0
do k50 = 1:50
let k51=k51+ck50(50)
enddo
erase c1-c100
endmacro |