Stand Class
ABE\abe_stand.js:1
Access to properties of the current stand.
The stand
variable is available in the execution context of forest management and provides access to properties and functions
of the stand that is currently processed.
Note that the variable stand
is provided through the C++ framework and does not need to be created separately.
Use the 'flag' and 'setFlag' methods to (persistently) modify / read user-specific properties for each stand. This is a means to pass stand-specific information between activities (or between different events within one activity).
Item Index
Methods
Methods
activityByName
-
activity_name
Use activityByName
to retrieve an Activity object.
stand.activity("my_thinning_2").enabled = false; // disable an activity
var act = stand.activity("my_thinning_1"); // save a reference to the activity for later use
See also: the variable activity
Parameters:
-
activity_name
StringThe name of the activity to be retrieved. Activity names are provided during activity definition (see fmengine.addManagement)
Returns:
the Activity, or undefined
if not found.
flag
-
name
Retrieves the stand-specific property associated with the name 'name' for the stand of the current execution context.
stand.setFlag('test', 3); // simple values
stand.setFlag('my_goal', { s1: 10, s2: 20, s3: function(){return this.s1+this.s2;} } ); // complex objects (including functions are allowed)
fmengine.log( stand.flag('my_goal').s3 + stand.flag('test') + stand.U ); // -> 133 (if U=100 of the stand)
Parameters:
-
name
StringThe (user-defined) property name of the stored parameter.
reload
()
Force a reload of the stand data, i.e. fetch stand statistics (e.g. basal area, age) from the trees comprising the stand.
Usually, this is done automatically by ABE, however, it might be useful in some rare circumstances.
relSpeciesBasalArea
-
index
Retrieve the basal area share (0..1) of the species at position index
.
// get the share of the dominant species:
log( stand.relSpeciesBasalArea(0) * 100 + "%");
Parameters:
-
index
IntegerThe index of the species (valid between 0 and
nspecies
-1).
relSpeciesBasalAreaOf
-
speciescode
Retrieve the relative basal area of the species 'speciescode'.
Parameters:
-
speciescode
StringThe code of the species (e.g., 'piab').
setFlag
-
name
-
value
Sets 'value' as the stand-specific property associated with the name 'name' for the stand of the current execution context.
Parameters:
-
name
StringThe (user-defined) property name of the stored parameter.
-
value
ValueThe value that should be stored for 'name'. 'value' can be any valid Javascript expression (including objects).
setSTP
-
stp_name
Sets a new STP for a stand. This can be used to "switch" from one STP to another STP.
Use updateSTP()
from fmengine
to change/update an already existing STP.
See also updateManagement.
// get the share of the dominant species:
console.log(stand.stp.name); // e.g. 'BAU'
fmengine.addManagement( { ... }, 'femel');
fmengine.standId=1; // explicitly set to stand with ID = 1
stand.setSTP('femel');
Parameters:
-
stp_name
StringThe name of the STP to set for the stand
sleep
-
years
The ´sleep´ method suspends the activities on the stand for years
years. Only after the specified has elapsed,
ABE continues to examine the stand.
Parameters:
-
years
IntegerThe number of years that the stand should sleep.
speciesBasalArea
-
index
Retrieve the basal area of the species at position index
.
Parameters:
-
index
IntegerThe index of the species (valid between 0 and
nspecies
-1).
speciesBasalAreaOf
-
speciescode
Retrieve the basal area of the species with the species code 'speciescode'. Note that only trees with height > 4m are included.
Parameters:
-
speciescode
StringThe code of the species (e.g., 'piab').
speciesId
-
index
Retrieve the species id at position index
.
Parameters:
-
index
IntegerThe index of the species (valid between 0 and
nspecies
-1).
wakeup
()
The ´wakeup´ method wakes up a stand again that was set to sleep
earlier. The sleeping
phase in canceled, and the stand is re-evaluated in the next year.
Properties
absoluteAge
Double
The age of the stand given in years since the rotation started. At startup, the absoluteAge
is estimated from
the age
of the stand (i.e. the mean age of the initialized trees). Later, the stand age counter is reset
by management activities. Note that this property is writable.
See also age.
activity
Activity
The Activity
object linked to the current stand.
See also: Activity
Default: undefined
age
Double
The mean age of the stand (years). It is calculated as basal area weighted mean age of all trees on the stand (>4m).
Note the difference to absoluteAge
, which is the number of years since the rotation started.
See also absoluteAge.
area
Double
The total area of the stand in hectares.
basalArea
Double
The basal area / ha stocking on the stand (living trees, >4m).
dbh
Double
The mean DBH in cm. It is calculated as basal area weighted mean DBH of all trees on the stand (>4m). See also basalArea.
elapsed
Int
The number of years since the execution of the last activity for the current stand. Value is -1 if no activity was executed previously.
height
Double
The mean height of the stand (meter). It is calculated as basal area weighted mean height of all trees on the stand (>4m). See also topHeight.
id
Integer
The id of the stand that is currently processed.
See also: standId in fmengine
.
Default: -1
lastActivity
String
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 properties of the activity.
if (stand.lastActivity == "thinning1")
stand.activity( stand.lastActivity ).enabled = true; // re-enable last activity if it was 'thinning1'
nspecies
Int
The number of different tree species present on the stand (trees >4m). Use to iterate over the available species on the stand:
// print the species id and the basal area for each available species.
// note that the species are ordered by the basal area share.
for (var i=0;i<stand.nspecies;++i)
log(stand.speciesId(i) + ": " + stand.speciesBasalArea(i));
stp
STP
The STP
object linked to the current stand, i.e. the stand treatment program currently active for the stand.
Default: undefined
topHeight
Double
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. See also height.
trace
Boolean
If trace
is set to true, detailed log information is produced by ABE. This is useful for testing/ debugging.
The trace-mode can be switched on/ off like this:
// enable trace for stand 7
fmengine.standId = 7; // set the current stand to the stand with Id 7
stand.trace = true; // enable trace
See also: verbose
Default: false
trees
TreeList
The TreeList
object (i.e., the list of trees on the stand), linked to the current stand.
See also: TreeList
Default: undefined
U
Double
The rotation length of the current stand. The rotation length is defined by the stand treatment programme that is currently assigned to a given stand. The 'U' is frequently used for timing activites relative to the length of the period.
unit
Unit
The Unit
object linked to the current stand.
Default: undefined
volume
Double
The total standing timber volume / ha of the stand (living trees, >4m).