V2 logging

Download Model
Download the .scn, .sel and .lse files by clicking on the following link:

Model Code Exploration
In the following sections we will examine all of the model files for this model. Note that instead of downloading the zip file above, you could just copy the text in the boxes below into a text editor and save it with the appropriate name (Section title). Opening the resulting .scn file in the SELES simulator would run this model.

BaseScenario.scn
SELES Scenario $gisData$ = ..\gisData\cell Ecoregion = $gisData$\ecoregion Elevation = $gisData$\elevation Aspect = $gisData$\aspect ForestStatus = $gisData$\ForestStatus initialAge = $gisData$\StandAgeEst initialSpp = $gisData$\DomSpecies Model Dimensions: Ecoregion Model.sel SimPriority Low Priority // Set low priority for simulation engine // Set up display Minimize Static Minimize Initial State Tile // Move to output folder cwd output // Base Time step (in years) BaseTimestep = 10 // Make it spatial: 10-100ha blocks BlockSizeMin = 10 BlockSizeMax = 100 // No explicit adjacency GreenupYears = 0

Model.sel
Seles Model Time Units: Year Century 100 260 Landscape Events: // Disturbance event Fire.lse DEBUG // Succession events Succession.lse DEBUG // Management events Logging.lse DEBUG // Reporting events ReportResults.lse DEBUG // Legends: defined constants Legends: ////////////////////////////////////////  ForestStatusLegend = "..\gisData\cats\ForestStatus" // For succession SppLegend = "..\gisData\cats\DomSpecies" Global Constants: ///////////////////////////////////////////////////////////////  // General constants and parameters CellWidth = CELL WIDTH(Ecoregion) HaPerCell = (CellWidth^2) / 10000 MaxStandAge = MAX(initialAge) MaxTimeSinceDisturbance = 200 NumSppCodes = ROWS(SppLegend) - 1 // Need to link spatial constants with an input raster view Spatial Constants: StudyArea = Ecoregion ///////////////////////////  // Landscape physiography ///////////////////////////  Elevation Aspect ///////////////////////////  // Management information (static) ///////////////////////////  ForestStatus // Need to link spatial variables with an output raster view, and // specify initial conditions (raster, 0, or constant) and output raster bounds Spatial Variables: ///////////////////////////////////////////////////////////////  // Dynamic stand information StandAge[MaxStandAge] <= initialAge Spp[NumSppCodes] <= initialSpp OldForest[1] ///////////////////////////////////////////////////////////////  // Time since disturbance information Burnt[MaxTimeSinceDisturbance] Logged[MaxTimeSinceDisturbance] Global Variables: ///////////////////////////////////////////////////////////////  // Parameters BaseTimestep = 1 // Base Time step (in years) ///////////////////////////  // Fire related parameters ///////////////////////////  ReturnInterval = 50 MeanFiresPerYear = 1 ///////////////////////////  // Logging related parameters ///////////////////////////  HarvestRotation = 100 MinHarvestAge = 100 // Adjacency GreenupYears = 0 //Default: 0 no explicit adj.   BlockSizeMin = 5 BlockSizeMax = 40 ///////////////////////////////////////////////////////////////  // Tracking Year = 0 ForestSize = 0 THLBSize = 0 AreaBurned = 0    // Area burned in period AreaHarvested = 0 // Area (ha) harvested in period Output Frequency: 1

Fire.lse
// Empirical fire model for the Labrador District 19a "study copy" LSEVENT: Fire DEFINITIONS GLOBAL CONSTANT: HaPerCell, MaxTimeSinceDisturbance GLOBAL VARIABLE: BaseTimestep // Base Time step (in years) GLOBAL VARIABLE: ReturnInterval, MeanFiresPerYear // fire return interval LAYER: StudyArea, StandAge, Spp LAYER: Elevation, Aspect    // elevation in metres; aspect 0 to 360 + flat (361) LAYER: Burnt  // Show areas that were recently burned GLOBAL VARIABLE: ForestSize, AreaBurned CLUSTER VARIABLE: FireExtent ENDDEF // Run after succession RETURNTIME RETURNTIME = IF Time EQ 0 THEN 0.5 ELSE BaseTimestep // Update time since disturbance information // Need to do this here, since Burnt may include non-forested cells OVER REGION WHOLE MAP DECISION Burnt > 0 Burnt = MAX(0,Burnt - BaseTimestep) ENDFN AreaBurned = 0 ENDRT // Only allow ignitions in forested cells EVENTLOCATION STATIC REGION WHOLE MAP DECISION (StudyArea > 0) AND (Spp > 0) ENDEL // Draw the number of openings from an exponential distribution NUMCLUSTERS meanClusters = MeanFiresPerYear * BaseTimestep nClusters = FLOOR(NEGEXP(meanClusters)) NUMCLUSTERS = nClusters ENDNC PROBINIT // Depends on aspect pAspect = 0.35*0.5*(SIN((Aspect-67.5))+1) PROBINIT = pAspect // For each opening, select an opening size meanExtent = (ForestSize/(MeanFiresPerYear*ReturnInterval)) FireExtent = ROUND(NEGEXP(meanExtent)) ENDPI TRANSITIONS // Continue if there is still extent to be burned // AND if the stand didn't burn during this event already TRANSITIONS = (FireExtent > 0) AND (Burnt < MaxTimeSinceDisturbance) IF Spp > 0 // Decrement the number of cells remaining to burn for this opening // Only do this for forested cells. NonForested cells will just pass on the fire FireExtent = FireExtent - HaPerCell AreaBurned = AreaBurned + HaPerCell ENDFN // Set the stand age StandAge = 0 Burnt = MaxTimeSinceDisturbance ENDTR // Spread timestep: time is irrelevant for this empirical model. SPREADTIMESTEP = 0 // Spread to the eight neighbours SPREADLOCATION REGION CENTRED(1, 1.5) DECISION (StudyArea > 0) ENDSL // Pick number of spread openings to be based on the // convolution index, but force at least one NUMRECIPIENTS // Mid-Complex shapes. This is the number of neighbours to // spread to from a burning cell. Lower mean gives more complex shapes. NUMRECIPIENTS = CLAMP(NORMAL(2,1), 1, 8) ENDNR // Prefer southwest aspects and uphill SPREADPROB pElevation = IF (SOURCE Elevation) < Elevation THEN 5 ELSE IF (SOURCE Elevation) > Elevation THEN 0.5 ELSE 1 pAspect = 0.35*0.5*(SIN((Aspect-67.5))+1) SPREADPROB = (pElevation^0.5) * (pAspect^0.5) ENDSP

Logging.lse
// Landscape event definition for logging in the Labrador District 19a "study copy" // It is driven by the input variable HarvestRotation, which specifies the area // to cut per year. Enough cutblocks are laid down to cut the required area LSEVENT: LOGGING DEFINITIONS GLOBAL CONSTANT: HaPerCell /****************************************/  // Parameters GLOBAL VARIABLE: BaseTimestep    // Base Time step (in years) GLOBAL VARIABLE: HarvestRotation, MinHarvestAge // Length of time for greenup constraints (default: 15 years) GLOBAL VARIABLE: GreenupYears GLOBAL VARIABLE: BlockSizeMin, BlockSizeMax /****************************************/  LAYER: StudyArea, StandAge LAYER: ForestStatus GLOBAL CONSTANT: Harvestable LAYER: Logged // Time since logging is MaxTimeSinceDisturbance - Logged GLOBAL CONSTANT: MaxTimeSinceDisturbance GLOBAL VARIABLE: THLBSize EVENT VARIABLE: EventExtent, HarvestTarget CLUSTER VARIABLE: BlockExtent // Area cut in year GLOBAL VARIABLE: AreaHarvested GLOBAL VARIABLE: Year ENDDEF // Process after fire RETURNTIME RETURNTIME = IF Time EQ 0 THEN 0.9 ELSE BaseTimestep Year = FLOOR(Time) // Reset annual harvest stats AreaHarvested = 0 ENDRT // Only log in forested cells in the harvestable landbase EVENTLOCATION STATIC REGION WHOLE MAP DECISION ForestStatus EQ Harvestable ENDEL NUMCLUSTERS // Determine harvest target for entire time period TotalHarvestTarget = (THLBSize/HarvestRotation) * BaseTimestep HarvestTarget = TotalHarvestTarget // Keep logging until target is met or there are not more available cells NUMCLUSTERS = WHILE HarvestTarget > 0 // Select from a uniform distribution BlockExtent = ROUND(UNIFORM(BlockSizeMin/HaPerCell, BlockSizeMax/HaPerCell)) ENDNC PROBINIT //ORDERED Logged = MAX(Logged-BaseTimestep, 0) // NOTE: These probabilities are computed at the start of the logging year and do not reflect // changes as harvesting progresses. Hence, to avoid violations may occur within a year for a   // zone near but not over its constraint limits, a check is made again in TRANSITIONS /*  inBuffer = FALSE IF (GreenupYears > 0) OVER REGION CENTRED(1, 1.5, EUCLIDEAN) inBuffer = inBuffer OR (StandAge <= GreenupYears) ENDFN ENDFN */  p = PRODUCT // First check minimum harvest age (StandAge >= MinHarvestAge) // Adjacency greenup //        !inBuffer // Relative oldest first (StandAge - MinHarvestAge + 1) ENDFN PROBINIT = p ENDPI TRANSITIONS // Check if we should still be logging. // There is still extent left in the block and area to harvest isAvailable = (BlockExtent >= 1) AND (HarvestTarget > 0) // Min. harvest age isAvailable = isAvailable AND (StandAge >= MinHarvestAge) /*  // Adjacency inBuffer = FALSE IF (GreenupYears > 0) OVER REGION CENTRED(1, 1.5, EUCLIDEAN) inBuffer = inBuffer OR (StandAge <= GreenupYears) ENDFN ENDFN isAvailable = isAvailable AND (!inBuffer) */  // Make a transition only if we are still logging TRANSITIONS = isAvailable // Decrement the number of cells remaining to log for this block BlockExtent = BlockExtent - 1 HarvestTarget = HarvestTarget - HaPerCell // Increment area harvested AreaHarvested = AreaHarvested + HaPerCell // Set the stand age and time since harvest StandAge = 0 Logged = MaxTimeSinceDisturbance ENDTR // Use immediate spread so that an entire block is processed before the next is initiated SPREADTIMESTEP = -1 // Spread to cardinal neighbours SPREADLOCATION REGION CENTRED(1,1) DECISION (StudyArea > 0) AND (ForestStatus EQ Harvestable) ENDSL // Keep spreading: transitions will stop when the cutblock is finished //SPREADPROB = 1

ReportResults.lse
// Landscape event definition for reporting in the Labrador FMD19a "study copy" LSEVENT: REPORT_RESULTS DEFINITIONS /****************************************/  // Parameters GLOBAL VARIABLE: BaseTimestep // Base Time step (in years) /****************************************/  // Stats by harvesting GLOBAL VARIABLE: AreaHarvested, AreaBurned OUTPUT VARIABLE: ReportFile = "annualRecord.txt" ENDDEF // Evaluate yearly (or by "BaseTimestep" years) RETURNTIME RETURNTIME = IF Time EQ 0 THEN 0.02 ELSE BaseTimestep OUTPUT RECORD(ReportFile) DECISION (Time > 1) Run Year: FLOOR(Time) AreaBurned: AreaBurned/BaseTimestep AreaHarvested: AreaHarvested/BaseTimestep ENDFN ENDRT // Setting the number of clusters to zero will cause no cell initiations to occur NUMCLUSTERS = 0

Succession.lse
// Landscape event definition for succession in the Labrador District 19a "study copy" LSEVENT: SUCCESSION DEFINITIONS GLOBAL CONSTANT: MaxStandAge, HaPerCell /****************************************/  // Parameters GLOBAL VARIABLE: BaseTimestep  // Base Time step (in years) /****************************************/  GLOBAL VARIABLE: ForestSize, THLBSize LAYER: StudyArea, StandAge, OldForest LAYER: Spp LAYER: ForestStatus GLOBAL CONSTANT: Harvestable ENDDEF INITIALSTATE // Set up the initial state OVER REGION WHOLE MAP DECISION (StudyArea > 0) AND (Spp > 0) // Old forest is over 150 years OldForest = (StandAge >= 150) ForestSize = ForestSize + HaPerCell IF ForestStatus EQ Harvestable THLBSize = THLBSize + HaPerCell ENDFN ENDFN INITIALSTATE = 1 ENDIS // Aging at start of year (before any other models), but not in first period RETURNTIME = BaseTimestep // Only process forested cells EVENTLOCATION STATIC REGION WHOLE MAP DECISION (StudyArea > 0) AND (Spp > 0) ENDEL // In each forested cell TRANSITIONS // Increment the stand age in years StandAge = MIN(StandAge + BaseTimestep, MaxStandAge) // Old forest is over 150 years OldForest = (StandAge >= 150) TRANSITIONS = TRUE // Markov chain succession... ENDTR

Suggested Experiments
To explore this cellular automata model further, try the following: