# deltaFSD ## QUICKREF - outlines of the various functions in version 0.4 of deltaFSD

We use the deltaFSD internal convention:

• In(0) is the first input - the top left stub
• Out(0) is the first output - the top right stub

 Math functions Add `Out(0) = In(0) + In(1);` Subtract `Out(0) = In(0) - In(1);` Multiply `Out(0) = In(0) * In(1);` Divide ```if (In(1)) Out(0) = In(0) / In(1); If In(1) == 0.0 the output will not be updated``` Absolute `Out(0) = (In(0) > 0.0 ? In(0) : -In(0));` Div-Mod ```if (In(1) != 0.0) { Out(0) = ((int)In(0)/(int)In(1)); Out(1) = ((int)In(0)%(int)In(1)); } If In(1) == 0.0 the output will not be updated ) Provides integer operation but all inputs and outputs are floats ``` Int-Fract ```Out(0) = (int)In(0); Out(1) = In(0) - Out(0);``` Ceil-Floor ```Out(0) = ceil(In(0)); Out(1) = floor(In(0));``` Exp-Log ```Out(0) = exp(In(0)); Out(1) = log(In(0));``` Power `Out(0) = pow(In(0), In(1));` Trig & Calc functions Sin `Out(0) = sin (In(0));` Cos `Out(0) = cos (In(0));` Integral ```Out(0) = Out(0)+In(0)*In(1); Simple scaled integral In(2) provides update step interval``` Difference ```Out(0) = Out(0)+(In(1)*(In(0)-Out(0))); Simple scaled difference In(2) provides update step interval``` Comparison functions Compare `Out(0) = In(0) >= In(1) ? 1.0 : 0.0;` Min-Max ```Out(0) = In(0) >= In(1) ? In(0) : In(1); Out(1) = In(0) >= In(1) ? In(1) : In(0);``` Hysteresis ```Out(0) = fabs(In(0)) >= fabs(In (1)) ? In(0) : 0.0; Out(0) is zero if In(0) is less than the magnitude of In(1) Out(0) follows In(0) whilst it is >= the magnitude of In(1)``` Logic functions `(as usual 0.0 => false, any non zero => false, true output => 1.0)` And `Out(0) = In(0) && In(1);` Or `Out(0) = In(0) || In(1);` Xor `Out(0) = (In(0) || In(1)) && !(In(0) && In(1)); ` Not `Out(0) = !In(0);` Bistable `if (In(0)) Out(0) = Out(0) ? 0.0 : 1.0;` RS-FlipFlop `if (In(1)) Out(0) = In(0) ? 0.0 : 1.0; ` Utility functions Constant `Out(0) = user entered constant` Delay ```Out(0) = Out(1); Out(1) = In(0); (uses Out(1) to store the previous value)``` Filter ```Implements a simple digital filter. In(0) - signal in, In(1) - sample control, Out(0) - filtered output The sample rate sets the frequency response Low pass and high pass frequncy = 1/8 of the sample rate Band pass allows frequnciesbetween 1/2 and 1/4 of the sample rate ``` Counter ```if (In(0)) Out(0) = In(1) ? Out(0) + 1.0 : Out(0) - 1.0; if (!In(2)) Out(0) = 0.0; Implements an up/down counter In(0) pulse input - must toggle zero/non-zero In(1) direction - 0.0 => down, non-zero => up In(2) will rest the counter (when non-zero)``` Timer ```Implements a (seconds) timer Out(0) is the elapsed time from reset In(0) will rest the timer (when non-zero) The user can set the rate at which the output is updated``` Ticker ```Variable frequency square wave (0.0, 1.0) output The user sets the period (1/2 * frequency) In(0) will rest the ticker (when non-zero)``` Track-Hold ```if (In(1)) Out(0) = In(0); While In(0) is non-zero Out(0) follows In(0) When In(0) goes to zero the last output value is held``` Edge-Sample ```if (In(1) && !Out(1)) Out(0) = In(0); Out(1) = In(1) ? 1.0 : 0.0; In(0) is instantaneously sampled when In(1) goes from zero Out(0) remains fixed until the next sample (rising edge of In(1) Out(1) hold last state of In(1)``` I-O functions Get `Creates a user input entry box at the bottom of the window` Print `Creates a box which displays its input` Graph ```Creates a child window displaying an x-y graph In(0) has the y value, In(1) has the x value The graph has -1 < x < +1, and -1 < y < +1 The scale and offset can be set to create values in this range ie -1 < ((input * scale) + offset) < +1 The graph is only updated on a change of x - In(1)``` Chart ```Creates a child window displaying an y-t chart In(0) has the y value, In(1) steps the chart forward The graph has -1 < y < +1 The scale and offset can be set to create values in this range ie -1 < ((input * scale) + offset) < +1 The graph is updated on a change of In(1) from zero to non-zero``` I-O functions Module ```Creates a module - a function made up of other functions The user specifies the numbers of inputs and outputs Right click the top left corner hot spot to descend into a module - or ascend from one.``` Perl ```Povides an interface to an external Perl script The deltaFSD function will then execute a Perl sub in the script The first invocation requires the script file Then user specifies the sub name and the numbers of inputs and outputs See the notes in the samples section for more information``` Socket ```Creates a bidirectional socket (stream) interface Data is transferred as comma separated channel,value pairs The default port number is 6739 The user specifies the numbers of inputs and outputs deltaFSD acts as a server so clients can connect from anywhere - "localhost" or via network See the notes in the samples section for more information``` 