# Executing OSM via DOS

Guidance below provides generalized methods that should apply to all Variants.

### Building the DOS Batch File

A batch file is a simple text file with a .bat extension. You can create and edit these files in Notepad.

Create a DOS batch file (MyFile.bat) and write this next line in it:

OSM.ConsoleApp.exe VariantName C:\Your_File_Path\Your_Command_File.osmc

For the Variant Name, choose either:

· ACADIAN (Acadian Forest model), or

· NL (Newfoundland and Labrador Variant model)

For the command file (.osmc), create a new text file with an .osmc extension and add OSM commands to it using a text editor.

Save the batch file, then double click the batch file and the OSM Variant executable should run. Any commands in ‘Your_Command_File.osmc’ will be interpreted and executed by OSM.

If you do not include the command file argument, a help text file will be automatically generated in the executable’s directory. This help file contains OSM commands, arguments, and descriptions.

For users relying on the FORUS Simulation Framework to run OSM, they will have to update their Executable file path and add two new commands to allow FORUS to properly read the executable arguments; e.g.,

Run OsmSimulation("C:\...\OSM.ConsoleApp.exe"){

CommandFile = "<@>ForusCommandsForOSM.osmc"

//OSM Requires two arguments to execute: 1) Variant Code; 2) Command File Path

ExecutableArgs = "Acadian"; CommandFile

… more FORUS or OSM commands …

}

### Building an OSM Command File

The command file is a simple text file. It can be created and/or opened in any text editor application. The extension is not important, but the [.osmc] file extension is recommended.

### · Language basics

### · Commands

## Best practices for OSM developers

Developers of custom Variant models (Variant DLLs, like OSM.AcadianModels.dll), which extend the main OSM software library (OSM.CommonModels.dll), must also modify the OSM.ConsoleApp.exe program to 1) reference your Variant DLL, and 2) update code to allow the program to initialize your Variant runtime according to the first DOS argument ‘VariantName’.

This provides a common way for all OSM users to run all OSM models with the same commands.

## Third-party execution

While the DOS batch file and command file methods described above provide means to perform basic simulations, processing many stands and treatments can quickly become unwieldy.

Alternatively, a third-party application can be built to write, submit, and oversee command execution of the model.

The Simulation Framework, designed by FORUS Research, is a good example of such an application. The Simulation Framework can assist with writing command files for OSM or the Forest Vegetation Simulator and oversee thousands of stand simulations. The Simulation Framework can also perform concurrent post-processing of simulation results (tree list projections) into stand yields stored in an Access Database.

See Linking OSM to another Application for information on designing custom OSM applications.