User Tools

Site Tools


tutorial_-_time_events_-_monthly_max

This is an old revision of the document!


Tutorial - Time events - Monthly maximum

A common request is to find the maximum value of an output. For this one can use the Min/Max block. However, in this experiment we will determine the maximum for each month of the simulation.

This means that we need to reset the Min/Max block every month. We will need the following:

  • A Time point block which allows us to specify the first day of each month
  • A Time event which will fire events based on the time point block
  • A Min/Max block which records the soil concentration.

Create time point

  1. Create a time point block
  2. Edit the block.
  3. In the Properties screen
    1. change the name to “Month_time_point”.
  4. In the Values screen
    1. click the Settings button.
    2. Change the Mode to Day of month.
    3. Enter the value 1 as the Timepoint in the table, which indicates the 1st of each month.
  5. Close the window

Create event

  1. Create a time event block
  2. Edit the block.
  3. In the Properties screen
    1. change the name to “Month_event”.
  4. In the Values screen
    1. select Month_time_point and click the > button.
  5. Close the window

Create min/max

  1. Create a min/max block
  2. Edit the block
  3. In the Properties screen, change the name to Monthly_max
  4. In the Values screen
    1. Enter the name _Soil_ in the Target expression column
    2. Select _Month_event_ in the Reset column
  5. Close the window

Run a simulation

  1. Run a simulation, then plot _Soil_ together with _Monthly max. - The plot should look like this: You can download the model here ==== Base model ==== All examples are based on the following base model, which calculates a dummy value we can use for our event experiments. You can download the model from here 1. Edit simulation settings. Set * Time unit: Days * Time mode: Time * Start time: 0.0 * End time: 100.0 * Start date:2000-01-01 * Output options: Produce additional output * Time points: from start to end with a 1.0 increment 2. Create a material named Poison with the unit mg. 3. Create two compartments Sky and Soil. Set the initial condition for Sky to be 500 (mg) of Poison**.

4. Add a transfer from Sky to Soil and set its equation to “30+sin(time/5)*20+cos(time/3+2)*10”

5. Add a transfer from Soil to Sky and set its equation to “30+sin(time/3+2)*10+cos(time/7+3)*20”

6. When run, the model will output a Sky and Soil concentration like this:

Continue with Next

See also

tutorial_-_time_events_-_monthly_max.1602526481.txt.gz · Last modified: 2020/10/12 20:14 by erik