Example 5: NetDiffuse

From Nova Documentation
Jump to: navigation, search

A more complex network model can be used to show diffusion of a value through a directed network.

Viewing this model in Nova

To run this model:

  1. Launch Nova
  2. Select Menu Item File | Browse Model Library
  3. Open folder 6-Network Models and double-click NetDiffuse
NetDiffuse.png

Diffusion through a Directed Network

This model demonstrates diffusion of a quantity, the temp parameter in the sublayer, through a directed network. The quantity moves among nodes in the network only along established, directed links between two nodes. The simple rules that drive this diffusion lead to interesting patterns related to the topology, density, and stability of the network. Furthermore, the model may be useful in understanding the basic properties of dynamic processes on networks, and provides a useful starting point for designing more complex and realistic network-based models.

How it Works

In each tick, each node shares some percentage (defined by the rate slider) of its "value" (temp) quantity with its neighbors in the network. Specifically, the amount of shared value is divided equally and sent along each of the outgoing links from each node to each other node. If a node has no outgoing links, then it doesn't share any of it's value; it just accumulates any that its neighbors have provided via incoming links. Note that because it is a directed network, node B may give value to node A even if node A doesn't give back. The size of each node shows how much "value" (value of temp) that node has, where the area of the node is proportional to its value. The brightness of a link represents how much value just flowed through that edge.

Model Components and Layers

CNet NodeNetwork

The main component of this model is the CNet NodeNetwork plugin at the top level. Let's look at the properties of the CNet NodeNetwork. After right clicking and bringing up the NodeNetwork's properties, we can see that this plugin has a Count value of 100 and Initializer of node. In other words, CNet calls 100 instances of the node sublayer. Each of these nodes within the NodeNetwork at the top-layer are determined by the sublayer. The NodeNetwork plugin holds the structure of all 100 nodes. Additionally, this plugin encapsulates the connection between the nodes, determined by the nconnect variable in the programming window.

CNet calls instances of node

The node Sublayer

We can see that each node in the NodeNetwork calculates a change in temperature, the temp Stock, based on calculations involving slider parameters from the top-layer and the neighbors of the current node. It is important to note that the flow in, tempIn, and the flow out, tempOut, must be set to Uniflow within their properties. Uniflow Flow will only support non-negative values and the content only moves in one direction. Note: the value that is passed through a Flow can be a number or an expression (equation).

Node determines the components in CNet

Sliders

There are multiple sliders in this model. Connection Probability controls the connection between nodes in CNet by influencing the calculation of nconnect in the programming window. This is an example of using a component in the model without visibly connecting it to other components (see the lack of a dash line connecting Connection Probability to anything else).

The Max Temp and rate sliders determine the inpt and rate input in the CNet NodeNetwork, respectively. Within the node sublayer we see that Max Temp determines the value of the inpt input pin. This pin's value is used to calculate the Init Temp (initial temperature) of the model. Likewise, rate is used to determine the rate of diffusion between nodes in the NodeNetwork.

Sliders determine model parameters

Top Level Control

As a final note about this model we can look at the nodes Property at the top-layer. This term utilizes the Nova structure to retrieve values from the nodes within the NodeNetwork. The code main.CNet.NODES calls the NODES attribute of the CNet NodeNetwork at the top (main) level. In this way, we can use terms, or other Nova components, to act as references to variables, values, and / or attributes in other layers of a model. We then use our collection of the nodes stored in CNet to loop through and calculate the total temp within the model. This total, stored as tot, is viewed through the use of a Spy plugin.

Use nodes to access values within CNet

Running the Model

To run this model follow these steps at the toplayer:

  1. Click on the Capture button in the tool bar.
  2. Click Load next to "Capture".
  3. Click Exec to run the model through multiple iterations. Click Stop to stop the run before completion.
  4. To run the model step by step, click Capture, Load, Init, then Step.
  5. To rerun the model you may omit the Capture, Load steps.
  6. To have the model run more slowly adjust the speed slider above the Dashboard