protected override void LogYear(Model model, SqliteCommand insertRow)
        {
            foreach (MutableTuple <Trees, List <MortalityCause> > removedTreesOfSpecies in this.removedTreesByResourceUnit.Values)
            {
                Trees trees = removedTreesOfSpecies.Item1;
                for (int treeIndex = 0; treeIndex < trees.Count; ++treeIndex)
                {
                    insertRow.Parameters[0].Value  = model.CurrentYear;
                    insertRow.Parameters[1].Value  = trees.RU.ResourceUnitGridIndex;
                    insertRow.Parameters[2].Value  = trees.RU.EnvironmentID;
                    insertRow.Parameters[3].Value  = trees.Species.ID;
                    insertRow.Parameters[4].Value  = trees.Tag[treeIndex];
                    insertRow.Parameters[5].Value  = (int)removedTreesOfSpecies.Item2[treeIndex];
                    insertRow.Parameters[6].Value  = trees.GetCellCenterPoint(treeIndex).X;
                    insertRow.Parameters[7].Value  = trees.GetCellCenterPoint(treeIndex).Y;
                    insertRow.Parameters[8].Value  = trees.Dbh[treeIndex];
                    insertRow.Parameters[9].Value  = trees.Height[treeIndex];
                    insertRow.Parameters[10].Value = trees.GetBasalArea(treeIndex);
                    insertRow.Parameters[11].Value = trees.GetStemVolume(treeIndex);
                    insertRow.Parameters[12].Value = trees.LeafArea[treeIndex];
                    insertRow.Parameters[13].Value = trees.FoliageMass[treeIndex];
                    insertRow.Parameters[14].Value = trees.StemMass[treeIndex];
                    insertRow.Parameters[15].Value = trees.FineRootMass[treeIndex];
                    insertRow.Parameters[16].Value = trees.CoarseRootMass[treeIndex];
                    insertRow.Parameters[17].Value = trees.LightResourceIndex[treeIndex];
                    insertRow.Parameters[18].Value = trees.LightResponse[treeIndex];
                    insertRow.Parameters[19].Value = trees.StressIndex[treeIndex];
                    insertRow.Parameters[20].Value = trees.NppReserve[treeIndex];
                    insertRow.ExecuteNonQuery();
                }
            }

            this.removedTreesByResourceUnit.Clear();
        }
Beispiel #2
0
        protected override void LogYear(Model model, SqliteCommand insertRow)
        {
            AllTreesEnumerator allTreeEnumerator = new(model.Landscape);
            //using DebugTimer dt = model.DebugTimers.Create("TreeOutput.LogYear()");
            TreeWrapper treeWrapper = new(model);

            this.mTreeFilter.Wrapper = treeWrapper;
            while (allTreeEnumerator.MoveNext())
            {
                Trees treesOfSpecies = allTreeEnumerator.CurrentTrees;
                int   treeIndex      = allTreeEnumerator.CurrentTreeIndex;
                if (this.mTreeFilter.IsEmpty == false)
                {
                    // nothing to log if tree is excluded by filter
                    treeWrapper.Trees     = treesOfSpecies;
                    treeWrapper.TreeIndex = treeIndex;
                    if (this.mTreeFilter.Execute() == 0.0)
                    {
                        continue;
                    }
                }

                insertRow.Parameters[0].Value  = model.CurrentYear;
                insertRow.Parameters[1].Value  = treesOfSpecies.RU.ResourceUnitGridIndex;
                insertRow.Parameters[2].Value  = treesOfSpecies.RU.EnvironmentID;
                insertRow.Parameters[3].Value  = treesOfSpecies.Species.ID;
                insertRow.Parameters[4].Value  = treesOfSpecies.Tag[treeIndex];
                insertRow.Parameters[5].Value  = treesOfSpecies.GetCellCenterPoint(treeIndex).X;
                insertRow.Parameters[6].Value  = treesOfSpecies.GetCellCenterPoint(treeIndex).Y;
                insertRow.Parameters[7].Value  = treesOfSpecies.Dbh[treeIndex];
                insertRow.Parameters[8].Value  = treesOfSpecies.Height[treeIndex];
                insertRow.Parameters[9].Value  = treesOfSpecies.GetBasalArea(treeIndex);
                insertRow.Parameters[10].Value = treesOfSpecies.GetStemVolume(treeIndex);
                insertRow.Parameters[11].Value = treesOfSpecies.LeafArea[treeIndex];
                insertRow.Parameters[12].Value = treesOfSpecies.FoliageMass[treeIndex];
                insertRow.Parameters[13].Value = treesOfSpecies.StemMass[treeIndex];
                insertRow.Parameters[14].Value = treesOfSpecies.FineRootMass[treeIndex];
                insertRow.Parameters[15].Value = treesOfSpecies.CoarseRootMass[treeIndex];
                insertRow.Parameters[16].Value = treesOfSpecies.LightResourceIndex[treeIndex];
                insertRow.Parameters[17].Value = treesOfSpecies.LightResponse[treeIndex];
                insertRow.Parameters[18].Value = treesOfSpecies.StressIndex[treeIndex];
                insertRow.Parameters[19].Value = treesOfSpecies.NppReserve[treeIndex];
                insertRow.ExecuteNonQuery();
            }
        }