Files
StreamDevice/doc/ai.html

90 lines
3.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>StreamDevice: ai Records</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="stream.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="author" content="Dirk Zimoch">
</head>
<body>
<iframe src="nav.html" id="navleft"></iframe>
<h1>ai Records</h1>
<h2>Normal Operation</h2>
<p>
Depending on the format type, different record fields are used
for output and input. The variable <code><i>x</i></code> stands for the
written or read value.
</p>
<dl>
<dt>DOUBLE format (e.g. <code>%f</code>):</dt>
<dd>
<u>Output:</u> <code><i>x</i>=(VAL-AOFF)/ASLO</code><br>
<u>Input:</u> <code>VAL=(<i>x</i>*ASLO+AOFF)*(1.0-SMOO)+VAL*SMOO</code><br>
In both cases, if <code>ASLO==0.0</code>, it is treated as <code>1.0</code>.
Default values are <code>ASLO=1.0</code>, <code>AOFF=0.0</code>,
<code>SMOO=0.0</code>.<br>
If input is successful, <code>UDF</code> is cleared.
</dd>
<dt>LONG format (e.g. <code>%i</code>):</dt>
<dd>
<u>Output:</u> <code><i>x</i>=RVAL</code><br>
<u>Input:</u> <code>RVAL=<i>x</i></code><br>
Note that the record calculates
<code>VAL=(((RVAL+ROFF)*ASLO+AOFF)*ESLO+EOFF)*(1.0-SMOO)+VAL*SMOO</code>
if <code>LINR=="LINEAR"</code>.
<code>ESLO</code> and <code>EOFF</code> might be set in the record
definition. <em>StreamDevice</em> does not set it. For example,
<code>EOFF=-10</code> and <code>ESLO=0.000305180437934</code>
(=20.0/0xFFFF) maps 0x0000 to -10.0, 0x7FFF to 0.0 and 0xFFFF to 10.0.
Using unsigned formats with values &ge; 0x800000 gives different results
on 64 bit machines.
<p>
If <code>LINR=="NO CONVERSION"</code> (the default), <code>VAL</code>
is directly converted from and to <code>long</code> without going through
<code>RVAL</code>. This allows for more bits on 64 bit machines.
To get the old behavior, use <code>LINR=="LINEAR"</code>.
</p>
</dd>
<dt>ENUM format (e.g. <code>%{</code>):</dt>
<dd>
Not allowed.
</dd>
<dt>STRING format (e.g. <code>%s</code>):</dt>
<dd>
Not allowed.
</dd>
</dl>
<h2>Initialization</h2>
<p>
During <a href="processing.html#init">initialization</a>, the <code>@init</code> handler is executed, if present.
In contrast to normal operation, in DOUBLE input <code>SMOO</code> is ignored
(treated as <code>0.0</code>).
</p>
<hr>
<p>
<a href="aai.html">aai</a>
<a href="aao.html">aao</a>
<a href="ao.html">ao</a>
<a href="bi.html">bi</a>
<a href="bo.html">bo</a>
<a href="mbbi.html">mbbi</a>
<a href="mbbo.html">mbbo</a>
<a href="mbbiDirect.html">mbbiDirect</a>
<a href="mbboDirect.html">mbboDirect</a>
<a href="longin.html">longin</a>
<a href="longout.html">longout</a>
<a href="stringin.html">stringin</a>
<a href="stringout.html">stringout</a>
<a href="waveform.html">waveform</a>
<a href="calcout.html">calcout</a>
<a href="scalcout.html">scalcout</a>
</p>
<p><small>Dirk Zimoch, 2015</small></p>
</body>
</html>