Table of Contents

Snapshot

The snapshot block takes a snapshot of a given expression when a discrete events is triggered.

In versions prior to Ecolego 6, this functionality was incorporated in the recorder block.

When creating a snapshot block, you must specify either the name of the object to monitor, or an expression to monitor. This is called the “Target expression”. You also select a discrete events which will trigger the snapshot.

Creating a snapshot block

From the Projects window

From the Matrix window

From the Blocks window

Editing a snapshot 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 and graph window. See editing appearance for more information.

Values

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 target expression.

Example: Min/Max, Snapshot

Consider a model which simulates the financial transactions between yourself and your bank. A block named balance contains the current balance of your accounts. You wish to find out the maximum amount of money on your account over the month, and present this value by month.

To achieve this we need a discrete event which at the beginning of each month will

  1. Reset the Min/Max block.
  2. Take a snapshot of the Min/Max block.

The reason that we use a snapshot is because the value of the Min/Max block will change over the month as money are deposited or withdrawn from your accounts.

Assuming that the time unit is years, create a discrete event named Event_new_month with the following values:

Property Value
Left expression time/12-round(time/12)
Direction
Right expression0

Create a min/max block named balance_max, with the operation of Maximum. Give it the following values:

Property Value
Target expressionbalance
Reset Event_new_month

Finally create a snapshot block with the following values:

Property Value
Target expressionbalance_max
Event Event_new_month

See also