Skip to content

Constant Controller


This is a controller which outputs a constant, i.e. unchanging, value.

Lisp and Lua Syntax, and Default Values

The constant controller can be created using the following Lisp or mlys.lua syntax:

(make-controller 'constant dimension value ... )
(make-controller 'constant dimension list )
(const value ... )
(const list )

local c1 = modalys.create_controller{ kind="constant", dimension=3, value=0.4}
local c2 = modalys.create_controller{ kind="constant", value={0.1,1.4,1.3e-8}}

If dimension is prodived and different from the number of input values, the controller's value will be either cut off or filled with extra zeros; otherwise the controller's dimension is simply set to the dimension of value automatically.


The 'constant controller takes the following arguments:

  • dimension: number of values the controller will output.
  • value: the value(s) output by the controller at any given time.
  • list: a list of value(s) output by the controller at any given time.

The constant controller is one of the most commonly-used controllers in Modalys. It outputs a constant, unchanging, value in all dimensions.

The number of values given depends on the dimension. If the number of values exceeds the dimension given, only the required number of values is used. If the number of given values is less than the dimension, the remaining dimensions are filled with controllers whose value is zero.

Although it can be created using the standard (make-controller ... ) syntax, it has a convenient shorthand version (const ... ) that is more convenient and thus more often used.

On occasion, a numerical value may be provided in the place of a constant controller for some, but not all, Modalys functions.


The controller's constant value(s) may be given as a series of individual values as arguments, or as a list:

(make-controller 'constant 3 50 60 70)

(make-controller 'constant 3 '(50 60 70))
When using the shorthand version (const ... ) the number of dimensions is automatically calculated from the number of arguments given:

(const 50 60 70)

(const '(50 60 70))
The above examples are all equivalent and can be used to create a 3-dimensional constant controller outputting 50, 60 and 70 in its three dimensions. The third of these examples is the easiest and therefore is the recommended way to create a controller.

Most often the (const ... ) function is used to create a simple one-dimensional controller such as the following example which outputs the value 0.36 at all times:

(const 0.36)

★     ★