simulate — Simple sequential simultion model.


simulate ( String sortOrder , String treatmentType , String [ ] quotaNames , String [ ] constraintNames ) 

The command has the following arguments:


An expression that will generate a numeric value for each block. This number is then used to sort the harvest queue.


An expression that will compute the treatment that should be applied to the stand at harvest. If the value is null then the routine will automatically choose the first eligible treatment frem the CANDIDATETREATMENTS column.


A list of targets that must be fulfilled before harvest will stop.


A list of targets that must not be underfilled. If harvesting a stand would cause one of the constraints to increase then the stand will be bypassed for harvest. If you do not want to apply constraints then use an empty string array (e.g. new String[] {}).


Simple sequential simultion model.

This BeanShell script has been put together as an example of how to implement a simulation model in just a few lines of code. Although it works as advertised, this simple simulator is unlikely to have all of the features required for a full scale wood supply analysis. Feel free to take this script as a starting point to build a full-featured model.

Obviously, this script could be made considerably more complex in a couple of ways:

  • more complex stand sorting rules. This sample has a single sort criteria (e.g. oldest-first), but multiple simultaneous sorts could be applied to break ties.

  • More complex simulation targets. The current implementation simply keeps harvesting from the list until the specified active targets are satisfied (in the grey zone). You must set targets on accounts prior to running this simulation script.

  • More sophisticated way of choosing treatments. This example only allows that a single named treatment be applied to every selected stand.

Here is an example of how to use this simulation script. This example works on the C5 sample dataset.

  setActive("product.Yield.managed.Conif", true, true, false);
  setMinimum("product.Yield.managed.Conif", 100000);
  setActive("feature.VQO.1-HE1", true, false, true);
  setMaximum("feature.VQO.1-HE1", 12f/5);
  setActive("feature.VQO.1-HE2", true, false, true);
  setMaximum("feature.VQO.1-HE2", 64f/5);
  simulate("-MANAGEDOFFSET",  "'CC'",
           new String[] {"product.Yield.managed.Conif"},
           new String[] {"feature.VQO.1-HE1","feature.VQO.1-HE2"});

This example turns off all targets, activates the conifer harvest at 100,000 m3 year, and the VQO target at a max of 64ha per period, and then starts the simulator with parameters to sort oldest-first, and apply "CC" treatments until the "product.Yield.managed.Conif" quota is met, and skip treatments if the VQO targets are not met.

Note that the treatmentType argument specifies a literal value 'CC' within the double quotes. This is because the value will be evaluated as an expression, so we must use the correct expression syntax.

After the simulation has completed the state of the Patchworks model will contain the results. At this point the report writer can be used to save a description of the harvest schedule and the outcomes of management.