## TOC »

## signal-diagram

### Description

`signal-diagram` implements functional reactive combinators that are used to build signal flow functions out of pure functions.

`signal-diagram` is inspired by functional reactive libraries such as Yampa and Opis.

`signal-diagram` provides a set of combinators to construct signal functions, which are functions operating on continuous time varying values. Every signal function has named input and output signals.

`signal-diagram` can generate executable code from a signal function definition in Scheme, Standard ML, and GNU Octave.

#### Pure signal functions and functional expressions

#### Basic combinators

`IDENTITY``f`procedureConstructs a signal function that copies its input to the ouput.

`PURE``f`procedureConstructs a signal function with no side effects.

`RELATION``r``f`procedureDefines the relation

`r`within the signal function`f`.

`UNION``f``g`procedureConstructs a signal function whose input is the union of the inputs of signal functions

`f`and`g`, and whose output is the union of the outputs of`f`and`g`.

`SEQUENCE``f``g`procedureConstructs a signal function that feeds its input to signal function

`f`, then takes the resulting output and feeds it to`g`, along with any additional inputs required by`g`.

`PIPE``f``g`procedureConstructs a signal function that feeds its input to signal function

`f`, then takes the resulting output and feeds it to`g`, without any any additional inputs.

`SENSE``ss``f`procedureConstructs a signal function that selects only the signals enumerated in

`ss`from its input, and feeds the result to the signal function`f`.

`ACTUATE``ss``f`procedureRenames the outputs of

`f`to the names specified in`ss`.

`RTRANSITION``f``g``ef``eg``s`procedureRecurrent transition: constructs a signal function that behaves like

`f`until the boolean signal specified by`ef`is true, when the signal function is switched to behave like`g`. If the boolean signal`eg`becomes true, the signal function is switched back to`f`.`s`is the name of the state variable that indicates the current state: if false, the state is`f`, otherwise the state is`g`.

`TRANSITION``f``g``ef``e`procedureSingularly occurring transition: constructs a signal function that behaves like

`f`until the boolean signal specified by`ef`is true, when the signal function is switched to behave like`g`.`s`is the name of the state variable that indicates the current state: if false, the state is`f`, otherwise the state is`g`.

`TRANSIENT``f``g``ef`procedureSingularly occurring transition: constructs a signal function that behaves like

`f`until the boolean signal specified by`ef`is true, when the signal function is switched to behave like`g`for (one invocation), and is then immediately switched back to`f`.

`ON``f``ef`procedureConstructs a signal function that behaves like

`f`only when the boolean signal specified by`ef`is true, otherwise copies the input to the output.

`INTEGRAL``i``d``f`procedureOne step numerical integration on the pure function

`f`given independent variable`i`and dependent variable`d`.

`INTEGRALH``i``d``h``f`procedureOne step numerical integration on the pure function

`f`given independent variable`i`, dependent variable`d`, and step`h`.

#### Combinators for systems of equations

The following combinators are provided by library `signal-diagram-dynamics`:

`ASSIGN`procedure

`ODE`procedure

`DAE`procedure

#### Code generation procedures

`codegen/Octave`procedure

`codegen/scheme`procedure

`codegen/ML`procedure

### Requires

### Version History

- 3.4 Added ON combinator
- 2.8 Adjustments to signal flow equations for actuate and union combinators
- 2.7 Added dyn-vector as a dependency in the meta file [thanks to Mario]
- 2.5 Bug fixes in relations handling in make-dae-system
- 2.3 Using make egg instead of setup-api for make macro
- 2.1 Added events procedure; better support for LSODE solver in Octave
- 2.0 Added state variable to the transition combinators
- 1.6 Improvements to the integrator interface
- 1.4 Exporting make-... procedures from
`signal-diagram-dynamics`library - 1.3 Moved RK library to flsim library
- 1.2 Install RK library files in Chicken shared directory
- 1.0 Initial release

### License

Copyright 2010-2014 Ivan Raikov This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.