Nova Workshop2015: Vertical Greenhouse

From Nova Documentation
Jump to: navigation, search

This is an extension of the Insecticide and Greenhouse models from the 2015 Nova Workshop at Oberlin College.

About this model

This model looks at the rates of predator and prey with the use of insecticides in a greenhouse. The greenhouse has two rooms, 1 and 2. In addition, each room is split into three vertical sections - Top, Mid, and Soil. Individuals start in room 1 and have the possibility to move into room 2 at specified time intervals.

Vert full.png

Here are a few assumptions and conditions of this model:

  • Prey cannot move vertically (within a Room)
  • Prey can only move horizontally (between Rooms)
  • Predators can move vertically
  • Predators can move horizontally
  • Horizontal movement is determined by the doorOpen condition
  • doorOpen is true when TIME() is between 250 and 251 as well as between 500 and 501
  • Vertical movement occurs at rates set by the to... and from... Sliders at the Top-layer

All of these assumptions could be changed with modifications to the existing code (mainly within the Flows at the insecticide sublayer).

Note: This model uses two different axes for each Graph. One axis is used for the number of Predators while the other is used for the number of Prey. The Graphs are split up by vertical sections. The Top Graph shows the predators and prey from the Top layer of both Room 1 and 2. The same applies for the Mid and Soil Graphs.

Programming Help

See the following for help with programming in JavaScript.

Ternary Conditional and more

It may be helpful to search for Ternary Conditional, JS Math Functions, and If-else Statements in the Mozilla Developer Network site (

Greenhouse Rooms

Vertical Layers

This model contains two rooms, each has multiple vertical layers. Layers may be understood as separate geographical areas, niches, or metapopulations depending on the use of these model. Connects vertically are determined by several sliders at the Top-layer.

Sliders set to 0 run the model without vertical movement

Set all of the to... and from... Sliders to 0 to run a model without vertical movement.

Sublayer Instances

It is important to note that each layer of each room in this model is an instance of the insecticide sublayer. Due to Nova's modulated design, we can easily call 6 instances of the sublayer as the 6 Chips Top_Room1, Top_Room2,...Soil_Room2 (Top, Mid, and Soil layers for Rooms 1 and 2). At the top-layer we can feed each Chip (each instance) a different set of values for its input pins. Similarly, the output of each Chip can go anywhere we choose. In our model, the outputs of the 3 Chips of Room 1 are connected to the Prey_In and Pred_In inputs of the Chips of Room 2.

Vert instances.png

Each Chip is created by dragging the insecticide sublayer (highlighted in red) unto the model Canvas.

Vert initial.png

The initial values of Predators and Prey for each instance is determined by several Sliders at the Top-layer. In this example, Room2 starts with no Predator or Prey. Additionally, the vertical layers of Room1 start with different numbers of Predators and Prey.

Insecticide Sublayer

Vert insecticide.png

This is a slight modification of the previous Greenhouse model - which was a modification of a basic Lotka-Volterra model (from the Model Library in Nova). We have added a number of input pins to be used for vertical and horizontal movement within the Prey and Predator Stock and Flows.

Prey Flow

As with the Greenhouse model, the Prey Stock is determined by the Births and predation Flow. Our new equation in this Flow simply has the addition of the inOutPrey variable. This variable is defined within the Flow and holds the net change in number of Prey that moved into or out of the current Chip.

Variables, like inOutPrey, are declared using the var keyword in JavaScript. We assign the variable with the = sign. The inOutPrey variable uses other variables (outPrey and inPrey) that are declared and assigned values in this Flow. The variables defined at the beginning of the Flow all use the Ternary Conditional statement.

Vert prey flow.png

The Ternary Conditional can be interpreted as the following:

(CONDITION) ? option_1 : option_2

The line of code above reads as "if CONDITION is true then the result is option_1 or else the result is option_2".

In this Flow, if the conditions rightOpen, leftOpen, and / or vertOpen are not met then the Ternary Conditions for certain variables result in 0. This means that if rightOpen is not true (the right door is not opened), then the variable outPrey equals 0.

Note: This model assumes that Prey cannot move vertically within a Room. All of the Prey within the Mid layer of Room1 can only move to the Mid layer of Room2, not into the Top or Soil layer of Room1 or Room2.

Predator Flow

As with the other predator-prey and Greenhouse models, the Predator Stock is determined by the eating and death Flow. Our new equation in this Flow simply has the addition of the inOutPred, vertPred1, and vertPred2 variables. These variables are defined within the Flow and hold the net change in number of Predator that moved into or out of the current Chip, vertically or horizontally.

Vert pred flow.png

Unlike Prey, Predators can move between layers of the same Room and between Rooms. This means Predators can move to/from the Top, Mid, and Soil layers of a Room at a rate determined by the Channel1out, Channel1in, Channel2out, and Channel2in variables. The values of these variables are set by Sliders at the top-layer. Vertical movement occurs if the vertOpen variable is true. In this model vertical movement is continually occurring at rates determined by the Channel variables. However, we could modify this model by having vertOpen be set to a conditional statement, like doorOpen at the top-layer.

Use of Comments

This is a good demonstration of using comments in Nova. The image below shows the use of comments, determined by the use of /* */, within the eating_and_death Flow. Anything within a commented section will show up green and not be used in running your Nova model. Comments can be extremely useful for documenting your work or removing sections of code that you may want at a later time.

Vert comment.png

Collecting Data

A wonderful component of Nova is its ability to easily collect and output data from model runs. We can see this with the GreenTable1 Table at the top-layer.

Vert table.png

Simply right-click on the Table component and drag over any variable from the model by using the >>> symbol within the properties section. The Table will record the values of each variable at each time increment. At the end of a model run you can click Save Data to save a CSV version of the data to your computer. The saved CSV file can then be opened in programs like Excel or R.