Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1198 werner 1
/**
2
* Access to properties of the current stand.
3
* The `stand` variable is available in the execution context of forest management and provides access to properties and functions
4
* of the stand that is currently processed.
5
*
6
* Note that the variable `stand` is provided through the C++ framework and does not need to be created separately.
7
*
8
* Use the 'flag' and 'setFlag' methods to (persistently) modify / read user-specific properties for each stand. This is a means
9
* to pass stand-specific information between activities (or between different events within one activity).
10
*
11
*
12
@class Stand
13
*/
14
var stand = {
15
/**
16
  If `trace` is set to true, detailed log information is produced by ABE. This is useful for testing/ debugging.
17
  The trace-mode can be switched on/ off like this:
18
 
19
        // enable trace for stand 7
20
        fmengine.standId = 7; // set the current stand to the stand with Id 7
21
        stand.trace = true; // enable trace
22
 
23
 
24
  See also: {{#crossLink "FMEngine/verbose:property"}}{{/crossLink}}
25
 
26
  @property trace
27
  @type boolean
28
  @default false
29
  */
30
 
31
/**
32
  The id of the stand that is currently processed.
33
 
34
  See also: {{#crossLink "FMEngine/standId:property"}}{{/crossLink}} in `fmengine`.
35
 
36
  @property id
37
  @type integer
38
  @default -1
39
*/
40
 
41
/**
42
  The basal area / ha stocking on the stand (living trees, >4m).
43
 
44
  @property basalArea
45
  @type double
46
*/
47
 
48
 
49
/**
50
  The total standing timber volume / ha of the stand (living trees, >4m).
51
 
52
  @property volume
53
  @type double
54
*/
55
 
56
/**
57
  The mean height of the stand (meter). It is calculated as basal area weighted mean height of all trees on the stand (>4m).
58
  See also {{#crossLink "Stand/topHeight:property"}}{{/crossLink}}.
59
 
60
  @property height
61
  @type double
62
*/
63
 
64
/**
65
  The top height (in meters) is defined as the mean height of the 100 thickest trees per ha. For larger/ smaller stands, the number of trees is scaled accordingly.
66
  See also {{#crossLink "Stand/height:property"}}{{/crossLink}}.
67
 
68
  @property topHeight
69
  @type double
70
*/
71
 
72
/**
73
  The mean age of the stand (years). It is calculated as basal area weighted mean age of all trees on the stand (>4m).
74
  Note the difference to `absoluteAge`, which is the number of years since the rotation started.
75
 
76
  See also {{#crossLink "Stand/absoluteAge:property"}}{{/crossLink}}.
77
 
78
  @property age
79
  @type double
80
*/
81
 
82
/**
83
    The age of the stand given in years since the rotation started. At startup, the `absoluteAge` is estimated from
84
    the `age` of the stand (i.e. the mean age of the initialized trees). Later, the stand age counter is reset
85
    by management activities. Note that this property is writable.
86
 
87
    See also {{#crossLink "Stand/age:property"}}{{/crossLink}}.
88
 
89
  @property absoluteAge
90
  @type double
91
*/
92
 
93
/**
94
  The number of different tree species present on the stand (trees >4m). Use to iterate over the available species on the stand:
95
 
96
        // print the species id and the basal area for each available species.
97
        // note that the species are ordered by the basal area share.
98
        for (var i=0;i<stand.nspecies;++i)
99
            log(stand.speciesId(i) + ": " + stand.basalArea(i));
100
 
101
  @property nspecies
102
  @type int
103
*/
104
 
105
/**
106
  The total area of the stand in hectares.
107
 
108
 
109
  @property area
110
  @type double
111
*/
112
/**
113
  Retrieve the species id at position `index`.
114
 
115
  @method speciesId
116
  @param {integer} index The index of the species (valid between 0 and `nspecies`-1).
117
  @return {string} The unique id of the species.*/
118
 
119
/**
120
  Retrieve the basal area of the species at position `index`.
121
 
122
  @method basalArea
123
  @param {integer} index The index of the species (valid between 0 and `nspecies`-1).
124
  @return {double} The basal area (m2/ha) of the species.*/
125
 
126
/**
127
  Retrieve the basal area of the species with the species code 'speciescode'.
128
  Note that only trees with height > 4m are included.
129
 
130
  @method basalAreaOf
131
  @param {string} speciescode The code of the species (e.g., 'piab').
132
  @return {double} The basal area (m2/ha) of the species, or 0 if the species is not present.*/
133
 
134
 /**
135
  Retrieve the relative basal area of the species 'speciescode'.
136
 
137
  @method relBasalAreaOf
138
  @param {string} speciescode The code of the species (e.g., 'piab').
139
  @return {double} The basal area (m2/ha) of the species, or 0 if the species is not present.*/
140
 
141
/**
142
*  Retrieve the basal area share (0..1) of the species at position `index`.
143
*
144
*      // get the share of the dominant species:
145
*      log( stand.relBasalArea(0) * 100 + "%");
146
*
147
*  @method basalAreaRel
148
*  @param {integer} index The index of the species (valid between 0 and `nspecies`-1).
149
*  @return {double} The basal area share (0..1) of the species.*/
150
 
151
/**
152
  Force a reload of the stand data, i.e. fetch stand statistics (e.g. basal area, age)
153
  from the trees comprising the stand.
154
 
155
  Usually, this is done automatically by ABE, however, it might be useful in some rare circumstances.
156
 
157
  @method reload
158
 
159
*/
160
 
161
/**
162
  The ´sleep´ method suspends the activities on the stand for `years` years. Only after the specified has elapsed,
163
  ABE continues to examine the stand.
164
 
165
  @method sleep
166
  @param {integer} years The number of years that the stand should sleep.
167
 
168
*/
169
 
170
/**
171
  Use `activity` to retrieve an {{#crossLink "Activity"}}{{/crossLink}} object.
172
 
173
  Note: the global variable `activity` is a "short-cut" to access the currently active activity.
174
 
175
        stand.activity("my_thinning_2").enabled = false; // disable an activity
176
        var act = stand.activity("my_thinning_1"); // save a reference to the activity for later use
177
 
178
  See also: the global variable `{{#crossLink "Activity"}}activity{{/crossLink}}`
179
 
180
  @method activity
181
  @param {string} activity_name The name of the activity to be retrieved. Activity names are provided during activity definition (see {{#crossLink "FMEngine/addManagement:method"}}fmengine.addManagement{{/crossLink}})
182
  @return {Activity} the Activity, or `undefined` if not found.
183
*/
184
 
185
/**
186
  Retrieves the stand-specific property associated with the name 'name' for the stand of the current execution context.
187
 
188
        stand.setFlag('test', 3); // simple values
189
        stand.setFlag('my_goal', { s1: 10, s2: 20, s3: function(){return this.s1+this.s2;} } ); // complex objects (including functions are allowed)
190
 
191
        fmengine.log( stand.flag('my_goal').s3 + stand.flag('test') + stand.U  ); // -> 133 (if U=100 of the stand)
192
 
193
@method flag
194
@param {string} name The (user-defined) property name of the stored parameter.
195
@return {value} The associated value for the given 'name'. Returns 'undefined' if no value is assigned.*/
196
 
197
/**
198
  Sets 'value' as the stand-specific property associated with the name 'name' for the stand of the current execution context.
199
 
200
 
201
  @method setFlag
202
  @param {string} name The (user-defined) property name of the stored parameter.
203
  @param {value} value The value that should be stored for 'name'. 'value' can be any valid Javascript expression (including objects).
204
*/
205
 
206
/**
207
  The number of years since the execution of the last activity for the current stand. Value is -1 if no activity was executed previously.
208
 
209
  @property elapsed
210
  @type int
211
*/
212
 
213
/**
214
  The name of the last previously executed activity, or an empty string if no activity was executed before. The name can be used to access
215
  properties of the activity.
216
 
217
 
218
           if (stand.lastActivity == "thinning1")
219
                stand.activity( stand.lastActivity ).enabled = true; // re-enable last activity if it was 'thinning1'
220
 
221
  @property lastActivity
222
  @type string
223
*/
224
 
225
/**
226
  The rotation length of the current stand. The rotation length is defined by the stand treatment programme that is currently assigned to a given
227
  stand. The 'U' is frequently used for timing activites relative to the length of the period.
228
 
229
  @property U
230
  @type double
231
*/
232
}
233
 
234
 
235