User Tools

Site Tools


recorder

Recorder

The recorder block will store the minimum or maximum value of another object. It can also store “snapshots” of a given object.

When creating a recorder block, you must specify either the name of the object to record, or an expression to record. This is called the “record target”.

You can also specify a reset condition. Whenever the condition switches from “false”, or zero, to “true”, or greater than 0 a reset will be triggered. Depending on the selected option, a reset will mean different things:

  • When recording the minimum or maximum value, a reset means that the previous “highest” or “lowest” value will be set to the current value.
  • For snapshot, a reset means that a new snapshot is taken.

Creating a recorder block

From the Projects window

  • Expand the Project to which you wish to add the recorder by clicking the + symbol next to it. Right-click on ‘Blocks’, or a sub-system in ‘Blocks’, and select Recorder from the pop-up menu.

From the Matrix window

  • Right click an empty diagonal cell of the matrix and select Recorder from the the pop-up menu.

From the Blocks window

  • Place the mouse anywhere over the area of this window and right-click on it. Select New | Recorder from the pop-up menu, or
  • In the title bar, select Recorder from the Type drop-down list and click on the New button.

Editing a recorder block

NoteMost block properties can be edited directly in the Blocks window.

The block editor is shown by right-clicking the block in a window and selecting Edit. In the Blocks window, you can also show the block editor by selecting the block and clicking the Edit button, or by double-clicking the right-most “validation” column of the block.

The block editor has three tabs:

Properties

This page lets you edit basic properties such as name, sub-system and base unit. See editing properties for more information.

Appearance

This page lets you edit the visual properties of the block in the Matrix window. See Editing appearance for more information.

Values

Operation - Select the record operation to perform

  • Maximum - Record the maximum value of the target expression
  • Mean - Record the mean value of the target expression
  • Minimum - Record the minimum value of the target expression
  • Snapshot - Record the value of the target expression only when the reset condition switch from false to true.

Dimension - You can specify the dimension of the block by using the Type drop down list. Depending on the dimension the index drop down lists are activated.

Data - The data table let you specify index specific properties like record target and reset conditions

  • Indices - For blocks that are non-scalar, the first columns will specify indices from the index lists. This allows you to specify different expressions for different indices. The top row is named “default” and can be used when the same value should be set for all indices.
  • Target expression - Enter either just the ID of an object to record, or enter a full expression.
  • Record condition - The record conditions determines when values are recorded. When the record condition is false, no data is recorded.
  • Reset condition - The reset condition will reset the recorder to the current value of the target expression. The “reset” is triggered whenever the condition switches from being evaluated to zero to being evaluated to being larger than zero. When recording a minimum, mean or maximum, the reset means that the minimum/maximum is set to the current value of the target expression. When recording snapshots the reset means that a new snapshot is taken.
  • Information - By using the Table control button you can display more columns that will help you document your model.

Example: Snapshot

Consider a model for contamination of grain. At a specific date each year the grain is harvested. The harvested grain is used for baking bread until next years harvest. When modelling the amount of contamination ingested by people in the area, the value needed is the concentration of the contaminant at harvest.

The model has a compartment called grain which accumulates contaminants during the year and which is cleared every year at harvest which is at day 240. A recorder is created to take snapshots of grain. In order to take a new snapshot every year at day 240, the following condition is written: (mod(time,365)>240), assuming of course that the time unit is in days.

See also

recorder.txt · Last modified: 2019/11/18 13:34 (external edit)