## Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

## 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

*[procedure]*

`(IDENTITY f)`

Constructs a signal function that copies its input to the ouput.

*[procedure]*

`(PURE f)`

Constructs a signal function with no side effects.

*[procedure]*

`(RELATION r f)`

Defines the relation `r` within the signal function `f`.

*[procedure]*

`(UNION f g)`

Constructs 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`.

*[procedure]*

`(SEQUENCE f g)`

Constructs 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`.

*[procedure]*

`(PIPE f g)`

Constructs 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.

*[procedure]*

`(SENSE ss f)`

Constructs a signal function that selects only the signals enumerated in `ss` from its input, and feeds the result to the signal function `f`.

*[procedure]*

`(ACTUATE ss f)`

Renames the outputs of `f` to the names specified in `ss`.

*[procedure]*

`(RTRANSITION f g ef eg s)`

Recurrent 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`.

*[procedure]*

`(TRANSITION f g ef e)`

Singularly 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`.

*[procedure]*

`(TRANSIENT f g ef)`

Singularly 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`.

*[procedure]*

`(ON f ef)`

Constructs a signal function that behaves like `f` only when the boolean signal specified by `ef` is true, otherwise copies the input to the output.

*[procedure]*

`(INTEGRAL i d f)`

One step numerical integration on the pure function `f` given independent variable `i` and dependent variable `d`.

*[procedure]*

`(INTEGRALH i d h f)`

One 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`:

*[procedure]*

`ASSIGN eqn ...`

*[procedure]*

`ODE eqn ...`

*[procedure]*

`DAE eqn ...`

#### Code generation procedures

*[procedure]*

`codegen/Octave`

*[procedure]*

`codegen/scheme`

*[procedure]*

`codegen/ML`

### 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/>.