You can create an ApiCompartment either by using detailed descriptions of an arbitrary number of tree layers, or by providing species data (see next topic) . A tree layer repsesents a group of tree of the same tree species. The layers are added to the InitialState property and the site data description variable to the SiteData property of the ApiCompartment. When a growth calculation is done, the results for the layers are store in the ProjectedStates property. See the Get results chapter for information how to get result data from different layers, are for summations over layers.
Step 1. Create an ApiCompartment
| Create an ApiCompartment object |
Copy Code |
|---|---|
var compartment = new ApiCompartment(meanAge:62.0, basalAreaHa:25.0, meanHeightAllSpecies:18.5, evenAgedClass:AgeType.EvenAged, soilMoistureCode:SoilMoistureType.Mesic, vegetationType:VegetationType.Bilberry, eastCoordinate:717400.0, northCoordinate:7165154.0, altitude:100.0, siSpecies:SpeciesGroupCode.Pine, siteIndex:24.0, projection:GISHelpers.GetSWEREFf99_Projection()); | |
Step 2. Add tree layers to the compartment
Unless bareland, create at least one tree layer data object (ApiTreeLayerData) for each species group. If there are several layers for a species, create one layer for each of them.
Then add the layers to the ApiCompartment via the method ApiCompartment.AddTreeLayer(layer) or ApiCompartment.AddTreeLayers(listOfLayers) . A specific layer is automatically added for new trees (ingrown trees) that are added by Heureka. This is handled automatically.
Example with one layer:
| Create a new layer |
Copy Code |
|---|---|
var pineLayer = new ApiTreeLayerData(layerNumber:1, speciesCode:SpeciesCode.PinusSylvestris, meanAge:40.0, meanDiameterDgv:15.0, meanDiameterDg:13.5, meanHeight:14.0, basalAreaPerHa:17.0, stemsPerHa:1200.0, volumePerHa:70.0, diameterDistributionClass:Distribution.Low, layerType:ApiLayerType.Trees); | |
Add the layer to the compartment:
| Add the layer to the compartment |
Copy Code |
|---|---|
compartment.AddTreeLayer(pineLayer); | |
You can now use the ApiCompartment object when using for example a growth calculator.