Difference between revisions of "Designer Component Guide"

From Numerus
Jump to navigation Jump to search
Line 40: Line 40:
[[File:dconstant.png]] A Constant contains a Supplier squib that is executed once when the simulation is reset. The value is retained for the life of the simulation.
[[File:dconstant.png]] A Constant contains a Supplier squib that is executed once when the simulation is reset. The value is retained for the life of the simulation.
;Property Pane
;Property Pane
[[File:constProp.png|360px|thumb|right]] Contains a single <span style="color:#ff8c00">'''Supplier'''</span> squib.
[[File:constProp.png|360px|thumb|right]] Contains a single <span style="color:#ff8c00">'''Supplier'''</span> squib. Return type is required.
;Squib Reference
;Squib Reference
:To retrieve a Constant use the following format:
:To retrieve a Constant use the following format:
Line 47: Line 47:
<br clear="all">
<br clear="all">
<div id="Function">
<div id="Function">
===Function===
[[File:dfunction.png]] A Function contains a Function squib that is executed only when the function defined by the squib is invoked on a set of arguments. Function squibs are defined [[Quick Programming References#Function | here]].
;Property Pane
[[File:constProp.png|360px|thumb|right]] Contains a single <span style="color:#ff8c00">'''Supplier'''</span> squib. Return type is required.
;Squib Reference
:To retrieve a Constant use the following format:
::<name>()


===Function===
===Function===
[[File:dfunc.png]]
[[File:dfunc.png]]
</div>
</div>

Revision as of 18:58, 7 June 2022

Introduction

This guide documents the Component set distributed with Numerus Designer. Numerus Designer models are constructed out of Components, which are visual tokens that are placed on the Design Canvas.

To Place a Component on the Designer Canvas

  • Press the left mouse button on the desired Component in the Component Palette.
  • Drag the component from the component menu onto the Design Canvas.
  • A default name will be provided; Alt-click on the name to change it (or change it in the Property Pane).
  • The new component must be programmed; this may require the programming of squibs. See Programming References for a discussion of squib programming.

Referencing Components in Squibs

Many Components yield values that can be used (along with primops) to perform the required computations in squibs. Within a given Capsule, each value-yielding component can be referenced by its name. Referencing Components in other Capsules is different and will be discussed elsewhere.

In this document, the sections labeled Squib Reference describe the format used to access values from each Component type[1]. In these sections the notation <name> refers to the Component's name.

Basic Components

Command

Dcommand.png A command contains code that is executed once per time step. Commands do not return values; rather they operate by altering simulation state, often through the execution of some primitive operator. One common use for a Command is during program development, where the Console.log primop is used to print useful values to the console. Another important role is in the agent life cycle, where Commands may contain code used to create or terminate agents, or move them in their environment.

Property Pane
Thumb
Contains a single Command squib.
Observer
If checked, this Command is not executed during the normal Simulation cycle, but rather intentionally from a remote Observer, such as an Agent Vector Component, or from some other Component.
Volatile
Normally Components are executed only once per cycle. If Volatile is checked, it enables multiple executions.
Squib Reference
Generally not used since Commands execute automatically. To invoke a Command from a squib use the following format:
<name>()


Constant

Dconstant.png A Constant contains a Supplier squib that is executed once when the simulation is reset. The value is retained for the life of the simulation.

Property Pane
ConstProp.png
Contains a single Supplier squib. Return type is required.
Squib Reference
To retrieve a Constant use the following format:
<name>()


Function

Dfunction.png A Function contains a Function squib that is executed only when the function defined by the squib is invoked on a set of arguments. Function squibs are defined here.

Property Pane
ConstProp.png
Contains a single Supplier squib. Return type is required.
Squib Reference
To retrieve a Constant use the following format:
<name>()

Function

Dfunc.png

  1. This process is technically called reification.