<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html class="client-nojs" dir="ltr" lang="en">
<head>
<meta charset="UTF-8" />
<title>Modules/FLibComplex1 - OpenSCADAWiki</title>
<meta content="MediaWiki 1.26.4" name="generator" />
<link href="https://www.gnu.org/copyleft/fdl.html" rel="copyright" />
<link href="../files/doc.css" rel="stylesheet" /></head>
<body><div class="floatright"><a href="../index.html"><img alt="OpenSCADA" src="../../en/files/index.png" /></a></div><div id="mw_header">
			<div class="mw-indicators">
</div>
			<h1 id="firstHeading" lang="en">Modules/FLibComplex1</h1>
		</div><div class="mw-content-ltr" dir="ltr" id="mw-content-text" lang="en"><div class="mw-pt-languages" dir="ltr" lang="en"><div class="mw-pt-languages-list autonym"><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete">English</span>&nbsp;• ‎<a class="mw-pt-progress mw-pt-progress--complete" href="../../ru/Modules/FLibComplex1.html" title="Модули/FLibComplex1 (100% translated)">mRussian</a>&nbsp;• ‎<a class="mw-pt-progress mw-pt-progress--complete" href="../../uk/Modules/FLibComplex1.html" title="Модулі/FLibComplex1 (100% translated)">Українська</a></div></div>
<table class="wikitable">

<tr>
<th> Module </th>
<th> Name </th>
<th> Version </th>
<th> License </th>
<th> Source </th>
<th> Languages </th>
<th> Platforms </th>
<th> Type </th>
<th> Author </th>
<th> Description
</th></tr>

<tr>
<td> <a href="../Modules/FLibComplex1.html" title="Special:MyLanguage/Modules/FLibComplex1">FLibComplex1</a> </td>
<td> Complex1 functions
</td>
<td> 1.2 </td>
<td> GPL2 </td>
<td> spec_FLibComplex1.so </td>
<td> en,uk,ru,de </td>
<td> x86,x86_64,ARM
</td>
<td> Special </td>
<td> Roman Savochenko<br />&nbsp;&nbsp;<font size="-2"><i>Maxim Lysenko (2009) — the page translation</i></font> </td>
<td> Provides a library of the functions of compatibility with SCADA Complex 1 of the firm DIYA Ltd.
</td></tr></table>
<p>The module provides OpenSCADA for a static library of compatibility functions with SCADA Complex1 of the firm SIC "DIYA". These functions were used in Complex1 in the form of algoblocks to create in-system computations based on the virtual controller. Providing the library of these functions allows the transfer of computational algorithms from Complex1.
</p><p>To address the functions of the library you can use the static call address <b>Special.FLibComplex1.{Func}()</b> or dynamic <b>SYS.Special.FLibComplex1["{Func}"].call()</b>, <b>SYS.Special.FLibComplex1.{Func}()</b>. Where <i>{Func}</i> — function identifier in the library.
</p><p>Below is a description of each library function.
</p>
<div class="toc" id="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Alarm_.28alarm.29"><span class="tocnumber">1</span> <span class="toctext">Alarm (alarm)</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Condition_.27.3C.27_.28cond_lt.29"><span class="tocnumber">2</span> <span class="toctext">Condition '&lt;' (cond_lt)</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Condition_.27.3E.27_.28cond_gt.29"><span class="tocnumber">3</span> <span class="toctext">Condition '&gt;' (cond_gt)</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Full_condition_.28cond_full.29"><span class="tocnumber">4</span> <span class="toctext">Full condition (cond_full)</span></a></li>
<li class="toclevel-1 tocsection-5"><a href="#Discrete_block_.28digitBlock.29"><span class="tocnumber">5</span> <span class="toctext">Discrete block (digitBlock)</span></a></li>
<li class="toclevel-1 tocsection-6"><a href="#Division_.28div.29"><span class="tocnumber">6</span> <span class="toctext">Division (div)</span></a></li>
<li class="toclevel-1 tocsection-7"><a href="#Exponent_.28exp.29"><span class="tocnumber">7</span> <span class="toctext">Exponent (exp)</span></a></li>
<li class="toclevel-1 tocsection-8"><a href="#Flow_.28flow.29"><span class="tocnumber">8</span> <span class="toctext">Flow (flow)</span></a></li>
<li class="toclevel-1 tocsection-9"><a href="#Iterator_.28increment.29"><span class="tocnumber">9</span> <span class="toctext">Iterator (increment)</span></a></li>
<li class="toclevel-1 tocsection-10"><a href="#Lag_.28lag.29"><span class="tocnumber">10</span> <span class="toctext">Lag (lag)</span></a></li>
<li class="toclevel-1 tocsection-11"><a href="#Simple_multiplication_.28mult.29"><span class="tocnumber">11</span> <span class="toctext">Simple multiplication (mult)</span></a></li>
<li class="toclevel-1 tocsection-12"><a href="#Multiplication_and_division_.28multDiv.29"><span class="tocnumber">12</span> <span class="toctext">Multiplication and division (multDiv)</span></a></li>
<li class="toclevel-1 tocsection-13"><a href="#PID_regulator_.28pid.29"><span class="tocnumber">13</span> <span class="toctext"><span>PID regulator (pid)</span></span></a></li>
<li class="toclevel-1 tocsection-14"><a href="#Power_.28pow.29"><span class="tocnumber">14</span> <span class="toctext">Power (pow)</span></a></li>
<li class="toclevel-1 tocsection-15"><a href="#Selection_.28select.29"><span class="tocnumber">15</span> <span class="toctext">Selection (select)</span></a></li>
<li class="toclevel-1 tocsection-16"><a href="#Simple_sumator_.28sum.29"><span class="tocnumber">16</span> <span class="toctext">Simple sumator (sum)</span></a></li>
<li class="toclevel-1 tocsection-17"><a href="#Sum_with_division_.28sum_div.29"><span class="tocnumber">17</span> <span class="toctext">Sum with division (sum_div)</span></a></li>
<li class="toclevel-1 tocsection-18"><a href="#Sum_and_multiplicating_.28sum_mult.29"><span class="tocnumber">18</span> <span class="toctext">Sum and multiplicating (sum_mult)</span></a></li>
<li class="toclevel-1 tocsection-19"><a href="#User_programming_API"><span class="tocnumber">19</span> <span class="toctext">User programming API</span></a></li>
</ul>
</div>

<h2><span class="mw-headline" id="Alarm_.28alarm.29"><span class="mw-headline-number">1</span> Alarm (alarm)</span></h2>
<p><i>Description:</i> Setting an alarm sign in case of exceeding of the variable for the specified boundary.<br />
<i>Formula:</i> 
</p>
<pre style="white-space: pre-wrap;">
out = if(val&gt;max || val&lt;min) true; else false;</pre>
<h2><span class="mw-headline" id="Condition_.27.3C.27_.28cond_lt.29"><span class="mw-headline-number">2</span> Condition '&lt;' (cond_lt)</span></h2>
<p><i>Description:</i> Operation of the branching according to the condition "less."<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = if(in1&lt;(in2_1*in2_2*in2_3*in2_4)) in3_1*in3_2*in3_3*in3_4;
      else in4_1*in4_2*in4_3*in4_4;</pre>
<h2><span class="mw-headline" id="Condition_.27.3E.27_.28cond_gt.29"><span class="mw-headline-number">3</span> Condition '&gt;' (cond_gt)</span></h2>
<p><i>Description:</i> Operation of the branching according to the condition "great".<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = if(in1&gt;(in2_1*in2_2*in2_3*in2_4)) in3_1*in3_2*in3_3*in3_4;
      else in4_1*in4_2*in4_3*in4_4;</pre>
<h2><span class="mw-headline" id="Full_condition_.28cond_full.29"><span class="mw-headline-number">4</span> Full condition (cond_full)</span></h2>
<p><i>Description:</i> Full condition check including great, less and equal.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = if(in1&lt;(in2_1*in2_2*in2_3*in2_4)) in3_1*in3_2*in3_3*in3_4;
      else if( in1&gt;(in4_1*in4_2*in4_3*in4_4) in5_1*in5_2*in5_3*in5_4;
      else in6_1*in6_2*in6_3*in6_4;</pre>
<h2><span class="mw-headline" id="Discrete_block_.28digitBlock.29"><span class="mw-headline-number">5</span> Discrete block (digitBlock)</span></h2>
<p><i>Description:</i> The function contains a control algorithm for the collection of discrete signals for latches and pumps that contain: signs "Opened", "Closed", and commands "Open", "Close", and "Stop". The function supports the operation of pulsed commands, that is it can take a signal within a specified time interval.<br />
<i>Parameters:</i>
</p>
<table class="wikitable">

<tr>
<th> Identifier </th>
<th> Parameter </th>
<th> Type </th>
<th> Mode
</th></tr>
<tr>
<td> cmdOpen </td>
<td> Command "Open" </td>
<td> Bool </td>
<td> Output
</td></tr>
<tr>
<td> cmdClose </td>
<td> Command "Close" </td>
<td> Bool </td>
<td> Output
</td></tr>
<tr>
<td> cmdStop </td>
<td> Command "Stop" </td>
<td> Bool </td>
<td> Output
</td></tr>
<tr>
<td> stOpen </td>
<td> State "Opened" </td>
<td> Bool </td>
<td> Input
</td></tr>
<tr>
<td> stClose </td>
<td> State "Closed" </td>
<td> Bool </td>
<td> Input
</td></tr>
<tr>
<td> tCmd </td>
<td> Time of commands holding, seconds </td>
<td> Integer </td>
<td> Input
</td></tr>
<tr>
<td> frq </td>
<td> Frequency of the calculating, Hz </td>
<td> Integer </td>
<td> Input
</td></tr></table>
<h2><span class="mw-headline" id="Division_.28div.29"><span class="mw-headline-number">6</span> Division (div)</span></h2>
<p><i>Description:</i> Divides assemblies of variables.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = (in1_1*in1_2*in1_3*in1_4*in1_5 + in2_1*in2_2*in2_3*in2_4*in2_5 + in3) /
      (in4_1*in4_2*in4_3*in4_4*in4_5 + in5_1*in5_2*in5_3*in5_4*in5_5 + in6);</pre>
<h2><span class="mw-headline" id="Exponent_.28exp.29"><span class="mw-headline-number">7</span> Exponent (exp)</span></h2>
<p><i>Description:</i> Calculate an exponent over a group of variables.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = exp (in1_1*in1_2*in1_3*in1_4*in1_5 + (in2_1*in2_2*in2_3*in2_4*in2_5+in3) /
          (in4_1*in4_2*in4_3*in4_4*in4_5+in5) )</pre>
<h2><span class="mw-headline" id="Flow_.28flow.29"><span class="mw-headline-number">8</span> Flow (flow)</span></h2>
<p><i>Description:</i> Calculation of the gas flow.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
f = K1*((K3+K4*x)^K2);</pre>
<h2><span class="mw-headline" id="Iterator_.28increment.29"><span class="mw-headline-number">9</span> Iterator (increment)</span></h2>
<p><i>Description:</i> Iterative calculation with the increment specifying, gain ratio for different directions is different.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = if( in1 &gt; in2 ) in2 + in3*(in1-in2); 
      else in2 - in4*(in2-in1);</pre>
<h2><span class="mw-headline" id="Lag_.28lag.29"><span class="mw-headline-number">10</span> Lag (lag)</span></h2>
<p><i>Description:</i> Delay of the change of a variable, practically it is a filter without binding to time.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
y = y - Klag*( y - x );</pre>
<h2><span class="mw-headline" id="Simple_multiplication_.28mult.29"><span class="mw-headline-number">11</span> Simple multiplication (mult)</span></h2>
<p><i>Description:</i> Simple multiplication with division.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = (in1_1*in1_2*in1_3*in1_4*in1_5*in1_6)/
      (in2_1*in2_2*in2_3*in2_4);</pre>
<h2><span class="mw-headline" id="Multiplication_and_division_.28multDiv.29"><span class="mw-headline-number">12</span> Multiplication and division (multDiv)</span></h2>
<p><i>Description:</i> Branched multiplication and division.<br />
<i>Formula:</i> 
</p>
<pre style="white-space: pre-wrap;">
out = in1_1*in1_2*in1_3*in1_4*in1_5*
      (in2_1*in2_2*in2_3*in2_4*in2_5+(in3_1*in3_2*in3_3*in3_4*in3_5)/
      (in4_1*in4_2*in4_3*in4_4*in4_5));</pre>
<h2><span class="mw-headline" id="PID_regulator_.28pid.29"><span class="mw-headline-number">13</span> <span id="PID" title="#PID">PID regulator (pid)</span></span></h2>
<p><i>Description:</i> Proportional-integral-differential regulator.<br />
<i>Parameters:</i>
</p>
<table class="wikitable">

<tr>
<th> Identifier </th>
<th> Parameter </th>
<th> Type </th>
<th> Mode </th>
<th> By defaults
</th></tr>
<tr>
<td> var </td>
<td> Variable </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> sp </td>
<td> Setpoint </td>
<td> Real </td>
<td> Output </td>
<td> 0
</td></tr>
<tr>
<td> max </td>
<td> Maximum of the scale </td>
<td> Real </td>
<td> Input </td>
<td> 100
</td></tr>
<tr>
<td> min </td>
<td> Minimum of the scale </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> manIn </td>
<td> Manual input,&nbsp;% </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> out </td>
<td> Out,&nbsp;% </td>
<td> Real </td>
<td> Return </td>
<td> 0
</td></tr>
<tr>
<td> auto </td>
<td> Auto mode </td>
<td> Bool </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> casc </td>
<td> Cascade mode </td>
<td> Bool </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> Kp </td>
<td> Kp </td>
<td> Real </td>
<td> Input </td>
<td> 1
</td></tr>
<tr>
<td> Ti </td>
<td> Ti, milliseconds </td>
<td> Integer </td>
<td> Input </td>
<td> 1000
</td></tr>
<tr>
<td> Kd </td>
<td> Kd </td>
<td> Real </td>
<td> Input </td>
<td> 1
</td></tr>
<tr>
<td> Td </td>
<td> Td, milliseconds </td>
<td> Integer </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> Tzd </td>
<td> Td lag, milliseconds </td>
<td> Integer </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> Hup </td>
<td> Upper limit of the out,&nbsp;% </td>
<td> Real </td>
<td> Input </td>
<td> 100
</td></tr>
<tr>
<td> Hdwn </td>
<td> Lower limit of the out,&nbsp;% </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> Zi </td>
<td> Insensitivity,&nbsp;% </td>
<td> Real </td>
<td> Input </td>
<td> 1
</td></tr>
<tr>
<td> followSp </td>
<td> Follow setpoint from variable on the manual mode </td>
<td> Bool </td>
<td> Input </td>
<td> 1
</td></tr>
<tr>
<td> K1 </td>
<td> K input 1 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> in1 </td>
<td> Input 1 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> K2 </td>
<td> K input 2 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> in2 </td>
<td> Input 2 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> K3 </td>
<td> K input 3 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> in3 </td>
<td> Input 3 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> K4 </td>
<td> K input 4 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> in4 </td>
<td> Input 4 </td>
<td> Real </td>
<td> Input </td>
<td> 0
</td></tr>
<tr>
<td> f_frq </td>
<td> Frequency of the calculating, Hz </td>
<td> Real </td>
<td> Input </td>
<td> 1
</td></tr></table>
<p><i>Structure:</i><br />
<a class="image" href="http://oscada.org/wiki/File:FLibComplex1_PID.png"><img alt="FLibComplex1 PID.png" height="319" src="../files/FLibComplex1_PID.png" width="800" /></a>
</p>
<h2><span class="mw-headline" id="Power_.28pow.29"><span class="mw-headline-number">14</span> Power (pow)</span></h2>
<p><i>Description:</i> Raising to the power<br />
<i>Formula:</i> 
</p>
<pre style="white-space: pre-wrap;">
out = (in1_1*in1_2*in1_3*in1_4*in1_5)^
      (in2_1*in2_2*in2_3*in2_4*in2_5 + (in3_1*in3_2*in3_3*in3_4*in3_5)/
      (in4_1*in4_2*in4_3*in4_4*in4_5));</pre>
<h2><span class="mw-headline" id="Selection_.28select.29"><span class="mw-headline-number">15</span> Selection (select)</span></h2>
<p><i>Description:</i> Choose one from the four options.<br />
<i>Formula:</i> 
</p>
<pre style="white-space: pre-wrap;">
out = if(sel = 1) in1_1*in1_2*in1_3*in1_4;
      if(sel = 2) in2_1*in2_2*in2_3*in2_4;
      if(sel = 3) in3_1*in3_2*in3_3*in3_4;
      if(sel = 4) in4_1*in4_2*in4_3*in4_4;</pre>
<h2><span class="mw-headline" id="Simple_sumator_.28sum.29"><span class="mw-headline-number">16</span> Simple sumator (sum)</span></h2>
<p><i>Description:</i> Simple sumator with multiplication.<br />
<i>Formula:</i> 
</p>
<pre style="white-space: pre-wrap;">
out = in1_1*in1_2+in2_1*in2_2+in3_1*in3_2+in4_1*in4_2
      + in5_1*in5_2+in6_1*in6_2+in7_1*in7_2+in8_1*in8_2;</pre>
<h2><span class="mw-headline" id="Sum_with_division_.28sum_div.29"><span class="mw-headline-number">17</span> Sum with division (sum_div)</span></h2>
<p><i>Description:</i> Sum with division of values group.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = in1_1*in1_2*(in1_3+in1_4/in1_5) + 
      in2_1*in2_2*(in2_3+in2_4/in2_5) +
      in3_1*in3_2*(in3_3+in3_4/in3_5) + 
      in4_1*in4_2*(in4_3+in4_4/in4_5);</pre>
<h2><span class="mw-headline" id="Sum_and_multiplicating_.28sum_mult.29"><span class="mw-headline-number">18</span> Sum and multiplicating (sum_mult)</span></h2>
<p><i>Description:</i> Sum with multiplication of values group.<br />
<i>Formula:</i>
</p>
<pre style="white-space: pre-wrap;">
out = in1_1*in1_2*(in1_3*in1_4+in1_5) + 
      in2_1*in2_2*(in2_3*in2_4+in2_5) +
      in3_1*in3_2*(in3_3*in3_4+in3_5) + 
      in4_1*in4_2*(in4_3*in4_4+in4_5);</pre>
<h2><span class="mw-headline" id="User_programming_API"><span class="mw-headline-number">19</span> User programming API</span></h2>
<p>The module, as an object, provides user programming functions.
</p><p><b>The object "Functions library" (SYS.Special.FLibComplex1)</b>
</p>
<ul><li> <i>ElTp {funcID}(ElTp prm1, ...)</i> — call the library function <i>{funcID}</i>. Return result of the called function.</li></ul>
<p><b>The object "User function" (SYS.Special.FLibComplex1["funcID"])</b>
</p>
<ul><li> <i>ElTp call(ElTp prm1, ...)</i> — call the function with parameters <i>prm{N}</i>. Return result of the called function.</li></ul>






</div><table style="border-top: dotted 2px #999999; margin-top: 20pt; color: gray;" width="100%"><tr><td style="text-align: left;" width="40%"><a href="http://oscada.org/wiki/Modules/FLibComplex1/en">Modules/FLibComplex1/en</a> - <a href="http://oscada.org/en/main/about-the-project/licenses/">GFDL</a></td><td style="text-align: center;">April 2025</td><td style="text-align: right;" width="40%">OpenSCADA 1+r3018</td></tr></table></body>
</html>