<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / what am I doing wrong]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=174&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=174"/>
	<updated>2016-06-25T11:18:28Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=174</id>
	<entry>
		<title type="html"><![CDATA[Re: what am I doing wrong]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=753#p753"/>
		<content type="html"><![CDATA[<p>Glad I could help. Good luck with your project!</p><p>Cheers, Tomas</p>]]></content>
		<author>
			<name><![CDATA[tomáš čechura]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=39</uri>
		</author>
		<updated>2016-06-25T11:18:28Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=753#p753</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: what am I doing wrong]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=752#p752"/>
		<content type="html"><![CDATA[<p>Thanks it work</p>]]></content>
		<author>
			<name><![CDATA[martijnperdaan]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=82</uri>
		</author>
		<updated>2016-06-25T10:06:25Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=752#p752</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: what am I doing wrong]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=749#p749"/>
		<content type="html"><![CDATA[<p>Hi martijnperdaan,</p><p>I tried to run your REXLANG script and it works for me. However when the <em>value12</em> is zero the REXLANG block sets <em>iE</em> output to<em>&quot;-501: Division by zero&quot;</em> and the <em>sum1</em> is set to zero as well. This can be the reason why the approach with <em>&quot;+ value12&quot;</em> instead of division works.</p><p>You need to ensure that the <em>value12</em> input is non-zero. This can be done by adding one more <em>if</em> statement in your code:</p><div class="codebox"><pre><code>if (value12 != 0)
{
  sum1 = (value1 * weerfactor) / value12;
} </code></pre></div><p>I hope the above is useful to you.</p><p>Regards, Tomas</p>]]></content>
		<author>
			<name><![CDATA[tomáš čechura]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=39</uri>
		</author>
		<updated>2016-06-24T21:39:50Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=749#p749</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: what am I doing wrong]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=747#p747"/>
		<content type="html"><![CDATA[<p>this is the script of a REXLANG fuction blok</p>]]></content>
		<author>
			<name><![CDATA[martijnperdaan]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=82</uri>
		</author>
		<updated>2016-06-24T14:58:40Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=747#p747</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[what am I doing wrong]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=746#p746"/>
		<content type="html"><![CDATA[<p>in the script below i want toe calculate sum1 but when i want to (value * weerfactor) divide by value 12 it does not work<br />but when i (value * weerfactor) + value 12 is works</p><p>can someone tell me wat i am doing wrong ?</p><br /><p>/***************************************<br />*<br />* Minimal REXLANG example<br />*<br />****************************************/&#160; &#160;</p><p>//assigning inputs to variables, these variables are READ-ONLY<br />long input(0) value1; //mav ventilatie<br />double input(1) value2; // buitentemp<br />double input(2) value3; //mintemplaag<br />double input(3) value4; //mintemphoog<br />double input(4) value5; //mintempvermenigvuldigen<br />double input(5) value6; //gemiddeldtemplaag<br />double input(6) value7; //gemiddeldtemphoog<br />double input(7) value8; //gemiddeldtempvermenigvuldigen<br />double input(8) value9; //maxtemplaag<br />double input(9) value10; //maxtemphoog<br />double input(10) value11; //maxtempvermenigvuldigen<br />long input(11) value12; //bandbreete<br />double input(12) value13; //tempstal<br />long input(13) value14; //streeftemp<br />long input(14) value15; // min ventilatie</p><br /><br /><p>//assigning variables to outputs, these variables are WRITE-ONLY<br />double output(2) sum1;<br />double output(3) weerfactor;</p><p>//the init procedure is executed once when the REXLANG function block initializes<br />long init(void)<br />{<br />&#160; return 0;<br />}</p><p>//the main procedure is executed once in each sampling period<br />long main(void)<br />{<br />&#160; <br />&#160; if (value2 &gt;= value3)<br />&#160; {<br />&#160; &#160; if (value2 &lt;= value4)<br />&#160; &#160; &#160; &#160; {<br />&#160; &#160; &#160; &#160; weerfactor = value5;<br />&#160; &#160; &#160; &#160; }<br />&#160; }<br />&#160; <br />&#160; if (value2 &gt;= value6)<br />&#160; {<br />&#160; &#160; if (value2 &lt;= value7)<br />&#160; &#160; &#160; &#160; {<br />&#160; &#160; &#160; &#160; weerfactor = value8;<br />&#160; &#160; &#160; &#160; }<br />&#160; }<br />&#160; <br />&#160; if (value2 &gt;= value9)<br />&#160; {<br />&#160; &#160; if (value2 &lt;= value10)<br />&#160; &#160; &#160; &#160; {<br />&#160; &#160; &#160; &#160; weerfactor = value11;<br />&#160; &#160; &#160; &#160; }<br />&#160; }<br />&#160; <br />&#160; sum1 = (value1 * weerfactor) / value12;<br />&#160; return 0;<br />}</p><p>//the exit procedure is executed once when the task is correctly terminated<br />// (system shutdown, downloading new control algorithm, etc.)<br />long exit(void)<br />{<br />&#160; return 0;<br />}</p>]]></content>
		<author>
			<name><![CDATA[martijnperdaan]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=82</uri>
		</author>
		<updated>2016-06-24T14:57:39Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=746#p746</id>
	</entry>
</feed>
