Difference between revisions of "Component Guide I: Atomic Components"

From Numerus
Jump to navigation Jump to search
Line 27: Line 27:
Most components require a formula or program to specify their values. This formula is a NovaScript expression or sequence of expressions entered into a text area on the PropPane. Component value formulas can make use of the underlying Javascript language to build somewhat complex algorithms for computing the value <ref>Discussion of Javascript is beyond the scope of this document; see [[Javascript References]] for more information about programming in Javascript.</ref>, however long and complex computations are becodeer relegated to code chips or global method definitions.  
Most components require a formula or program to specify their values. This formula is a NovaScript expression or sequence of expressions entered into a text area on the PropPane. Component value formulas can make use of the underlying Javascript language to build somewhat complex algorithms for computing the value <ref>Discussion of Javascript is beyond the scope of this document; see [[Javascript References]] for more information about programming in Javascript.</ref>, however long and complex computations are becodeer relegated to code chips or global method definitions.  


===Simple Formulas===
In the simplest case this will be a constant number or string, or an arithmetic formula. Formulas may reference other value-producing components such as States or Terms, and may also reference any of the global elements known as [[Primitives]].<ref>A list of primitive operators and constants appears under the '''Primitives''' tab.</ref>
In the simplest case this will be a constant number or string, or an arithmetic formula. Formulas may reference other value-producing components such as States or Terms, and may also reference any of the global elements known as [[Primitives]].<ref>A list of primitive operators and constants appears under the '''Primitives''' tab.</ref>
;Examples
;Examples

Revision as of 19:51, 12 March 2018

Overview

Nova models are constructed out of components, which are visual tokens that are placed on the Model Canvas.

To place a component on the model canvas:

  • Press the left mouse button on the desired component in the menu obtained from the component tab.
  • Drag the component from the component menu onto the model canvas.
  • When prompted, provide a component name (a default name will be provided if you choose not to provide one).

A new component requires two actions to integrate it into the model:

  • Connections must be made to components with which this component will interact; and
  • The new component must be programmed; in the simplest case, this involves providing a component formula that defines the value represented by this component. Specific programming tasks for each component type will be described below.

Component Types

Atomic Components
Tranditional systems dynamic components State (subdivided into Stock Stock+Flow, Sequence, Sequence+Flow, and Store), Flow, and Term; along with Command and Event.
Containers
Nova containers consist of Chips and 5 types of aggregators; a Chip holds a single instance of Capsule, used as a submodel while aggregators hold multiple Capsule instances, possibly of different types. Each aggregator type implements a different topology for its elements. The aggregator components are AgentVector, CellMatrix, NodeNetwork, SimWorld and NetWorld.
Controls and Displays
These include Table, Linechart, Scatterchart, Barchart, Histogram, Slider, Spinner and Toggle.
Special
These are special purpose components consisting of Code Chip and Comment.
Plugins
These are extensions to the component set and have various functions.

Component Properties

Each component has an associated Properties Pane (PropPane) that provides the means for programming the component (and in some cases specifying connections.) The PropPane is opened by selecting the component. PropPanes allow you to define the value represented by a component, set pin connections, determine what is displayed (in the case of Graphs and Tables), calibrate (in the case of Sliders and Spinners) and set any other property required by the component. Specific properties are part of the component descriptions below.

Component Formulas

Most components require a formula or program to specify their values. This formula is a NovaScript expression or sequence of expressions entered into a text area on the PropPane. Component value formulas can make use of the underlying Javascript language to build somewhat complex algorithms for computing the value [1], however long and complex computations are becodeer relegated to code chips or global method definitions.

Simple Formulas

In the simplest case this will be a constant number or string, or an arithmetic formula. Formulas may reference other value-producing components such as States or Terms, and may also reference any of the global elements known as Primitives.[2]

Examples
Formula Notes
27
x + 2
2 * PI PI is a primitive constant.
COS(2*PI*x) COS is a primitive operator

Important: the caret (^) operator is not supported in Javascript for exponentiation. Instead, use Math.pow; e.g. 2^3 becomes Math.pow(2, 3).

  1. Discussion of Javascript is beyond the scope of this document; see Javascript References for more information about programming in Javascript.
  2. A list of primitive operators and constants appears under the Primitives tab.