21  OM Object

The OM object

21.1 Years and Seasons

CurrentYear is the last historical year before the projections begin, and is automatically set to the current calendar year:

This can be over-written using either the CurrentYear argument in OM() or by assigning a new value to the OM object with CurrentYear():

The Years function can be used to return the values of the historical or projection years:

Unless specified otherwise, operating models are constructed using annual time steps. Seasonality can be added to the model by assigning a value to the Seasons slot of the OM object:

As shown above, Seasons changes the values of the historical and projection years into decimal years corresponding with the specified number of seasons within a year.

TipAvoid using assigning values with @

Almost all openMSE objects have been developed using the R S4 system.

S4 objects contain slots, named components of the object that can be accessed using the @ operator (this is analogous to using the $ symbol to access contents of S3 objects), for example:

The @ symbol can be used to assign new values to slots, for example:

ExampleOM@nSim <- 5

However, while earlier versions of openMSE advocated using the @ symbol to access slots and assign new values, this practice is not recommended for openMSE 2.0.

Instead, users are encouraged to use the accessor and assignment functions that have been developed for each object class.

This is especially important when assigning new values, where the assignment functions may have side effects that will be missed if the @ symbol is used for assigning new values to an object.

For example, consider the Seasons assignment function:

Note that in addition to assigning the new value to the Seasons slot, the Seasons assignment function also recalculates the values for the Years slot, a step that would have been missed if the new value was assigned directly using the @ symbol and would lead to unexpected errors.

If required, the lubridate package can be used to convert decimal years into dates (and back again):

Important

The Seasons value in the OM defines the number of historical and projection time steps, as well as the structure of the age classes for all stocks in the OM.

The accounting in openMSE always starts at the beginning of the first historical year (i.e., Years(ExampleOM)[1]) and moves sequentially through the annual or seasonal time steps in Years(ExampleOM).

All stocks must have the same time units as the OM. See the Ages section below for an example.

Additionally, because it is used to set up the time and age structure of the model, the Seasons value should not be changed once an operating model is constructed.

21.2 OM Metadata

21.3 Other Contents of the OM Object

OM objects can contain one or more Stock objects.