Handling of tree states
Jump to navigation
Jump to search
Tree States
Each tree may have one of the following states:
- Tree
- Establised tree
- IngrownTree
- A tree that just has been ingrown.
- Sapling
- Sapling
- WatingTree
- Tree waiting to be activated. This means that the future state of the tree has been calculated, and growth for the tree should not be calculated in growth prognosis. Waiting trees might be felled.
- WaitingSapling
- Sapling waiting to be activated. This is similar to waiting trees. However, waiting saplings cannot be cleaned.
- RemovedTree
- Tree that is dead
- InvalidTree
- Tree that is invalid. A tree can be removed if it is invalid in the current period.
Each Tree has a state before treatment, TreeCategory, and after treatment, TreeCategoryResidual.
Sorting Trees
The TreeCollection class keeps trees sorted in the current period. This makes it easy and fast to iterate over trees with a certain state, since all those trees are kept together.
Adding new Trees
Both the ingrowth model and the regeneration models creates and adds new Trees to a PredictionUnit.
Say that the regeneration model runs in period 2, and the saplings are to be activated in period 4. A Tree object would then have the following states for each period (before and after treatment, Residual State is state after treatment):
Period | 0 | 1 | 2 | 3 | 4 | 5 |
State | Invalid | Invalid | Invalid | Waiting Sapling | Waiting Sapling | Sapling |
Residual State | Invalid | Invalid | Waiting Sapling | Waiting Sapling | Sapling | Sapling |
This means that:
- If current period of the TreatmentUnit is changed back to period 0, 1, or 2 the Tree object will be removed, since its state is invalid.
- If current period is 3 or 4, growth of the Tree shall not be calculated, since the state WaitingSapling indicates that the Tree already has a calculated future state.
- If current period is 5, growth of the Tree shall be calculated, using height growth model for saplings. The Tree may also be cleaned since it represents a sapling.