<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / REXLANG dynamically assign variable by looping thru txt file]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=118&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=118"/>
	<updated>2016-05-24T09:27:10Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=118</id>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=669#p669"/>
		<content type="html"><![CDATA[<p>Hey coldh2odvr,</p><p>I&#039;m glad that I could help you. I have one more tip for you.</p><p>We have recently launched Indiegogo campaign with an add-on board for Raspberry Pi called Monarco. It can help you to interface your pressure gauge directly to Raspberry Pi thanks to analog inputs. Check the <a href="https://igg.me/at/monarcohat" rel="nofollow">Monarco HAT campaign</a> site for more detail about the product.</p><p>I also prepared a sample project for you on how to compute the pressure in REX according to the formula from your previous post:</p><div class="quotebox"><cite>coldh2odvr wrote:</cite><blockquote><div><p>P(mTorr) = 10^((V-2.448)/1.286)</p></div></blockquote></div><p><span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/39/pressure.png" alt="pressure.png" /></span></p><p><a href="https://www.rexygen.com/oldforum/img/members/39/pressure_measurement.zip" rel="nofollow">pressure_measurement.zip</a></p><p>Please feel free to contact me if you need any further information.</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-05-24T09:27:10Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=669#p669</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=666#p666"/>
		<content type="html"><![CDATA[<p>Hi Tomas,</p><p>Thanks for the WinSCP tip <em>very</em> helpful.</p>]]></content>
		<author>
			<name><![CDATA[coldh2odvr]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=56</uri>
		</author>
		<updated>2016-05-20T18:32:03Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=666#p666</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=665#p665"/>
		<content type="html"><![CDATA[<div class="quotebox"><cite>jaroslav_sobota wrote:</cite><blockquote><div><p>But RexCore runs with root privileges so it can access the file without any problem on both machines. Therefore the only problem was that your file was empty. The question is why? How did you download the example and transfer the files to the RPi?</p></div></blockquote></div><p>I used the compile and download function in RexDraw. Since the files appeared on the Pi, I assumed it was transferring them while sending the program.</p><div class="quotebox"><cite>jaroslav_sobota wrote:</cite><blockquote><div><p>Btw what pressure gauge are you using? What analog signal does it provide?</p></div></blockquote></div><p>I&#039;m reading from an Inficon PSG 500, it outputs a 0-10V signal where P(mTorr) = 10^((V-2.448)/1.286). The PLC reads voltage but can&#039;t do the exponentials needed to do the conversion to mTorr, hence the lookup table. I&#039;m not currently controlling anything with the gauge but I need a pressure display.</p>]]></content>
		<author>
			<name><![CDATA[coldh2odvr]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=56</uri>
		</author>
		<updated>2016-05-20T18:30:26Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=665#p665</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=663#p663"/>
		<content type="html"><![CDATA[<div class="quotebox"><cite>scoobsalamander wrote:</cite><blockquote><div><p>I&#039;m sorry, I should have told that I&#039;m running everything on Windows now ... <img src="http://www.rexygen.com/oldforum/img/smilies/sad.png" width="15" height="15" alt="sad" /></p></div></blockquote></div><p>That&#039;s perfectly fine - it should be working on Windows as well <img src="http://www.rexygen.com/oldforum/img/smilies/wink.png" width="15" height="15" alt="wink" /> </p><p>On Windows machine the current look up directory is set to ProgramDara directory e.g.</p><div class="codebox"><pre><code>C:\ProgramData\REX Controls\REX_2_10_8_5910\RexCore\</code></pre></div><p>so the &quot;values.txt&quot; file should be stored here. Then the example should be working as well.</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-05-20T14:53:08Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=663#p663</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=661#p661"/>
		<content type="html"><![CDATA[<p>Hey coldh2odvr,</p><p>good to hear that your project is working now! Good work!</p><p>As you had difficulties with downloading files to your Raspberry Pi you might find useful tool called <a href="http://winscp.net/eng/index.php" rel="nofollow">WinSCP</a>. However be sure to grant WinSCP root rights (more details about <a href="https://winscp.net/eng/docs/faq_su#use_sudo_on_login" rel="nofollow"> setup root rights to WinSCP</a>).</p><p>Good luck with your HMI!</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-05-20T14:29:22Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=661#p661</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=662#p662"/>
		<content type="html"><![CDATA[<p>coldh2odvr: In your case the pi user is not allowed to read the file /rex/rexcore/values.txt, see the line</p><div class="codebox"><pre><code>-rw-r----- 1 root root    0 May  5 17:10 values.txt</code></pre></div><p>in your output. In that case you have to use &quot;sudo cat ...&quot;.</p><p>In my case the pi user can at least read the file, see my output:</p><div class="codebox"><pre><code>-rw-r--r-- 1 root root 1682 May  5 14:15 values.txt</code></pre></div><p>But RexCore runs with root privileges so it can access the file without any problem on both machines. Therefore the only problem was that your file was empty. The question is why? How did you download the example and transfer the files to the RPi?</p><p>Btw what pressure gauge are you using? What analog signal does it provide?</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-05-20T14:29:22Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=662#p662</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=655#p655"/>
		<content type="html"><![CDATA[<p>Success (or at least a work around). What I know about Linux wouldn&#039;t fill the back of a stamp, but I&#039;m learning. Since I couldn&#039;t open the text file I searched the web on permissions and changed the permissions on the rex folder so I could read and write. Once I was finally able to open the text files I found they were empty. I thought the new permissions might be all that Rex needed to write the new files but they still came over empty. Finally, I created the files on the rPi directly and the program works like a charm! Cleaned up my original program and, with the locally written lookup table, I can read my pressure gauge. </p><p>Gauge -(analog)-&gt; DL250 PLC -(scaled voltage, BCD, TCP/IP)-&gt; DL260 -(modbus)-&gt;rPi -(convert from BCD to decimal, read mTorr from lookup table)-&gt; HMI. Pretty convoluted but it works. Now it&#039;s time to work on the HMI!</p>]]></content>
		<author>
			<name><![CDATA[coldh2odvr]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=56</uri>
		</author>
		<updated>2016-05-19T23:34:57Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=655#p655</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=652#p652"/>
		<content type="html"><![CDATA[<p>Here&#039;s what I get:</p><p>pi@raspberrypi:~ $ uname -a<br />Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux</p><p>pi@raspberrypi:~ $ cat /etc/*-release<br />PRETTY_NAME=&quot;Raspbian GNU/Linux 8 (jessie)&quot;<br />NAME=&quot;Raspbian GNU/Linux&quot;<br />VERSION_ID=&quot;8&quot;<br />VERSION=&quot;8 (jessie)&quot;<br />ID=raspbian<br />ID_LIKE=debian<br />HOME_URL=&quot;http://www.raspbian.org/&quot;<br />SUPPORT_URL=&quot;http://www.raspbian.org/RaspbianForums&quot;<br />BUG_REPORT_URL=&quot;http://www.raspbian.org/RaspbianBugs&quot;</p><p>pi@raspberrypi:~ $ RexCore -v<br />RexCore version: 2.10.8 revision 5910</p><p>pi@raspberrypi:~ $ ls -l /rex/rexcore<br />total 8<br />-rw-r--r-- 1 root root 1986 May 19 09:52 exec.rex<br />-rw-r----- 1 root root&#160; &#160; 0 May 18 17:14 readfile_rexlang.dat<br />-rw-r----- 1 root root&#160; &#160; 0 May 18 17:14 readfile_task.REXLANG.dat<br />-rw-r----- 1 root root&#160; &#160; 0 May&#160; 5 16:17 Rexfile.dat<br />-rw-r----- 1 root root&#160; &#160; 0 May 12 10:10 Rexfile.txt<br />-rw-r----- 1 root root&#160; &#160; 0 May&#160; 5 16:21 Rexlang.dat<br />-rw-r----- 1 root root&#160; &#160;25 May 10 17:50 Rexlang.txt<br />-rw-r----- 1 root root&#160; &#160; 0 May&#160; 5 17:10 values.txt</p><p>pi@raspberrypi:~ $ cat /rex/rexcore/values.txt<br />cat: /rex/rexcore/values.txt: Permission denied</p><p>That last line looks a bit suspicious...</p><p>I tried scoobsalamander&#039;s 7 with no change.</p>]]></content>
		<author>
			<name><![CDATA[coldh2odvr]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=56</uri>
		</author>
		<updated>2016-05-19T17:07:43Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=652#p652</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=651#p651"/>
		<content type="html"><![CDATA[<p>I&#039;m sorry, I should have told that I&#039;m running everything on Windows now until I&#039;m back home again....no RasPi for me the coming two weeks... <img src="http://www.rexygen.com/oldforum/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2016-05-19T16:21:54Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=651#p651</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=650#p650"/>
		<content type="html"><![CDATA[<div class="quotebox"><cite>scoobsalamander wrote:</cite><blockquote><div><p>I also tried the &#039;REXLANG Reading values from file&#039; but without success.</p></div></blockquote></div><p>Well this is something we should figure out prior to anything else. Can we please focus on this example and find out what is wrong here? Can you please run the following commands on your RPi and post here the output?</p><div class="codebox"><pre><code>uname -a</code></pre></div><div class="codebox"><pre><code>cat /etc/*-release</code></pre></div><div class="codebox"><pre><code>RexCore -v</code></pre></div><div class="codebox"><pre><code>ls -l /rex/rexcore</code></pre></div><div class="codebox"><pre><code>cat /rex/rexcore/values.txt</code></pre></div><p>Here is my output:</p><div class="codebox"><pre class="vscroll"><code>pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.4.9-v7+ #884 SMP Fri May 6 17:28:59 BST 2016 armv7l GNU/Linux

pi@raspberrypi:~ $ cat /etc/*-release
PRETTY_NAME=&quot;Raspbian GNU/Linux 8 (jessie)&quot;
NAME=&quot;Raspbian GNU/Linux&quot;
VERSION_ID=&quot;8&quot;
VERSION=&quot;8 (jessie)&quot;
ID=raspbian
ID_LIKE=debian
HOME_URL=&quot;http://www.raspbian.org/&quot;
SUPPORT_URL=&quot;http://www.raspbian.org/RaspbianForums&quot;
BUG_REPORT_URL=&quot;http://www.raspbian.org/RaspbianBugs&quot;

pi@raspberrypi:~ $ RexCore -v
RexCore version: 2.10.8 revision 5910

pi@raspberrypi:~ $ ls -l /rex/rexcore
total 8
-rw-r--r-- 1 root root 1986 May 19 14:20 exec.rex
-rw-r--r-- 1 root root 1682 May  5 14:15 values.txt

pi@raspberrypi:~ $ cat /rex/rexcore/values.txt
0
0.049979169
0.099833417
0.149438132
...
-0.083089403
-0.033179217
pi@raspberrypi:~ $</code></pre></div><p>Thanks a lot for your cooperation, this is a real mystery...</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-05-19T14:27:10Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=650#p650</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=649#p649"/>
		<content type="html"><![CDATA[<p>I also tried the &#039;REXLANG Reading values from file&#039; but without success.</p><br /><p>Then I&#039;ve been fooling around a little and suddenly I could read a text file with the name rexlang<strong>.dat</strong> with the following function </p><div class="codebox"><pre><code>value = LoadValue(7,-1);</code></pre></div>]]></content>
		<author>
			<name><![CDATA[scoobsalamander]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=6</uri>
		</author>
		<updated>2016-05-18T20:08:29Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=649#p649</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=648#p648"/>
		<content type="html"><![CDATA[<p>Hi Tomas,</p><p>I compiled and ran the example (no changes, no modbus stuff), no Code 27 error this time. Still not reading the text file. I set u0 (read) to 1 and y0 (value) remains 0. I edited values.txt and changed the first line from 0 to 17 (no reason for 17 other than a random non-zero) and y0 still reads 0. I added an output y1 (state) and set the value in the if statement, it responds appropriately to changes in u0.</p><p>REX version 2.10.8, Rev 5910, Date 2016-02-28.<br />Device arm, OS Linux 3.x </p><p>System log<br />date;time;severity;message;&#160; &#160; <br />2016-05-18;09:24:28.326;Verbose;Waiting for command ...;&#160; &#160; <br />2016-05-18;09:24:29.276;Verbose;IntpArcRead;&#160; &#160; <br />2016-05-18;09:24:29.276;Verbose;Waiting for command ...;&#160; &#160; <br />2016-05-18;09:24:29.276;Verbose;IntpTrndRead;&#160; &#160; <br />2016-05-18;09:24:29.276;Verbose;IntpTrndRead: No more archive items&#160; &#160;&#160; nBytes = 414;<br />2016-05-18;09:24:29.276;Verbose;Waiting for command ...;&#160; &#160; <br />2016-05-18;09:24:29.276;Verbose;IntpGetExecDgn;&#160; &#160; <br />... repeats</p><p>I&#039;ve tried to open the text file on the rPi itself but get a don&#039;t have permission error. I&#039;m assuming it&#039;s locked by Rex?</p><p>Thoughts?</p>]]></content>
		<author>
			<name><![CDATA[coldh2odvr]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=56</uri>
		</author>
		<updated>2016-05-18T16:50:55Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=648#p648</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=646#p646"/>
		<content type="html"><![CDATA[<p>Hey coldh2odvr,</p><p>have you tried to run the example <a href="https://www.rexcontrols.cz/forum/img/members/3/REXLANG_Reading_values_from_file.zip" rel="nofollow">REXLANG Reading values from file</a> itself? Just want to eliminate any other influences (e.g. Modbus, ...) in order to test the functionality of reading values from file.</p><p>Looking forward to hearing from 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-05-17T11:55:04Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=646#p646</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=637#p637"/>
		<content type="html"><![CDATA[<p>Still no dice, changing from 0 to non-zero on u0 (using a constant) changes the y1 output but only 0&#039;s from y0. I&#039;m using Notepad in Windows to generate the text file, any chance there&#039;s something wrong with the way it formats the file? I double checked and the text file is in the \rex\rexcore folder. Also can&#039;t get the demo to run due to the Code 27 error.</p><p>PS. Thanks for all the help, you guys are awesome!</p>]]></content>
		<author>
			<name><![CDATA[coldh2odvr]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=56</uri>
		</author>
		<updated>2016-05-13T14:55:10Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=637#p637</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Re: REXLANG dynamically assign variable by looping thru txt file]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=636#p636"/>
		<content type="html"><![CDATA[<p>Hey coldh2odvr,</p><p>please, can you try to connect a constant to the &quot;REXLANG&quot; input as seen in the screenshot below? Because this setup works for me.<br />Once you change the constant to something &quot;&gt;0&quot; &quot;REXLANG&quot; should output the tenth item of your text file.</p><p><span class="postimg"><img src="https://www.rexygen.com/oldforum/img/members/39/rexlang_read.png" alt="rexlang_read.png" /></span></p><p>Let me know if you made it work.</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-05-13T09:27:59Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=636#p636</id>
	</entry>
</feed>
