Installation guide: Process and Operator station on the Raspberry Pi

From Proview Wiki
Revision as of 07:09, 31 July 2013 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1) Install Ubuntu 12.10 desktop OS on the development (virtual) machine:
</dt>
Host system is Microsoft Windows 7 Ultimate 64 bit, fully patched, 2 socket XeonE5620, 32GB RAM  ::VM environment is Oracle VM VirtualBox 4.2.6r82870 with Extension Pack hosted on above </dd>
Create virtual machine (VM): 4GB RAM, 30GB disk, bridged network adaptor, enable 3D accel, no floppy boot, bidir clipboard, shared folder to pwr docs, otherwise defaults </dd>
Boot the iso on the VM </dd>
English, install ubuntu </dd>
Download updates while installing </dd>
Install this third party software </dd>
Erase disk and install ubuntu </dd>
Chicago </dd>
English (us), english (us) </dd>
Hostname pwrDevel </dd>
Require login pw </dd>
Restart

</dd>
</dd>
2) Patch the install
</dt>
sudo apt-get update </dd>
sudo apt-get dist-upgrade </dd>
restart (for new kernel)

</dd>
</dd>
3) Install virtualbox tools
</dt>
sudo apt-get install linux-headers-generic dkms build-essential </dd>
From vbox menu pick: Devices | Install Guest Additions </dd>
Allow autorun prompt to procede, authenticate </dd>
Restart
</dd>
</dd>

 

4) Minimize annoyances

</dt>
Get rid of advertising and the global menu </dd>
sudo apt-get remove unity-lens-shopping appmenu-gtk appmenu-gtk3 appmenu-qt </dd>
Launch firefox, disable 'global menu integration' extension </dd>
Logout, log back in
</dd>
</dd>
turn off spyware
</dd>
</dd>
launch "System Settings | Privacy" </dd>
pick "Search Results," pick "Include online search results: Off" </dd>
pick "Diagnostics", uncheck "Send error reports to Canonical", pick "Record Activity: OFF" </dd>
sudo add-apt-repository ppa:tualatrix/ppa </dd>
sudo add-apt-repository ppa:satyajit-happy/themes </dd>
sudo add-apt-repository ppa:indicator-multiload/stable-daily </dd>
sudo apt-get update </dd>
sudo apt-get install gnome-shell synaptic gconf-editor gnome-tweak-tool ubuntu-tweak nautilus-open-terminal
</dd>
</dd>

 

note: accept defaults for gdm
</dd>
</dd>

 

sudo apt-get install orion-gtk-theme indicator-multiload compizconfig-settings-manager </dd>
right click desktop pick "Change Desktop Background", select non-orange and non-purple background </dd>
from Dash, launch "System Load Indicator" </dd>
launch "System Settings | Ubuntu Tweak" </dd>
pick "Tweaks | Miscellaneous", pick "Overlay scrollbars: Normal" </dd>
pick "Tweaks | Theme", pick "Gtk theme: Orion", "Icon theme: gnome", "Window theme: Radiance" </dd>
pick "Tweaks | Desktop Icons", pick "Show Computer", "Show mounted volumes" </dd>
pick "Tweaks | Unity", adjust "Launcher icon size" to not waste so much screen space </dd>
pick "Tweaks | Window", pick "Window control button...: Right"
</dd>
</dd>
from Dash, launch "CompizConfig Settings Manager" </dd>
un-check "Snapping Windows" </dd>
delete unneeded icons from launcher: the "bag", the libre office stuff, the "U"s, the advertising </dd>
add "Terminal" to launcher </dd>
sudo apt-get install geany </dd>
add "Geany" to launcher
</dd>
</dd>

 

5) Install prerequisites for 'Proview build from source code'
</dt>

 

install some packages (note: openssh-server is not really a prerequisite) </dd>
sudo apt-get install make flex libgtk2.0-dev libdb5.1-dev libdb5.1++-dev libasound2-dev doxygen libmysql++-dev xfonts-100dpi openssh-server </dd>
install java JDK </dd>
download tarball from <a class="external free" rel="nofollow" href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html">http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html</a> </dd>
cd /usr/local </dd>
sudo tar -zxvf /home/<userID>/jdk-7u17-linux-x64.tar.gz </dd>
sudo chown -R root:root jdk1.7.0_17/ </dd>
sudo -s </dd>
cd /etc/profile.d </dd>
touch proview.build.sh </dd>
vi proview.build.sh </dd>
insert the following lines: </dd>
export jdk=/usr/local/jdk1.7.0_17 </dd>
export PATH=$PATH:$jdk/bin </dd>
save edited file, exit vi </dd>
exit (from sudo)
</dd>
</dd>

 

6) Install Proview development environment & debug runtime </dt>

 

wget -Opwr48_4.8.6-3.2_amd64.deb <a class="external free" rel="nofollow" href="http://sourceforge.net/projects/proview/files/proview/proview_4.8.6-3/ubuntu_12.10/pwr48_4.8.6-3.2_amd64.deb/download">http://sourceforge.net/projects/proview/files/proview/proview_4.8.6-3/ubuntu_12.10/pwr48_4.8.6-3.2_amd64.deb/download</a> </dd>
sudo dpkg -i pwr48_4.8.6-3.2_amd64.deb </dd>
sudo adduser pwrp sudo </dd>
logout </dd>
login as pwrp </dd>
fix annoyances </dd>
from launcher, pick "System Settings | Brightness and Lock" </dd>
pick "Lock: OFF" </dd>
exit </dd>
cd </dd>
sudo chown pwrp:pwrp Desktop </dd>
install antlr </dd>
wget <a class="external free" rel="nofollow" href="http://www.antlr2.org/download/antlr-2.7.7.tar.gz">http://www.antlr2.org/download/antlr-2.7.7.tar.gz</a> </dd>
tar -zxvf antlr-2.7.7.tar.gz </dd>
geany ~/antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp </dd>
add: #include <strings.h>
  1. include <stdio.h>
</dd>
save changes and exit </dd>
cd ~/antlr-2.7.7 </dd>
./configure </dd>
make </dd>
sudo make install </dd>
change max shared memory </dd>
sudo geany /etc/sysctl.conf </dd>
insert a line at the end: </dd>
kernel.shmmax=67108864 </dd>
save changes, exit geany </dd>
sudo -s </dd>
echo 67108864 > /proc/sys/kernel/shmmax </dd>
exit
</dd>
</dd>

 

 

7)) Install Proview source
</dt>
login as pwrp </dd>
cd </dd>
wget -Opwrsrc_4.8.6-3.2.tar.gz <a class="external free" rel="nofollow" href="http://sourceforge.net/projects/proview/files/proview/proview_4.8.6-3/pwrsrc_4.8.6-3.2.tar.gz/download">http://sourceforge.net/projects/proview/files/proview/proview_4.8.6-3/pwrsrc_4.8.6-3.2.tar.gz/download</a> </dd>
tar -zxvf pwrsrc_4.8.6-3.2.tar.gz
</dd>
</dd>
8) Bake the raspberry pi
</dt>
get the wheezy image 2013-02-09 via torrent </dd>
write to 8 GB Class 10 SD card </dd>
boot </dd>
using the Raspi-config tool: </dd>
expand_rootfs </dd>
configure_keyboard </dd>
English (US) </dd>
English (US) </dd>
The default for the keyboard layout </dd>
No compose key </dd>
Control-Alt-Backspace to terminal X server: No </dd>
change_pass </dd>
change_locale </dd>
en_US.UTF-8 UTF-8 only </dd>
default locale for system environment: none </dd>
change_timezone: US Central </dd>
ssh: Enable </dd>
boot_behavior: No </dd>
Finish </dd>
reboot </dd>
login as pi </dd>
sudo apt-get update </dd>
sudo apt-get dist-upgrade </dd>
sudo apt-get install tightvncserver </dd>
sudo apt-get install libgtk2.0-dev </dd>
sudo rm /etc/ssh/ssh_host_* </dd>
sudo dpkg-reconfigure openssh-server </dd>
sudo adduser pwrp </dd>
use password = 'pwrp' (same as Proview distro default) </dd>
sudo adduser pwrp dialout </dd>
(this is for arduino access) </dd>
sudo visudo </dd>
insert following line under the "root ALL=(ALL) ALL" Line: </dd>
pwrp ALL=(ALL) ALL </dd>
save changes, exit </dd>
sudo nano /etc/security/limits.conf </dd>
insert the following:

  • - rtprio 99
</dd>
save and exit </dd>
sudo nano /etc/pam.d/su </dd>
uncomment line: </dd>
session required pam_limits.so </dd>
save and exit </dd>
(note: this allows the pwr service start to set pwr tasks' realtime priorities) </dd>
(note2: also applies to the pwrp tightvncserver X session, since that is launched with su also) </dd>
sudo nano /etc/init.d/tightvncserver </dd>
insert the following into the new file:
  1. !/bin/sh
  2. /etc/init.d/tightvncserver
</dd>
VNCUSER='pwrp' </dd>
case "$1" in </dd>
start) </dd>
su $VNCUSER -c '/usr/bin/tightvncserver :0 -geometry 1024x768 -depth 24' </dd>
echo "Starting TightVNC Server for $VNCUSER "
</dt>
</dt>
</dd>
</dd>
stop) </dd>
pkill Xtightvnc </dd>
echo "TightVNC Server stopped"
</dt>
</dt>
</dd>
  • )
echo "Usage: /etc/init.d/tightvncserver {start|stop}" </dd>
exit 1
</dt>
</dt>
</dd>
esac </dd>
exit 0 </dd>
save changes, exit nano </dd>
sudo chmod 755 /etc/init.d/tightvncserver </dd>
sudo update-rc.d tightvncserver defaults </dd>
exit (i.e. logout) </dd>
login as pwrp </dd>
mkdir ~/proview </dd>
vncpasswd </dd>
enter and confirm </dd>
no view-only password </dd>
sudo nano /etc/hostname </dd>
change to desired node name (e.g. rpi3) </dd>
save and exit </dd>
cd </dd>
ssh-keygen -t rsa </dd>
cd ~/.ssh </dd>
touch authorized_keys </dd>
chmod 600 authorized_keys </dd>
choose a static IPv4 address </dd>
sudo nano /etc/hosts </dd>
update with hostname and ip </dd>
add any other nodes which will participate in the distributed control system </dd>
sudo nano /etc/network/interfaces </dd>
change eth0 to (substitute actual network values): </dd>
iface eth0 inet static </dd>
address 192.168.0.1 </dd>
netmask 255.255.255.0 </dd>
network 192.168.0.0 </dd>
broadcast 192.168.0.255 </dd>
gateway 192.168.0.254 </dd>
save changes and exit </dd>
sudo shutdown -r now </dd>
login to X desktop using vnc client (to verify X is working)
</dd>
9) Configure ssh access from dev to rpi
logon to dev as pwrp </dd>
</dt>
do this only once: </dd>
ssh-keygen -t rsa </dd>
sudo geany /etc/hosts </dd>
insert line for raspberry pi machine(s) and any other hosts in the distributed system </dd>
save and exit </dd>
scp /home/pwrp/.ssh/id_rsa.pub rpi3:/home/pwrp/.ssh/authorized_keys
</dd>
10) Install cross platform dev tools on dev
</dt>
logon to dev as pwrp </dd>
sudo apt-get install ia32-libs git </dd>
cd </dd>
mkdir rpitools </dd>
cd rpitools </dd>
sudo git clone <a class="external free" rel="nofollow" href="git://github.com/raspberrypi/tools.git">git://github.com/raspberrypi/tools.git</a> </dd>
create symbolic links to compilers and archiver as a workaround on rather long fully qualified names - </dd>
(Proview merge tool has a hardcoded alloc of 80 chars max for the FQ name of each of these tools): </dd>
sudo -s </dd>
ln -s /home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc /usr/bin/arm-gcc </dd>
ln -s /home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ /usr/bin/arm-g++ </dd>
ln -s /home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ar /usr/bin/arm-ar </dd>
exit
</dd>
</dd>
11) Get a copy of the rpi headers and libraries to compile and link against, respectively
</dt>
logon to dev as pwrp </dd>
rsync -avz -e ssh pwrp@rpi3:/usr/include /home/pwrp/rpi </dd>
sudo rsync -avz -e ssh pwrp@rpi3:/usr/lib/arm-linux-gnueabihf /usr/lib </dd>
sudo rsync -avz -e ssh pwrp@rpi3:/lib/arm-linux-gnueabihf /lib
</dd>
</dd>
12) Setup the build environment
</dt>
logon to dev as pwrp </dd>
cd </dd>
geany ~/.envarm </dd>
insert the following into this new file:
  1. .envarm:
  2. env for Proview development for raspberry pi
</dd>
export pwre_cc=/usr/bin/arm-gcc </dd>
export pwre_cxx=/usr/bin/arm-g++ </dd>
export pwre_ar=/usr/bin/arm-ar </dd>
export pwr_host_exe=/usr/pwr48/os_linux/hw_x86_64/exp/exe </dd>
export pwre_host_exe=/usr/pwr48/os_linux/hw_x86_64/exp/exe </dd>
export pwre_env_db=/home/pwrp/pwre_env_db </dd>
export pwre_bin=/home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux </dd>
export pwre_dir_symbols=$pwre_bin/dir_symbols.mk </dd>
export PATH=$PATH:/home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin </dd>
source $pwre_bin/pwre_function </dd>
save and exit </dd>
geany ~/.bashrc </dd>
insert at end of file: </dd>
source ~/.envarm </dd>
save and exit </dd>
close all Terminal(s) </dd>
launch Terminal </dd>
cd </dd>
mkdir pwrrls_4.8.6-3 </dd>
define a PWRE environment for the build: </dd>
pwre add v486_arm </dd>
-- </dd>
-- Environment  : v486_arm </dd>
-- Module.........: rt </dd>
-- Source root....: /home/pwrp/pwrsrc_4.8.6-3/src </dd>
-- Import root....: /usr/pwr48/os_linux/hw_x86_64 </dd>
-- Build root.....: /home/pwrp/pwrrls_4.8.6-3 </dd>
-- Build type.....: dbg </dd>
-- OS.............: linux </dd>
-- Hardware.......: arm </dd>
-- Description....: X48arm </dd>
-- </dd>
himBH
</dd>
</dd>
13) Fixup Proview config script
</dt>
logon to dev as pwrp </dd>
cd /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux </dd>
cp pwre_configure.sh pwre_configure.sh.org </dd>
cd </dd>
geany /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux/pwre_configure.sh </dd>
insert after line 311: </dd>
pwre_config_check_lib gtk GTK gtk gtk 0 "/usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0.so" </dd>
pwre_config_check_include gtk GTK 1 "/home/pwrp/rpi/include/gtk-2.0/gtk/gtk.h" </dd>
as a sanity check, the code block should look like: </dd>
if test $pwre_hw == "hw_arm"; then </dd>
</dd>
pwre_config_check_lib gtk GTK gtk gtk 0 "/usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0.so" </dd>
pwre_config_check_include gtk GTK 1 "/home/pwrp/rpi/include/gtk-2.0/gtk/gtk.h" </dd>
</dd>
</dd>
pwre_config_check_include jni JNI 1 $jdk/include/jni.h </dd>
pwre_config_check_include jni JNI 0 $jdk/include/linux/jni_md.h </dd>
save and exit </dd>
pwre init v486_arm </dd>
pwre configure </dd>
need to figure out some paths, will use the output from "pwre configure" to help, </dd>
this is a little tedious: </dd>
geany /home/pwrp/pwrrls_4.8.6-3/pwre_arm_linux.cnf </dd>
find line "export pwre_conf_libgtk=" </dd>
note the embedded command, e.g. "pkg-config --libs gtk+-2.0", designate as "cmd1" </dd>
find line "export pwre_conf_incdirgtk=" </dd>
note the embedded command, e.g. "pkg-config --cflags gtk+-2.0", designate as "cmd2". the commands will now be run on the rpi: </dd>
ssh rpi3 </dd>
execute cmd1: </dd>
pkg-config --libs gtk+-2.0 </dd>
save the output in a new temp file, e.g. in geany </dd>
execute cmd2: </dd>
pkg-config --cflags gtk+-2.0 </dd>
save the output to the temp file </dd>
exit from ssh session </dd>
in the temp file, replace "usr/include" with "home/pwrp/rpi/include" </dd>
in geany, open /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux/pwre_configure.sh </dd>
find line "export pwre_conf_libgtk=" </dd>
hard-code the contents of that assign to the output of cmd1, e.g.: </dd>
echo "export pwre_conf_libgtk=\"-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0\"" >> $cfile </dd>
find line "export pwre_conf_incdirgtk=" </dd>
hard-code the contents of that assign to the edited output of cmd2, e.g.: </dd>
echo "export pwre_conf_incdirgtk=\"-pthread -I/home/pwrp/rpi/include/gtk-2.0 -I/usr/lib/arm-linux-gnueabihf/gtk-2.0/include -I/home/pwrp/rpi/include/atk-1.0 -I/home/pwrp/rpi/include/cairo -I/home/pwrp/rpi/include/gdk-pixbuf-2.0 -I/home/pwrp/rpi/include/pango-1.0 -I/home/pwrp/rpi/include/gio-unix-2.0/ -I/home/pwrp/rpi/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/home/pwrp/rpi/include/pixman-1 -I/home/pwrp/rpi/include/freetype2 -I/home/pwrp/rpi/include/libpng12 \"" >> $cfile </dd>
find line "echo "export pwre_conf_lib=\"-lpthread -lm -lrt -lcrypt\"" >> $cfile" </dd>
add X11 and db5.1 libraries, e.g.: </dd>
echo "export pwre_conf_lib=\"-lpthread -lm -lrt -lcrypt -lX11 -ldb-5.1\"" >> $cfile </dd>
find line "echo "export pwre_conf_libdir=\"$conf_libdir\"" >> $cfile" </dd>
hard-code the assignment to: </dd>
echo "export pwre_conf_libdir=\"-L/usr/lib/arm-linux-gnueabihf -Wl,-rpath=/usr/lib/arm-linux-gnueabihf -Wl,-rpath=/lib/arm-linux-gnueabihf\"" >> $cfile </dd>
find line "echo "export pwre_conf_incdir=\"$conf_incdir\"" >> $cfile" </dd>
hard-code the assignment to: </dd>
echo "export pwre_conf_incdir=\"-I /home/pwrp/rpi/include -I/usr/local/jdk1.7.0_17/include -I/usr/local/jdk1.7.0_17/include/linux\"" >> $cfile </dd>
save the edited file </dd>
cd </dd>
mkdir pwrCustom </dd>
save the edited file (again) as ~/pwrCustom/pwre_configure.sh.custom </dd>
exit geany
</dd>
</dd>
14) Fixup Proview source tree
</dt>
fix service start script: </dd>
cp /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/pwr ~/pwrCustom </dd>
geany ~/pwrCustom/pwr </dd>
for each of the functions: pwr_start, pwr_stop, pwr_reload, pwr_kill: </dd>
replace the "whoami" conditional test from "root" to "pwrp" </dd>
if using an arduino uno, add the following line within the create_wrapper function, after the umask command: </dd>
echo "stty -F /dev/ttyACM0 10:0:8be:0:3:1c:7f:15:1:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0" >> $wrapper </dd>
save and exit </dd>
fix code error: </dd>
geany /home/pwrp/pwrsrc_4.8.6-3/sev/lib/sev/src/sev_db.cpp </dd>
add open curly brace on line 52: </dd>
else if ( type == sev_eDbType_Sqlite) { </dd>
add close curly brace after line 58. </dd>
code block should now look like: </dd>
if ( type == sev_eDbType_Mysql) {
  1. if defined PWRE_CONF_MYSQL
</dd>
return sev_dbms::open_database();
  1. else
</dd>
printf( "** Release is not built with mysql\n"); </dd>
return 0;
  1. endif
</dd>
} </dd>
else if ( type == sev_eDbType_Sqlite) {
  1. if defined PWRE_CONF_SQLITE3
</dd>
return sev_dbsqlite::open_database();
  1. else
</dd>
printf( "** Release is not built with sqlite3\n"); </dd>
return 0;
  1. endif
</dd>
} </dd>
else </dd>
return 0; </dd>
} </dd>
end example code block </dd>
save the edited file as: </dd>
~/pwrCustom/sev_db.cpp </dd>
exit geany </dd>
edit the build package script, it will not create a *.deb file as-is: </dd>
geany ~/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/build.sh </dd>
"# Create directories" section, insert line: </dd>
mkdir -p $pkgroot/usr/pwrp/adm/db </dd>
uncomment lines which copy op to cnf </dd>
uncomment lines which copy user to cnf </dd>
add following lines to "# Copy user to cnf" section: </dd>
cp $pwre_broot/$pwre_target/exp/inc/pwr_arduino_uno.ino $pkgroot/usr/pwrrt/cnf/user </dd>
cp $pwre_sroot/tools/pkg/deb/adm/proview_icon.png $pkgroot/usr/pwrrt/cnf/user </dd>
cp /home/pwrp/pwrCustom/Proview.desktop $pkgroot/usr/pwrrt/cnf/user </dd>
after the "# Copy user to cnf" section, insert the following lines:
  1. Copy user security data
</dd>
mkdir -p $pkgroot/usr/pwrp/adm/db </dd>
cp $pwre_sroot/tools/pkg/deb/adm/pwr_user2.dat $pkgroot/usr/pwrp/adm/db </dd>
comment out line "dpkg-buildpackage -aarmel -b" </dd>
add following lines: </dd>
packagename=pwrrt-$version.tar.gz </dd>
tar -czf ../$packagename * </dd>
save the edited file as: </dd>
~/pwrCustom/build.sh </dd>
exit geany </dd>
geany ~/pwrCustom/fixPwrSource.sh </dd>
insert the following lines into the new file:
  1. !/bin/bash
  2. fix some missing dependencies
</dd>
cp /home/pwrp/pwrsrc_4.8.6-3/nmps/lib/nmps/src/nmps.h /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_sim/src/ </dd>
cp /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_elog/src/rt_elog.h /home/pwrp/pwrsrc_4.8.6-3/xtt/lib/xtt/src/ </dd>
cp /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_elog/src/rt_elog.h /home/pwrp/pwrsrc_4.8.6-3/xtt/lib/xtt/gtk/ </dd>
cp /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_elog/src/rt_elog.h /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_elog_dump/src </dd>
cp /usr/include/db.h /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_elog_dump/src </dd>
cp /usr/include/db.h /home/pwrp/pwrsrc_4.8.6-3/xtt/lib/xtt/src </dd>
cp /usr/include/db.h /home/pwrp/pwrsrc_4.8.6-3/xtt/lib/xtt/gtk </dd>
</dd>
mkdir /home/pwrp/pwrsrc_4.8.6-3/wb/lib/wb/src/antlr </dd>
cp /home/pwrp/antlr-2.7.7/lib/cpp/antlr/* /home/pwrp/pwrsrc_4.8.6-3/wb/lib/wb/src/antlr </dd>
  1. fix code error
</dd>
cp ~/pwrCustom/sev_db.cpp /home/pwrp/pwrsrc_4.8.6-3/sev/lib/sev/src/sev_db.cpp </dd>
  1. copy build script which creates just a tarball, not a debian package, and includes some custom rpi/arduino specific stuff
</dd>
cp ~/pwrCustom/build.sh /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt </dd>
  1. copy custom pwre_configure.sh
</dd>
cp /home/pwrp/pwrCustom/pwre_configure.sh.custom /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux/pwre_configure.sh </dd>
  1. copy custom pwr service control script
</dd>
cp ~/pwrCustom/pwr /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/ </dd>
save and exit </dd>
chmod 755 ~/pwrCustom/fixPwrSource.sh </dd>
geany ~/pwrCustom/Proview.desktop </dd>
insert the following lines into the new file: </dd>
[Desktop Entry] </dd>
Name=Proview </dd>
Comment=SCADA Operator Station </dd>
Exec=/home/pwrp/.xtt_start </dd>
Icon=proview_icon </dd>
Terminal=false </dd>
Type=Application </dd>
MimeType=text/plain </dd>
Categories=GTK </dd>
save and exit
</dd>
</dd>
15) Final cleanup
</dt>
logon to dev as pwrp </dd>
delete /home/pwrp/pwrsrc_4.8.6-3 (and all contents) </dd>
delete everything from /home/pwrp/pwrrls_4.8.6-3, leaving the folder </dd>
unpack the source (again): </dd>
cd </dd>
tar -zxvf pwrsrc_4.8.6-3.2.tar.gz
</dd>
</dd>
16) Build Proview for raspberry pi
</dt>
logon to dev as pwrp </dd>
cd </dd>
pwre list </dd>
pwre init v486_arm </dd>
./pwrCustom/fixPwrSource.sh </dd>
pwre create_all_modules </dd>
pwre import rt </dd>
pwre import java </dd>
pwre import op </dd>
pwre configure </dd>
./pwrCustom/fixPwrSource.sh </dd>
pwre ebuild rt </dd>
pwre ebuild op </dd>
pwre build tools/pkg deb_armel </dd>
note: to enable pkg rebuild (when make says nothing to do): </dd>
touch /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/control
</dd>
</dd>

 

17) Install Proview runtime and op station on Raspberry Pi
</dt>
logon to dev as pwrp </dd>
geany ~/pwrCustom/installRpi.sh </dd>
insert the following lines into the new file:
  1. !/bin/bash
  2. install Proview package on Raspberry Pi
  3. unpack the tarball
</dd>
cd /home/pwrp/proview </dd>
tar -zxvf pwrrt-.tar.gz </dd>
chown -R pwrp:pwrp /home/pwrp/proview
</dd>
</dd>
  1. configure target dirs, install the archive
</dd>
install -d -o pwrp -g pwrp /usr/pwrrt </dd>
install -d -o pwrp -g pwrp /usr/pwrrt/cnf </dd>
install -d -o pwrp -g pwrp /usr/pwrrt/cnf/op </dd>
install -d -o pwrp -g pwrp /usr/pwrrt/cnf/user </dd>
install -d -o pwrp -g pwrp /usr/pwrrt/exe </dd>
install -d -o pwrp -g pwrp /usr/pwrrt/lib </dd>
install -d -o pwrp -g pwrp /usr/pwrrt/load </dd>
</dd>
install -d -o pwrp -g pwrp /pwrp </dd>
install -d -o pwrp -g pwrp /pwrp/arm_linux </dd>
install -d -o pwrp -g pwrp /pwrp/arm_linux/exe </dd>
install -d -o pwrp -g pwrp /pwrp/arm_linux/lib </dd>
install -d -o pwrp -g pwrp /pwrp/arm_linux/lis </dd>
install -d -o pwrp -g pwrp /pwrp/arm_linux/obj </dd>
</dd>
install -d -o pwrp -g pwrp /pwrp/common </dd>
install -d -o pwrp -g pwrp /pwrp/common/db </dd>
install -d -o pwrp -g pwrp /pwrp/common/inc </dd>
install -d -o pwrp -g pwrp /pwrp/common/load </dd>
install -d -o pwrp -g pwrp /pwrp/common/log </dd>
install -d -o pwrp -g pwrp /pwrp/common/loghist </dd>
install -d -o pwrp -g pwrp /pwrp/common/web </dd>
</dd>
install -d /usr/pwrp </dd>
install -d -o pwrp -g pwrp /usr/pwrp/adm </dd>
install -d -o pwrp -g pwrp /usr/pwrp/adm/db </dd>
</dd>
install -d /usr/share/doc/pwrrt </dd>
</dd>
install -D /home/pwrp/proview/etc/* /etc </dd>
install -D /home/pwrp/proview/etc/init.d/* /etc/init.d </dd>
install -D -m 644 /home/pwrp/proview/usr/pwrrt/cnf/proview.cnf /etc </dd>
</dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/* /usr/pwrrt </dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/cnf/* /usr/pwrrt/cnf </dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/exe/* /usr/pwrrt/exe </dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/lib/* /usr/pwrrt/lib </dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/load/* /usr/pwrrt/load </dd>
</dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/cnf/op/.??* /usr/pwrrt/cnf/op </dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/cnf/user/.??* /usr/pwrrt/cnf/user </dd>
</dd>
install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrp/adm/db/* /usr/pwrp/adm/db </dd>
</dd>
install -D -m 644 /home/pwrp/proview/usr/share/doc/pwrrt/* /usr/share/doc/pwrrt </dd>
install -D -m 644 /home/pwrp/proview/usr/share/man/man1/* /usr/share/man/man1 </dd>
</dd>
install -D -o pwrp -g pwrp -m 775 /home/pwrp/proview/usr/pwrrt/cnf/user/.??* /home/pwrp </dd>
install -D -o pwrp -g pwrp -m 775 /home/pwrp/proview/usr/pwrrt/cnf/user/* /home/pwrp </dd>
</dd>
install -D -m 644 /home/pwrp/proview/usr/pwrrt/cnf/user/proview_icon.png /usr/share/pixmaps </dd>
install -D -o pwrp -g pwrp -m 644 /home/pwrp/proview/usr/pwrrt/cnf/user/Proview.desktop /home/pwrp/Desktop </dd>
</dd>
if [ -f /home/pwrp/pwr_arduino_uno.ino ] </dd>
then </dd>
install -d -o pwrp -g pwrp /home/pwrp/sketchbook </dd>
install -d -o pwrp -g pwrp /home/pwrp/sketchbook/pwr_arduino_uno </dd>
mv /home/pwrp/pwr_arduino_uno.ino /home/pwrp/sketchbook/pwr_arduino_uno </dd>
chown pwrp:pwrp /home/pwrp/sketchbook/pwr_arduino_uno/pwr_arduino_uno.ino </dd>
fi </dd>
save and exit </dd>
scp /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_arm/bld/pkg/pwrrt-.tar.gz pwrp@rpi3:~/proview </dd>
scp /home/pwrp/pwrCustom/installRpi.sh pwrp@rpi3:~/ </dd>
ssh rpi3 </dd>
cd </dd>
chmod 775 installRpi.sh </dd>
sudo ./installRpi.sh </dd>
sudo update-rc.d pwr defaults </dd>
exit (from ssh session) </dd>
18) create proof-of-concept Proview project </dd>
logon to dev as pwrp </dd>
</dd>
one-time fix so plc prog will build: </dd>
mkdir /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64 </dd>
mkdir /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64/exp </dd>
mkdir /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64/exp/exe </dd>
cp ~/pwrsrc_4.8.6-3/src/exp/com/src/os_linux/pwrp_env.sh /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64/exp/exe </dd>
end one time fix </dd>
</dd>
on the desktop, double-click Proview V4.8 </dd>
accept (and respect) the license terms </dd>
using "PwR Project List": </dd>
enter edit mode </dd>
add a BaseReg object, child to Bases </dd>
open the new object, set attributes: </dd>
ObjectName: BaseV48arm </dd>
Version  : X48arm </dd>
Path  : /home/pwrp/pwrrls_4.8.6-3 </dd>
close the object </dd>
save changes </dd>
note: the new base define is reflected as a new line in /usr/pwrp/adm/db/pwr_projectlist.dat </dd>
the binding to the release build's path is via the "X48arm" token, which will be used below </dd>
add a $Hier object, sibling to Bases </dd>
set ObjectName attribute = "testProjects" </dd>
add a ProjectReg object, child of testProjects </dd>
open new object, set attributes: </dd>
ObjectName : piPOC </dd>
Description: Raspberry Pi Proof of Concept </dd>
Version  : X48arm </dd>
(note: Version attr binds the project to the BaseV48arm) </dd>
close the object </dd>
save changes </dd>
Confirm Actions: Yes </dd>
note: the new project is reflected as a new directory tree at /usr/local/pwrp/pipoc </dd>
leave edit mode </dd>
right-click piPOC, pick Open Project </dd>
using "Configure Directory Volume": </dd>
enter "Production QBUS id" = 5 (this is arbitrary, but better than using defaults, for troubleshooting) </dd>
click Next </dd>
click Next </dd>
click No </dd>
click Next </dd>
click Next </dd>
click Skip this node </dd>
click Next </dd>
click Yes </dd>
using "Configure Root Volume": </dd>
pick Operator Station </dd>
click Next </dd>
click Next </dd>
click Next </dd>
using "PwR VolPipoc, pwrp on pipoc": </dd>
from the drop-down menu, pick "File | Volume Attributes..." </dd>
change the "OperatingSystem" attribute to "CustomBuild" </dd>
close the object </dd>
save changes </dd>
close the window </dd>
using "PwR Directory, pwrp on pipoc": </dd>
enter edit mode </dd>
</dd>
open pipoc object, set attributes: </dd>
NodeName  : rpi3 (i.e. the hostname of the target rpi) </dd>
OperatingSystem: CustomBuild </dd>
BootNode:  : rpi3 </dd>
Address  : 192.168.0.1 (i.e. the IPv4 address of the rpi) </dd>
close the object </dd>
</dd>
add a CustomBuild object as child to pipoc </dd>
open the new object, set attributes: </dd>
ObjectName  : build </dd>
cc  : /usr/bin/arm-gcc </dd>
cxx  : /usr/bin/arm-g++ </dd>
ar  : /usr/bin/arm-ar </dd>
OperatingSystem: Linux on ARM </dd>
Platform  : arm_linux </dd>
Release  : X48arm </dd>
close the object </dd>
</dd>
save changes </dd>
leave edit mode </dd>
right-click "VolPipoc", pick Open Volume </dd>
using "PwR VolPipoc, pwrp on pipoc": </dd>
enter edit mode </dd>
</dd>
in the right pane, delete the Maintenance object </dd>
in the right pane, delete the OpDefault object </dd>
in the right pane, delete the WebHandler object </dd>
in the right pane, delete the WebBrowser object </dd>
</dd>
add a XttGraph object as child to Op </dd>
set ObjectName to Display1 </dd>
</dd>
open Op object, set attributes: </dd>
UserName  : pwrp </dd>
FastAvail[0]  : Nodes-Pipoc-Op-Display1 </dd>
close the object </dd>
</dd>
in the center pane, add a $PlantHier object </dd>
set ObjectName to Bakery </dd>
</dd>
add a $PlantHier, child to Bakery </dd>
set ObjectName to Signals </dd>
</dd>
add two Iv objects as children of Signals </dd>
set ObjectName's to Iin and Iout, respectively </dd>
</dd>
add a PlcPgm object as child of Bakery </dd>
set ObjectName to Plc </dd>
</dd>
save changes </dd>
leave edit mode </dd>
</dd>
right-click Bakery-Plc, pick Open Program </dd>
using "Bakery-Plc" </dd>
enter edit mode </dd>
</dd>
add a GetIv object </dd>
add a StoIv object </dd>
</dd>
connect the GetIv output to the StoIv input </dd>
</dd>
from drop-down menu, pick "View | Palette | Plant". Using the right-pane </dd>
plant hierarchy: </dd>
Connect (bind) Signals-Iin to GetIv </dd>
Connect (bind) Signals-Iout to StoIv </dd>
</dd>
save changes </dd>
leave edit mode </dd>
close the window </dd>
using "PwR VolPipoc, pwrp on pipoc": </dd>
right click Nodes-Op-Display1 </dd>
pick "Open Ge..." </dd>
using "PwR Ge display1" </dd>
</dd>
add two ValueInputMedium objects </dd>
</dd>
record the coordinates for the area to display, i.e. the area which contains the two objects </dd>
from the drop-down menu, pick "File | Graph Attributes" </dd>
enter the x & y coordinates for this display area </dd>
close the object </dd>
</dd>
double-click one of the ValueInputMedium objects, set attribute: </dd>
Value.Format  : %6d </dd>
close object </dd>
</dd>
repeat for the other Input object </dd>
</dd>
View "Plant Hierarchy", select Bakery-Signals-Iin </dd>
press Ctrl key, double-click on first ValInpMed object (binds signal to object) </dd>
</dd>
repeat, bind Iout to other display object </dd>
</dd>
pick "File | Save" </dd>
close the window </dd>
using "PwR VolPipoc, pwrp on pipoc": </dd>
from drop-down menu, pick "Functions | Build Node" </dd>
example output as shown in "Proview Development Console": </dd>
Setting base /usr/pwr48 </dd>
Open pipoc </dd>
args: pipoc pwrp pwrp </dd>
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ </dd>
Welcome to </dd>
pipoc V4.8 Raspberry Pi Proof of Concept </dd>
</dd>
Revision history </dd>
2013-03-09 pwrp Project created </dd>
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ </dd>
-- Processing line: 50 </dd>
-- Building volume directory </dd>
-- Opening volume 'VolPipoc' </dd>
Berkeley DB 5.1.29: (October 25, 2011) </dd>
info get: 0 </dd>
-- Build node pipoc </dd>
-- Plc window generated Bakery-Plc-W </dd>
/home/pwrp/pwrrls_4.8.6-3 is baseroot </dd>
Setting base /home/pwrp/pwrrls_4.8.6-3 </dd>
-- Cross compilation ARM_LINUX </dd>
-- Plc window compiled for arm_linux optimized -O3 Bakery-Plc-W </dd>
/home/pwrp/pwrrls_4.8.6-3 is baseroot </dd>
Setting base /home/pwrp/pwrrls_4.8.6-3 </dd>
-- Cross compilation ARM_LINUX </dd>
-- Plc plcpgm compiled for arm_linux optimized -O3 Bakery-Plc </dd>
-- Web startpage generated $pwrp_web/index.html </dd>
/home/pwrp/pwrrls_4.8.6-3 is baseroot </dd>
Setting base /home/pwrp/pwrrls_4.8.6-3 </dd>
-- Cross compilation ARM_LINUX </dd>
-- Building archive for volume: 000_001_001_001 </dd>
-- Archive built for volume: 000_001_001_001 </dd>
-- Working with load file volume 'VolPipoc'... </dd>
-- Open file... </dd>
-- Successfully created load file for volume 'VolPipoc' </dd>
-- 26 objects with a total body size of 26392 bytes were written to new file. </dd>
-- Creating bootfile for node rpi3 </dd>
-- Plc thread generated priority 22, scantime 0.10000 s, 1 plcpgm's </dd>
/home/pwrp/pwrrls_4.8.6-3 is baseroot </dd>
Setting base /home/pwrp/pwrrls_4.8.6-3 </dd>
-- Cross compilation ARM_LINUX </dd>
-- Plc process compiled for arm_linux optimized -O3 Dummy </dd>
/home/pwrp/pwrrls_4.8.6-3 is baseroot </dd>
Setting base /home/pwrp/pwrrls_4.8.6-3 </dd>
-- Cross compilation ARM_LINUX </dd>
-- Plc program linked for arm_linux node plc_rpi3_0005_plc </dd>
-- Build node pipoc </dd>
end example output </dd>
from drop-down menu, pick "Functions | Distribute" </dd>
using "Distributor": </dd>
select rpi3 </dd>
from the drop-down menu, pick "Functions | Distribute" </dd>
example output in "Proview Development Console": </dd>
pwrp_pkg_rpi3_0001.tgz 100% 1705KB 1.7MB/s 00:00 </dd>
-- No package installed </dd>
-- Installing package pwrp_pkg_rpi3_0001.tgz </dd>
-- Unpack package pwrp_pkg_rpi3_0001.tgz </dd>
-- Move files to target directories </dd>
sudo: no tty present and no askpass program specified </dd>
end example output </dd>
there will be some warnings in Workbench Messages re missing files, ignore these </dd>
exit from the Proview development environment (close all windows in reverse order of opening them) </dd>
19) run the test project </dd>
connect to rpi3 via vnc client </dd>
</dd>
nano ~/.xtt_start </dd>
edit the rt_xtt invoke to launch the operator station: </dd>
$pwr_exe/rt_xtt Nodes-Pipoc-Op & </dd>
save changes and exit </dd>
</dd>
sudo nano /etc/proview.cnf </dd>
edit the qcomBusId to 5 </dd>
save changes and exit </dd>
</dd>
sudo shutdown -r now </dd>
(so the pwr service will pick up the new bus ID) </dd>
connect to rpi3 via vnc client </dd>
</dd>
start the op station: </dd>
double-click the Proview desktop icon </dd>
</dd>
launch Display1 </dd>
verify manually entering a value in Iin is copied to Iout </dd>
verify manually entering a value in Iout is overwritten by value in Iin </dd>
verify status is green </dd>
</dd>
note: to reset runtime from an abend: </dd>
source pwr_stop.sh </dd>
</dd>
--------------------------------------------------------------------------------------------------- </dd>
OK, proof of concept works, let's have another pi do some I/O </dd>
after all, what good is a SCADA system without I/O? </dd>
---------------------------------------------------------------------------------------------------
</dd>
</dd>
</dd>
</dd>
20) Build another rpi (nobody can have just one!), hostname rpi2
</dt>
install base OS (item 8 above) </dd>
config new pi for ssh (item 9 above) </dd>
install Proview (item 17 above) </dd>
sudo nano /etc/proview.cnf </dd>
edit the qcomBusId to 5 </dd>
save changes and exit </dd>
21) configure rpi2 for arduino </dd>
login to rpi2 as pwrp </dd>
connect the arduino device </dd>
sudo apt-get install arduino </dd>
launch arduino </dd>
pick "Tools | Board | Arduino Uno" </dd>
pick "Tools | Serial Port | /dev/ttyACM0" </dd>
pick "File | Sketchbook | pwr_arduino_uno" </dd>
in sketch, verify debug assignment is 0 </dd>
verify baudRate is 19200 </dd>
upload sketch to the arduino </dd>
</dd>
note: due to the bizarre handling of serial in Linux (i.e. raw, cooked, much interference by software layers, etc.), </dd>
the following config is needed prior to starting the pwr runtime: </dd>
</dd>
stty -F /dev/sttyACM0 10:0:8be:0:3:1c:7f:15:1:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 </dd>
this config is included in the "pwr" service start script as per edits in sections above. </dd>
</dd>
(as a side note, if the Uno is connected to a virtual machine via VirtualBox, if you bind the Uno device from the (Windows) host </dd>
to the VM using USB and not COM, then things seem to work in Proview debug runtime. Again, the stty config needs to be run prior to runtime start.)
</dd>
</dd>
22) Update Proview project
logon to dev as pwrp </dd>
</dt>
launch Proview </dd>
</dd>
using "PwR Project List" </dd>
from the menu, pick "File | Open | GlobalVolumeList" </dd>
using "PwR Global Volume List" </dd>
enter edit mode </dd>
add a VolumeReg object as sibling of VolPipoc </dd>
open object, set attributes: </dd>
ObjectName  : VolPipoc2 </dd>
Description  : 0.1.1.2 pipoc </dd>
VolumeId  : _V0.1.1.2 </dd>
Project  : pipoc </dd>
close the object </dd>
save changes </dd>
leave edit mode </dd>
close the window </dd>
using "PwR Project List" </dd>
open PiPOC project </dd>
enter edit mode
</dd>
</dd>
add a RootVolumeConfig object as sibling of VolPipoc </dd>
open object, set attribute: </dd>
ObjectName  : VolPipoc2 </dd>
close the object
</dd>
</dd>
</dd>
add a NodeConfig object as sibling to pipoc </dd>
open object, set attributes: </dd>
ObjectName  : pipoc2 </dd>
NodeName  : rpi2 (i.e. the hostname of the target rpi) </dd>
OperatingSystem: CustomBuild </dd>
BootNode:  : rpi2 </dd>
Address  : 192.168.0.2 (i.e. the IPv4 address of the rpi) </dd>
close the object
</dd>
</dd>
</dd>
add a CustomBuild as child to pipoc2 </dd>
open object, set attributes: </dd>
ObjectName  : build </dd>
cc  : /usr/bin/arm-gcc </dd>
cxx  : /usr/bin/arm-g++ </dd>
ar  : /usr/bin/arm-ar </dd>
OperatingSystem: Linux on ARM </dd>
Platform  : arm_linux </dd>
Release  : X48arm </dd>
close the object </dd>
</dd>
open pipoc2's RootVolumeLoad object, set attribute: </dd>
ObjectName  : VolPipoc2 </dd>
close the object
</dd>
</dd>
</dd>
save changes </dd>
click Yes to "Do you want to create this Volume?" </dd>
leave edit mode
</dd>
</dd>
</dd>
right click VolPipoc2, pick OpenVolume </dd>
using "Configure Root Volume" </dd>
pick "Operator Station" </dd>
click Next </dd>
click Next </dd>
click Next </dd>
using "PwR VolPipoc2, pwrp on pipoc" </dd>
enter edit mode </dd>
from the drop-down menu, pick "File | Volume Attributes..." </dd>
change the "OperatingSystem" attribute to "CustomBuild" </dd>
close the object </dd>
in the right pane, delete the Maintenance object </dd>
in the right pane, delete the OpDefault object </dd>
in the right pane, delete the WebHandler object </dd>
in the right pane, delete the WebBrowser object
</dd>
</dd>
</dd>
add a XttGraph object as child to Op </dd>
set ObjectName to Display2
</dd>
</dd>
</dd>
open Op object, set attributes: </dd>
UserName  : pwrp </dd>
AutoStart[0]  : Nodes-Pipoc2-Op-Display2 </dd>
FastAvail[0]  : Nodes-Pipoc2-Op-Display2 </dd>
close the object </dd>
</dd>
add a Arduino_USB object as child of Pipoc2 </dd>
open object, set attributes: </dd>
ObjectName  : Arduino </dd>
close object </dd>
</dd>
add a Arduino_Uno object as child of Arduino </dd>
open object, set attributes: </dd>
ObjectName  : Uno1 </dd>
Device  : /dev/ttyACM0 </dd>
BaudRate  : 19200 </dd>
close object </dd>
</dd>
add a ChanAi object as child of Uno1 </dd>
open object, set attributes: </dd>
ObjectName  : Ai0 </dd>
Number  : 0 </dd>
RawValRangeLow  : 0 </dd>
RawValRangeHigh  : 1023 </dd>
ChannelSigValRangeLow  : 0 </dd>
ChannelSigValRangeHigh : 5 </dd>
SensorSigValRangeLow  : 0 </dd>
SensorSigValRangeHigh  : 5 </dd>
ActValRangeLow  : 0 </dd>
ActValRangeHigh  : 1023 </dd>
close object </dd>
</dd>
add a ChanDo object as child of Uno1 </dd>
open object, set attributes: </dd>
ObjectName  : Do2 </dd>
Number  : 2 </dd>
close object </dd>
</dd>
add a ChanDi object as child of Uno1 </dd>
open object, set attributes: </dd>
ObjectName  : Di4 </dd>
Number  : 4 </dd>
close object </dd>
</dd>
in the center pane, add a $PlantHier object </dd>
set ObjectName to Bakery2 </dd>
</dd>
add a $PlantHier object, child to Bakery2 </dd>
set ObjectName to Signals </dd>
</dd>
add an Ai object as child of Signals </dd>
open object, set attributes: </dd>
ObjectName  : Ai0 </dd>
SigChanCon  : Nodes-Pipoc2-Arduino-Uno1-Ai0 </dd>
close object </dd>
</dd>
add a Di object as child of Signals </dd>
open object, set attributes: </dd>
ObjectName  : Di4 </dd>
SigChanCon  : Nodes-Pipoc2-Arduino-Uno1-Di4 </dd>
close object </dd>
</dd>
add a Do object as child of Signals </dd>
open object, set attributes: </dd>
ObjectName  : Do2 </dd>
SigChanCon  : Nodes-Pipoc2-Arduino-Uno1-Do2 </dd>
close object </dd>
</dd>
add a PlcPgm object as child of Bakery2 </dd>
set ObjectName to Plc2 </dd>
</dd>
save changes </dd>
leave edit mode </dd>
</dd>
right-click Bakery2-Plc, pick Open Program </dd>
using "Bakery2-Plc2" </dd>
enter edit mode </dd>
save changes (there are none - but we need the sub-window to exist) </dd>
leave edit mode </dd>
close the window </dd>
using "PwR VolPipoc, pwrp on pipoc": </dd>
right click Nodes-Op-Display2 </dd>
pick "Open Ge..." </dd>
using "PwR Ge display2" </dd>
add one ValueInputMedium object </dd>
add two ValueMedium objects </dd>
</dd>
note the coordinates for the area to display </dd>
from the drop-down menu, pick "File | Graph Attributes" </dd>
enter the x & y coordinates for display area noted above </dd>
close the object </dd>
</dd>
double-click the ValueInputMedium object, set attribute: </dd>
Value.Format  : %6d </dd>
close object </dd>
</dd>
repeat for the first ValueMedium object </dd>
repeat with %6.2f for other ValueMedium object </dd>
</dd>
View Plant Hierarchy, select Bakery2-Signals-Do2 </dd>
press Ctrl key, double-click on ValueInputMedium object </dd>
note: this connects the display object to the target plant signal
</dd>
</dd>
</dd>
repeat, connect Di4 to ValMed, connect Ai0 to other ValMed
</dd>
</dd>
</dd>
pick "File | Save" </dd>
close the window </dd>
using "PwR VolPipoc2, pwrp on pipoc": </dd>
from drop-down menu, pick "Functions | Build Node" </dd>
from drop-down menu, pick "Functions | Distribute" </dd>
using "Distributor": </dd>
select rpi2 </dd>
from the drop-down menu, pick "Functions | Distribute" </dd>
exit from the Proview development environment (close all windows)
</dd>
</dd>
23) use the Arduino
</dt>
connect to rpi2 via VNC X window </dd>
restart the runtime: </dd>
sudo service pwr restart </dd>
hint: if problems, then to get some diagnostics: </dd>
cd </dd>
source pwr_stop.sh </dd>
rt_ini -i & </dd>
ps -ef | grep rt </dd>
edit ~./.xtt_start to launch the operator station windows:
  1. !/bin/bash
</dd>
source /etc/pwrp_profile </dd>
$pwr_exe/rt_xtt Nodes-Pipoc2-Op & </dd>
save changes and exit </dd>
double-click the Proview desktop icon </dd>
in Display2, the analog in value will vary slightly due to noise (unless you have connected a pot or some signal to it) </dd>
experiment with the Di and Do values </dd>
finish </dd>
</dd>
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox