Installation guide: Process and Operator station on the Raspberry Pi
From Proview Wiki
- 1) Install Ubuntu 12.10 desktop OS on the development (virtual) machine:
- 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
- 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
- Boot the iso on the VM
- English, install ubuntu
- Download updates while installing
- Install this third party software
- Erase disk and install ubuntu
- Chicago
- English (us), english (us)
- Hostname pwrDevel
- Require login pw
- Restart
- 2) Patch the install
- sudo apt-get update
- sudo apt-get dist-upgrade
- restart (for new kernel)
- 3) Install virtualbox tools
- sudo apt-get install linux-headers-generic dkms build-essential
- From vbox menu pick: Devices | Install Guest Additions
- Allow autorun prompt to procede, authenticate
- Restart
- 4) Minimize annoyances
- Get rid of advertising and the global menu
- sudo apt-get remove unity-lens-shopping appmenu-gtk appmenu-gtk3 appmenu-qt
- Launch firefox, disable 'global menu integration' extension
- Logout, log back in
- turn off spyware
- turn off spyware
- launch "System Settings | Privacy"
- pick "Search Results," pick "Include online search results: Off"
- pick "Diagnostics", uncheck "Send error reports to Canonical", pick "Record Activity: OFF"
- sudo add-apt-repository ppa:tualatrix/ppa
- sudo add-apt-repository ppa:satyajit-happy/themes
- sudo add-apt-repository ppa:indicator-multiload/stable-daily
- sudo apt-get update
- sudo apt-get install gnome-shell synaptic gconf-editor gnome-tweak-tool ubuntu-tweak nautilus-open-terminal
- note: accept defaults for gdm
- note: accept defaults for gdm
- sudo apt-get install orion-gtk-theme indicator-multiload compizconfig-settings-manager
- right click desktop pick "Change Desktop Background", select non-orange and non-purple background
- from Dash, launch "System Load Indicator"
- launch "System Settings | Ubuntu Tweak"
- pick "Tweaks | Miscellaneous", pick "Overlay scrollbars: Normal"
- pick "Tweaks | Theme", pick "Gtk theme: Orion", "Icon theme: gnome", "Window theme: Radiance"
- pick "Tweaks | Desktop Icons", pick "Show Computer", "Show mounted volumes"
- pick "Tweaks | Unity", adjust "Launcher icon size" to not waste so much screen space
- pick "Tweaks | Window", pick "Window control button...: Right"
- from Dash, launch "CompizConfig Settings Manager"
- un-check "Snapping Windows"
- delete unneeded icons from launcher: the "bag", the libre office stuff, the "U"s, the advertising
- add "Terminal" to launcher
- sudo apt-get install geany
- add "Geany" to launcher
- 5) Install prerequisites for 'Proview build from source code'
- install some packages (note: openssh-server is not really a prerequisite)
- sudo apt-get install make flex libgtk2.0-dev libdb5.1-dev libdb5.1++-dev libasound2-dev doxygen libmysql++-dev xfonts-100dpi openssh-server
- install java JDK
- download tarball from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
- cd /usr/local
- sudo tar -zxvf /home/<userID>/jdk-7u17-linux-x64.tar.gz
- sudo chown -R root:root jdk1.7.0_17/
- sudo -s
- cd /etc/profile.d
- touch proview.build.sh
- vi proview.build.sh
- insert the following lines:
- export jdk=/usr/local/jdk1.7.0_17
- export PATH=$PATH:$jdk/bin
- save edited file, exit vi
- exit (from sudo)
- 6) Install Proview development environment & debug runtime
- wget -Opwr48_4.8.6-3.2_amd64.deb http://sourceforge.net/projects/proview/files/proview/proview_4.8.6-3/ubuntu_12.10/pwr48_4.8.6-3.2_amd64.deb/download
- sudo dpkg -i pwr48_4.8.6-3.2_amd64.deb
- sudo adduser pwrp sudo
- logout
- login as pwrp
- fix annoyances
- from launcher, pick "System Settings | Brightness and Lock"
- pick "Lock: OFF"
- exit
- cd
- sudo chown pwrp:pwrp Desktop
- install antlr
- wget http://www.antlr2.org/download/antlr-2.7.7.tar.gz
- tar -zxvf antlr-2.7.7.tar.gz
- geany ~/antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp
- add: #include <strings.h>
- include <stdio.h>
- save changes and exit
- cd ~/antlr-2.7.7
- ./configure
- make
- sudo make install
- change max shared memory
- sudo geany /etc/sysctl.conf
- insert a line at the end:
- kernel.shmmax=67108864
- save changes, exit geany
- sudo -s
- echo 67108864 > /proc/sys/kernel/shmmax
- exit
- 7)) Install Proview source
- login as pwrp
- cd
- wget -Opwrsrc_4.8.6-3.2.tar.gz http://sourceforge.net/projects/proview/files/proview/proview_4.8.6-3/pwrsrc_4.8.6-3.2.tar.gz/download
- tar -zxvf pwrsrc_4.8.6-3.2.tar.gz
- 8) Bake the raspberry pi
- get the wheezy image 2013-02-09 via torrent
- write to 8 GB Class 10 SD card
- boot
- using the Raspi-config tool:
- expand_rootfs
- configure_keyboard
- English (US)
- English (US)
- The default for the keyboard layout
- No compose key
- Control-Alt-Backspace to terminal X server: No
- change_pass
- change_locale
- en_US.UTF-8 UTF-8 only
- default locale for system environment: none
- change_timezone: US Central
- ssh: Enable
- boot_behavior: No
- Finish
- reboot
- login as pi
- sudo apt-get update
- sudo apt-get dist-upgrade
- sudo apt-get install tightvncserver
- sudo apt-get install libgtk2.0-dev
- sudo rm /etc/ssh/ssh_host_*
- sudo dpkg-reconfigure openssh-server
- sudo adduser pwrp
- use password = 'pwrp' (same as Proview distro default)
- sudo adduser pwrp dialout
- (this is for arduino access)
- sudo visudo
- insert following line under the "root ALL=(ALL) ALL" Line:
- pwrp ALL=(ALL) ALL
- save changes, exit
- sudo nano /etc/security/limits.conf
- insert the following:
- - rtprio 99
- save and exit
- sudo nano /etc/pam.d/su
- uncomment line:
- session required pam_limits.so
- save and exit
- (note: this allows the pwr service start to set pwr tasks' realtime priorities)
- (note2: also applies to the pwrp tightvncserver X session, since that is launched with su also)
- sudo nano /etc/init.d/tightvncserver
- insert the following into the new file:
- !/bin/sh
- /etc/init.d/tightvncserver
- VNCUSER='pwrp'
- case "$1" in
- start)
- su $VNCUSER -c '/usr/bin/tightvncserver :0 -geometry 1024x768 -depth 24'
- echo "Starting TightVNC Server for $VNCUSER "
- stop)
- pkill Xtightvnc
- echo "TightVNC Server stopped"
- )
- 9) Configure ssh access from dev to rpi
- logon to dev as pwrp
- do this only once:
- ssh-keygen -t rsa
- sudo geany /etc/hosts
- insert line for raspberry pi machine(s) and any other hosts in the distributed system
- save and exit
- scp /home/pwrp/.ssh/id_rsa.pub rpi3:/home/pwrp/.ssh/authorized_keys
- 10) Install cross platform dev tools on dev
- logon to dev as pwrp
- sudo apt-get install ia32-libs git
- cd
- mkdir rpitools
- cd rpitools
- sudo git clone git://github.com/raspberrypi/tools.git
- create symbolic links to compilers and archiver as a workaround on rather long fully qualified names -
- (Proview merge tool has a hardcoded alloc of 80 chars max for the FQ name of each of these tools):
- sudo -s
- ln -s /home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc /usr/bin/arm-gcc
- ln -s /home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ /usr/bin/arm-g++
- ln -s /home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ar /usr/bin/arm-ar
- exit
- 11) Get a copy of the rpi headers and libraries to compile and link against, respectively
- logon to dev as pwrp
- rsync -avz -e ssh pwrp@rpi3:/usr/include /home/pwrp/rpi
- sudo rsync -avz -e ssh pwrp@rpi3:/usr/lib/arm-linux-gnueabihf /usr/lib
- sudo rsync -avz -e ssh pwrp@rpi3:/lib/arm-linux-gnueabihf /lib
- 12) Setup the build environment
- logon to dev as pwrp
- cd
- geany ~/.envarm
- insert the following into this new file:
- .envarm:
- env for Proview development for raspberry pi
- export pwre_cc=/usr/bin/arm-gcc
- export pwre_cxx=/usr/bin/arm-g++
- export pwre_ar=/usr/bin/arm-ar
- export pwr_host_exe=/usr/pwr48/os_linux/hw_x86_64/exp/exe
- export pwre_host_exe=/usr/pwr48/os_linux/hw_x86_64/exp/exe
- export pwre_env_db=/home/pwrp/pwre_env_db
- export pwre_bin=/home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux
- export pwre_dir_symbols=$pwre_bin/dir_symbols.mk
- export PATH=$PATH:/home/pwrp/rpitools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
- source $pwre_bin/pwre_function
- save and exit
- geany ~/.bashrc
- insert at end of file:
- source ~/.envarm
- save and exit
- close all Terminal(s)
- launch Terminal
- cd
- mkdir pwrrls_4.8.6-3
- define a PWRE environment for the build:
- pwre add v486_arm
- --
- -- Environment : v486_arm
- -- Module.........: rt
- -- Source root....: /home/pwrp/pwrsrc_4.8.6-3/src
- -- Import root....: /usr/pwr48/os_linux/hw_x86_64
- -- Build root.....: /home/pwrp/pwrrls_4.8.6-3
- -- Build type.....: dbg
- -- OS.............: linux
- -- Hardware.......: arm
- -- Description....: X48arm
- --
- himBH
- 13) Fixup Proview config script
- logon to dev as pwrp
- cd /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux
- cp pwre_configure.sh pwre_configure.sh.org
- cd
- geany /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux/pwre_configure.sh
- insert after line 311:
- pwre_config_check_lib gtk GTK gtk gtk 0 "/usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0.so"
- pwre_config_check_include gtk GTK 1 "/home/pwrp/rpi/include/gtk-2.0/gtk/gtk.h"
- as a sanity check, the code block should look like:
- if test $pwre_hw == "hw_arm"; then
- pwre_config_check_lib gtk GTK gtk gtk 0 "/usr/lib/arm-linux-gnueabihf/libgtk-x11-2.0.so"
- pwre_config_check_include gtk GTK 1 "/home/pwrp/rpi/include/gtk-2.0/gtk/gtk.h"
- pwre_config_check_include jni JNI 1 $jdk/include/jni.h
- pwre_config_check_include jni JNI 0 $jdk/include/linux/jni_md.h
- save and exit
- pwre init v486_arm
- pwre configure
- need to figure out some paths, will use the output from "pwre configure" to help,
- this is a little tedious:
- geany /home/pwrp/pwrrls_4.8.6-3/pwre_arm_linux.cnf
- find line "export pwre_conf_libgtk="
- note the embedded command, e.g. "pkg-config --libs gtk+-2.0", designate as "cmd1"
- find line "export pwre_conf_incdirgtk="
- note the embedded command, e.g. "pkg-config --cflags gtk+-2.0", designate as "cmd2". the commands will now be run on the rpi:
- ssh rpi3
- execute cmd1:
- pkg-config --libs gtk+-2.0
- save the output in a new temp file, e.g. in geany
- execute cmd2:
- pkg-config --cflags gtk+-2.0
- save the output to the temp file
- exit from ssh session
- in the temp file, replace "usr/include" with "home/pwrp/rpi/include"
- in geany, open /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux/pwre_configure.sh
- find line "export pwre_conf_libgtk="
- hard-code the contents of that assign to the output of cmd1, e.g.:
- 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
- find line "export pwre_conf_incdirgtk="
- hard-code the contents of that assign to the edited output of cmd2, e.g.:
- 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
- find line "echo "export pwre_conf_lib=\"-lpthread -lm -lrt -lcrypt\"" >> $cfile"
- add X11 and db5.1 libraries, e.g.:
- echo "export pwre_conf_lib=\"-lpthread -lm -lrt -lcrypt -lX11 -ldb-5.1\"" >> $cfile
- find line "echo "export pwre_conf_libdir=\"$conf_libdir\"" >> $cfile"
- hard-code the assignment to:
- 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
- find line "echo "export pwre_conf_incdir=\"$conf_incdir\"" >> $cfile"
- hard-code the assignment to:
- 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
- save the edited file
- cd
- mkdir pwrCustom
- save the edited file (again) as ~/pwrCustom/pwre_configure.sh.custom
- exit geany
- 14) Fixup Proview source tree
- fix service start script:
- cp /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/pwr ~/pwrCustom
- geany ~/pwrCustom/pwr
- for each of the functions: pwr_start, pwr_stop, pwr_reload, pwr_kill:
- replace the "whoami" conditional test from "root" to "pwrp"
- if using an arduino uno, add the following line within the create_wrapper function, after the umask command:
- 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
- save and exit
- fix code error:
- geany /home/pwrp/pwrsrc_4.8.6-3/sev/lib/sev/src/sev_db.cpp
- add open curly brace on line 52:
- else if ( type == sev_eDbType_Sqlite) {
- add close curly brace after line 58.
- code block should now look like:
- if ( type == sev_eDbType_Mysql) {
- if defined PWRE_CONF_MYSQL
- return sev_dbms::open_database();
- else
- printf( "** Release is not built with mysql\n");
- return 0;
- endif
- }
- else if ( type == sev_eDbType_Sqlite) {
- if defined PWRE_CONF_SQLITE3
- return sev_dbsqlite::open_database();
- else
- printf( "** Release is not built with sqlite3\n");
- return 0;
- endif
- }
- else
- return 0;
- }
- end example code block
- save the edited file as:
- ~/pwrCustom/sev_db.cpp
- exit geany
- edit the build package script, it will not create a *.deb file as-is:
- geany ~/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/build.sh
- "# Create directories" section, insert line:
- mkdir -p $pkgroot/usr/pwrp/adm/db
- uncomment lines which copy op to cnf
- uncomment lines which copy user to cnf
- add following lines to "# Copy user to cnf" section:
- cp $pwre_broot/$pwre_target/exp/inc/pwr_arduino_uno.ino $pkgroot/usr/pwrrt/cnf/user
- cp $pwre_sroot/tools/pkg/deb/adm/proview_icon.png $pkgroot/usr/pwrrt/cnf/user
- cp /home/pwrp/pwrCustom/Proview.desktop $pkgroot/usr/pwrrt/cnf/user
- after the "# Copy user to cnf" section, insert the following lines:
- Copy user security data
- mkdir -p $pkgroot/usr/pwrp/adm/db
- cp $pwre_sroot/tools/pkg/deb/adm/pwr_user2.dat $pkgroot/usr/pwrp/adm/db
- comment out line "dpkg-buildpackage -aarmel -b"
- add following lines:
- packagename=pwrrt-$version.tar.gz
- tar -czf ../$packagename *
- save the edited file as:
- ~/pwrCustom/build.sh
- exit geany
- geany ~/pwrCustom/fixPwrSource.sh
- insert the following lines into the new file:
- !/bin/bash
- fix some missing dependencies
- 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/
- 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/
- 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/
- 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
- cp /usr/include/db.h /home/pwrp/pwrsrc_4.8.6-3/src/exe/rt_elog_dump/src
- cp /usr/include/db.h /home/pwrp/pwrsrc_4.8.6-3/xtt/lib/xtt/src
- cp /usr/include/db.h /home/pwrp/pwrsrc_4.8.6-3/xtt/lib/xtt/gtk
- mkdir /home/pwrp/pwrsrc_4.8.6-3/wb/lib/wb/src/antlr
- cp /home/pwrp/antlr-2.7.7/lib/cpp/antlr/* /home/pwrp/pwrsrc_4.8.6-3/wb/lib/wb/src/antlr
-
- fix code error
- cp ~/pwrCustom/sev_db.cpp /home/pwrp/pwrsrc_4.8.6-3/sev/lib/sev/src/sev_db.cpp
-
- copy build script which creates just a tarball, not a debian package, and includes some custom rpi/arduino specific stuff
- cp ~/pwrCustom/build.sh /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt
-
- copy custom pwre_configure.sh
- cp /home/pwrp/pwrCustom/pwre_configure.sh.custom /home/pwrp/pwrsrc_4.8.6-3/src/tools/pwre/src/os_linux/pwre_configure.sh
-
- copy custom pwr service control script
- cp ~/pwrCustom/pwr /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/
- save and exit
- chmod 755 ~/pwrCustom/fixPwrSource.sh
- geany ~/pwrCustom/Proview.desktop
- insert the following lines into the new file:
- [Desktop Entry]
- Name=Proview
- Comment=SCADA Operator Station
- Exec=/home/pwrp/.xtt_start
- Icon=proview_icon
- Terminal=false
- Type=Application
- MimeType=text/plain
- Categories=GTK
- save and exit
- 15) Final cleanup
- logon to dev as pwrp
- delete /home/pwrp/pwrsrc_4.8.6-3 (and all contents)
- delete everything from /home/pwrp/pwrrls_4.8.6-3, leaving the folder
- unpack the source (again):
- cd
- tar -zxvf pwrsrc_4.8.6-3.2.tar.gz
- 16) Build Proview for raspberry pi
- logon to dev as pwrp
- cd
- pwre list
- pwre init v486_arm
- ./pwrCustom/fixPwrSource.sh
- pwre create_all_modules
- pwre import rt
- pwre import java
- pwre import op
- pwre configure
- ./pwrCustom/fixPwrSource.sh
- pwre ebuild rt
- pwre ebuild op
- pwre build tools/pkg deb_armel
- note: to enable pkg rebuild (when make says nothing to do):
- touch /home/pwrp/pwrsrc_4.8.6-3/src/tools/pkg/deb_armel/pwrrt/control
- 17) Install Proview runtime and op station on Raspberry Pi
- logon to dev as pwrp
- geany ~/pwrCustom/installRpi.sh
- insert the following lines into the new file:
- !/bin/bash
- install Proview package on Raspberry Pi
- unpack the tarball
- cd /home/pwrp/proview
- tar -zxvf pwrrt-.tar.gz
- chown -R pwrp:pwrp /home/pwrp/proview
-
- configure target dirs, install the archive
- install -d -o pwrp -g pwrp /usr/pwrrt
- install -d -o pwrp -g pwrp /usr/pwrrt/cnf
- install -d -o pwrp -g pwrp /usr/pwrrt/cnf/op
- install -d -o pwrp -g pwrp /usr/pwrrt/cnf/user
- install -d -o pwrp -g pwrp /usr/pwrrt/exe
- install -d -o pwrp -g pwrp /usr/pwrrt/lib
- install -d -o pwrp -g pwrp /usr/pwrrt/load
- install -d -o pwrp -g pwrp /pwrp
- install -d -o pwrp -g pwrp /pwrp/arm_linux
- install -d -o pwrp -g pwrp /pwrp/arm_linux/exe
- install -d -o pwrp -g pwrp /pwrp/arm_linux/lib
- install -d -o pwrp -g pwrp /pwrp/arm_linux/lis
- install -d -o pwrp -g pwrp /pwrp/arm_linux/obj
- install -d -o pwrp -g pwrp /pwrp/common
- install -d -o pwrp -g pwrp /pwrp/common/db
- install -d -o pwrp -g pwrp /pwrp/common/inc
- install -d -o pwrp -g pwrp /pwrp/common/load
- install -d -o pwrp -g pwrp /pwrp/common/log
- install -d -o pwrp -g pwrp /pwrp/common/loghist
- install -d -o pwrp -g pwrp /pwrp/common/web
- install -d /usr/pwrp
- install -d -o pwrp -g pwrp /usr/pwrp/adm
- install -d -o pwrp -g pwrp /usr/pwrp/adm/db
- install -d /usr/share/doc/pwrrt
- install -D /home/pwrp/proview/etc/* /etc
- install -D /home/pwrp/proview/etc/init.d/* /etc/init.d
- install -D -m 644 /home/pwrp/proview/usr/pwrrt/cnf/proview.cnf /etc
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/* /usr/pwrrt
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/cnf/* /usr/pwrrt/cnf
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/exe/* /usr/pwrrt/exe
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/lib/* /usr/pwrrt/lib
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/load/* /usr/pwrrt/load
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/cnf/op/.??* /usr/pwrrt/cnf/op
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrrt/cnf/user/.??* /usr/pwrrt/cnf/user
- install -D -o pwrp -g pwrp /home/pwrp/proview/usr/pwrp/adm/db/* /usr/pwrp/adm/db
- install -D -m 644 /home/pwrp/proview/usr/share/doc/pwrrt/* /usr/share/doc/pwrrt
- install -D -m 644 /home/pwrp/proview/usr/share/man/man1/* /usr/share/man/man1
- install -D -o pwrp -g pwrp -m 775 /home/pwrp/proview/usr/pwrrt/cnf/user/.??* /home/pwrp
- install -D -o pwrp -g pwrp -m 775 /home/pwrp/proview/usr/pwrrt/cnf/user/* /home/pwrp
- install -D -m 644 /home/pwrp/proview/usr/pwrrt/cnf/user/proview_icon.png /usr/share/pixmaps
- install -D -o pwrp -g pwrp -m 644 /home/pwrp/proview/usr/pwrrt/cnf/user/Proview.desktop /home/pwrp/Desktop
- if [ -f /home/pwrp/pwr_arduino_uno.ino ]
- then
- install -d -o pwrp -g pwrp /home/pwrp/sketchbook
- install -d -o pwrp -g pwrp /home/pwrp/sketchbook/pwr_arduino_uno
- mv /home/pwrp/pwr_arduino_uno.ino /home/pwrp/sketchbook/pwr_arduino_uno
- chown pwrp:pwrp /home/pwrp/sketchbook/pwr_arduino_uno/pwr_arduino_uno.ino
- fi
- save and exit
- scp /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_arm/bld/pkg/pwrrt-.tar.gz pwrp@rpi3:~/proview
- scp /home/pwrp/pwrCustom/installRpi.sh pwrp@rpi3:~/
- ssh rpi3
- cd
- chmod 775 installRpi.sh
- sudo ./installRpi.sh
- sudo update-rc.d pwr defaults
- exit (from ssh session)
- 18) create proof-of-concept Proview project
- logon to dev as pwrp
- one-time fix so plc prog will build:
- mkdir /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64
- mkdir /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64/exp
- mkdir /home/pwrp/pwrrls_4.8.6-3/os_linux/hw_x86_64/exp/exe
- 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
- end one time fix
- on the desktop, double-click Proview V4.8
- accept (and respect) the license terms
- using "PwR Project List":
- enter edit mode
- add a BaseReg object, child to Bases
- open the new object, set attributes:
- ObjectName: BaseV48arm
- Version : X48arm
- Path : /home/pwrp/pwrrls_4.8.6-3
- close the object
- save changes
- note: the new base define is reflected as a new line in /usr/pwrp/adm/db/pwr_projectlist.dat
- the binding to the release build's path is via the "X48arm" token, which will be used below
- add a $Hier object, sibling to Bases
- set ObjectName attribute = "testProjects"
- add a ProjectReg object, child of testProjects
- open new object, set attributes:
- ObjectName : piPOC
- Description: Raspberry Pi Proof of Concept
- Version : X48arm
- (note: Version attr binds the project to the BaseV48arm)
- close the object
- save changes
- Confirm Actions: Yes
- note: the new project is reflected as a new directory tree at /usr/local/pwrp/pipoc
- leave edit mode
- right-click piPOC, pick Open Project
- using "Configure Directory Volume":
- enter "Production QBUS id" = 5 (this is arbitrary, but better than using defaults, for troubleshooting)
- click Next
- click Next
- click No
- click Next
- click Next
- click Skip this node
- click Next
- click Yes
- using "Configure Root Volume":
- pick Operator Station
- click Next
- click Next
- click Next
- using "PwR VolPipoc, pwrp on pipoc":
- from the drop-down menu, pick "File | Volume Attributes..."
- change the "OperatingSystem" attribute to "CustomBuild"
- close the object
- save changes
- close the window
- using "PwR Directory, pwrp on pipoc":
- enter edit mode
- open pipoc object, set attributes:
- NodeName : rpi3 (i.e. the hostname of the target rpi)
- OperatingSystem: CustomBuild
- BootNode: : rpi3
- Address : 192.168.0.1 (i.e. the IPv4 address of the rpi)
- close the object
- add a CustomBuild object as child to pipoc
- open the new object, set attributes:
- ObjectName : build
- cc : /usr/bin/arm-gcc
- cxx : /usr/bin/arm-g++
- ar : /usr/bin/arm-ar
- OperatingSystem: Linux on ARM
- Platform : arm_linux
- Release : X48arm
- close the object
- save changes
- leave edit mode
- right-click "VolPipoc", pick Open Volume
- using "PwR VolPipoc, pwrp on pipoc":
- enter edit mode
- in the right pane, delete the Maintenance object
- in the right pane, delete the OpDefault object
- in the right pane, delete the WebHandler object
- in the right pane, delete the WebBrowser object
- add a XttGraph object as child to Op
- set ObjectName to Display1
- open Op object, set attributes:
- UserName : pwrp
- FastAvail[0] : Nodes-Pipoc-Op-Display1
- close the object
- in the center pane, add a $PlantHier object
- set ObjectName to Bakery
- add a $PlantHier, child to Bakery
- set ObjectName to Signals
- add two Iv objects as children of Signals
- set ObjectName's to Iin and Iout, respectively
- add a PlcPgm object as child of Bakery
- set ObjectName to Plc
- save changes
- leave edit mode
- right-click Bakery-Plc, pick Open Program
- using "Bakery-Plc"
- enter edit mode
- add a GetIv object
- add a StoIv object
- connect the GetIv output to the StoIv input
- from drop-down menu, pick "View | Palette | Plant". Using the right-pane
- plant hierarchy:
- Connect (bind) Signals-Iin to GetIv
- Connect (bind) Signals-Iout to StoIv
- save changes
- leave edit mode
- close the window
- using "PwR VolPipoc, pwrp on pipoc":
- right click Nodes-Op-Display1
- pick "Open Ge..."
- using "PwR Ge display1"
- add two ValueInputMedium objects
- record the coordinates for the area to display, i.e. the area which contains the two objects
- from the drop-down menu, pick "File | Graph Attributes"
- enter the x & y coordinates for this display area
- close the object
- double-click one of the ValueInputMedium objects, set attribute:
- Value.Format : %6d
- close object
- repeat for the other Input object
- View "Plant Hierarchy", select Bakery-Signals-Iin
- press Ctrl key, double-click on first ValInpMed object (binds signal to object)
- repeat, bind Iout to other display object
- pick "File | Save"
- close the window
- using "PwR VolPipoc, pwrp on pipoc":
- from drop-down menu, pick "Functions | Build Node"
- example output as shown in "Proview Development Console":
- Setting base /usr/pwr48
- Open pipoc
- args: pipoc pwrp pwrp
- -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
- Welcome to
- pipoc V4.8 Raspberry Pi Proof of Concept
- Revision history
- 2013-03-09 pwrp Project created
- -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
- -- Processing line: 50
- -- Building volume directory
- -- Opening volume 'VolPipoc'
- Berkeley DB 5.1.29: (October 25, 2011)
- info get: 0
- -- Build node pipoc
- -- Plc window generated Bakery-Plc-W
- /home/pwrp/pwrrls_4.8.6-3 is baseroot
- Setting base /home/pwrp/pwrrls_4.8.6-3
- -- Cross compilation ARM_LINUX
- -- Plc window compiled for arm_linux optimized -O3 Bakery-Plc-W
- /home/pwrp/pwrrls_4.8.6-3 is baseroot
- Setting base /home/pwrp/pwrrls_4.8.6-3
- -- Cross compilation ARM_LINUX
- -- Plc plcpgm compiled for arm_linux optimized -O3 Bakery-Plc
- -- Web startpage generated $pwrp_web/index.html
- /home/pwrp/pwrrls_4.8.6-3 is baseroot
- Setting base /home/pwrp/pwrrls_4.8.6-3
- -- Cross compilation ARM_LINUX
- -- Building archive for volume: 000_001_001_001
- -- Archive built for volume: 000_001_001_001
- -- Working with load file volume 'VolPipoc'...
- -- Open file...
- -- Successfully created load file for volume 'VolPipoc'
- -- 26 objects with a total body size of 26392 bytes were written to new file.
- -- Creating bootfile for node rpi3
- -- Plc thread generated priority 22, scantime 0.10000 s, 1 plcpgm's
- /home/pwrp/pwrrls_4.8.6-3 is baseroot
- Setting base /home/pwrp/pwrrls_4.8.6-3
- -- Cross compilation ARM_LINUX
- -- Plc process compiled for arm_linux optimized -O3 Dummy
- /home/pwrp/pwrrls_4.8.6-3 is baseroot
- Setting base /home/pwrp/pwrrls_4.8.6-3
- -- Cross compilation ARM_LINUX
- -- Plc program linked for arm_linux node plc_rpi3_0005_plc
- -- Build node pipoc
- end example output
- from drop-down menu, pick "Functions | Distribute"
- using "Distributor":
- select rpi3
- from the drop-down menu, pick "Functions | Distribute"
- example output in "Proview Development Console":
- pwrp_pkg_rpi3_0001.tgz 100% 1705KB 1.7MB/s 00:00
- -- No package installed
- -- Installing package pwrp_pkg_rpi3_0001.tgz
- -- Unpack package pwrp_pkg_rpi3_0001.tgz
- -- Move files to target directories
- sudo: no tty present and no askpass program specified
- end example output
- there will be some warnings in Workbench Messages re missing files, ignore these
- exit from the Proview development environment (close all windows in reverse order of opening them)
- 19) run the test project
- connect to rpi3 via vnc client
- nano ~/.xtt_start
- edit the rt_xtt invoke to launch the operator station:
- $pwr_exe/rt_xtt Nodes-Pipoc-Op &
- save changes and exit
- sudo nano /etc/proview.cnf
- edit the qcomBusId to 5
- save changes and exit
- sudo shutdown -r now
- (so the pwr service will pick up the new bus ID)
- connect to rpi3 via vnc client
- start the op station:
- double-click the Proview desktop icon
- launch Display1
- verify manually entering a value in Iin is copied to Iout
- verify manually entering a value in Iout is overwritten by value in Iin
- verify status is green
- note: to reset runtime from an abend:
- source pwr_stop.sh
- ---------------------------------------------------------------------------------------------------
- OK, proof of concept works, let's have another pi do some I/O
- after all, what good is a SCADA system without I/O?
- ---------------------------------------------------------------------------------------------------
-
- 20) Build another rpi (nobody can have just one!), hostname rpi2
- install base OS (item 8 above)
- config new pi for ssh (item 9 above)
- install Proview (item 17 above)
- sudo nano /etc/proview.cnf
- edit the qcomBusId to 5
- save changes and exit
- 21) configure rpi2 for arduino
- login to rpi2 as pwrp
- connect the arduino device
- sudo apt-get install arduino
- launch arduino
- pick "Tools | Board | Arduino Uno"
- pick "Tools | Serial Port | /dev/ttyACM0"
- pick "File | Sketchbook | pwr_arduino_uno"
- in sketch, verify debug assignment is 0
- verify baudRate is 19200
- upload sketch to the arduino
- note: due to the bizarre handling of serial in Linux (i.e. raw, cooked, much interference by software layers, etc.),
- the following config is needed prior to starting the pwr runtime:
- 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
- this config is included in the "pwr" service start script as per edits in sections above.
- (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
- 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.)
- 22) Update Proview project
- logon to dev as pwrp
- launch Proview
- using "PwR Project List"
- from the menu, pick "File | Open | GlobalVolumeList"
- using "PwR Global Volume List"
- enter edit mode
- add a VolumeReg object as sibling of VolPipoc
- open object, set attributes:
- ObjectName : VolPipoc2
- Description : 0.1.1.2 pipoc
- VolumeId : _V0.1.1.2
- Project : pipoc
- close the object
- save changes
- leave edit mode
- close the window
- using "PwR Project List"
- open PiPOC project
- enter edit mode
- add a RootVolumeConfig object as sibling of VolPipoc
- open object, set attribute:
- ObjectName : VolPipoc2
- close the object
- add a NodeConfig object as sibling to pipoc
- open object, set attributes:
- ObjectName : pipoc2
- NodeName : rpi2 (i.e. the hostname of the target rpi)
- OperatingSystem: CustomBuild
- BootNode: : rpi2
- Address : 192.168.0.2 (i.e. the IPv4 address of the rpi)
- close the object
- add a CustomBuild as child to pipoc2
- open object, set attributes:
- ObjectName : build
- cc : /usr/bin/arm-gcc
- cxx : /usr/bin/arm-g++
- ar : /usr/bin/arm-ar
- OperatingSystem: Linux on ARM
- Platform : arm_linux
- Release : X48arm
- close the object
- open pipoc2's RootVolumeLoad object, set attribute:
- ObjectName : VolPipoc2
- close the object
- save changes
- click Yes to "Do you want to create this Volume?"
- leave edit mode
- right click VolPipoc2, pick OpenVolume
- using "Configure Root Volume"
- pick "Operator Station"
- click Next
- click Next
- click Next
- using "PwR VolPipoc2, pwrp on pipoc"
- enter edit mode
- from the drop-down menu, pick "File | Volume Attributes..."
- change the "OperatingSystem" attribute to "CustomBuild"
- close the object
- in the right pane, delete the Maintenance object
- in the right pane, delete the OpDefault object
- in the right pane, delete the WebHandler object
- in the right pane, delete the WebBrowser object
- add a XttGraph object as child to Op
- set ObjectName to Display2
- open Op object, set attributes:
- UserName : pwrp
- AutoStart[0] : Nodes-Pipoc2-Op-Display2
- FastAvail[0] : Nodes-Pipoc2-Op-Display2
- close the object
- add a Arduino_USB object as child of Pipoc2
- open object, set attributes:
- ObjectName : Arduino
- close object
- add a Arduino_Uno object as child of Arduino
- open object, set attributes:
- ObjectName : Uno1
- Device : /dev/ttyACM0
- BaudRate : 19200
- close object
- add a ChanAi object as child of Uno1
- open object, set attributes:
- ObjectName : Ai0
- Number : 0
- RawValRangeLow : 0
- RawValRangeHigh : 1023
- ChannelSigValRangeLow : 0
- ChannelSigValRangeHigh : 5
- SensorSigValRangeLow : 0
- SensorSigValRangeHigh : 5
- ActValRangeLow : 0
- ActValRangeHigh : 1023
- close object
- add a ChanDo object as child of Uno1
- open object, set attributes:
- ObjectName : Do2
- Number : 2
- close object
- add a ChanDi object as child of Uno1
- open object, set attributes:
- ObjectName : Di4
- Number : 4
- close object
- in the center pane, add a $PlantHier object
- set ObjectName to Bakery2
- add a $PlantHier object, child to Bakery2
- set ObjectName to Signals
- add an Ai object as child of Signals
- open object, set attributes:
- ObjectName : Ai0
- SigChanCon : Nodes-Pipoc2-Arduino-Uno1-Ai0
- close object
- add a Di object as child of Signals
- open object, set attributes:
- ObjectName : Di4
- SigChanCon : Nodes-Pipoc2-Arduino-Uno1-Di4
- close object
- add a Do object as child of Signals
- open object, set attributes:
- ObjectName : Do2
- SigChanCon : Nodes-Pipoc2-Arduino-Uno1-Do2
- close object
- add a PlcPgm object as child of Bakery2
- set ObjectName to Plc2
- save changes
- leave edit mode
- right-click Bakery2-Plc, pick Open Program
- using "Bakery2-Plc2"
- enter edit mode
- save changes (there are none - but we need the sub-window to exist)
- leave edit mode
- close the window
- using "PwR VolPipoc, pwrp on pipoc":
- right click Nodes-Op-Display2
- pick "Open Ge..."
- using "PwR Ge display2"
- add one ValueInputMedium object
- add two ValueMedium objects
- note the coordinates for the area to display
- from the drop-down menu, pick "File | Graph Attributes"
- enter the x & y coordinates for display area noted above
- close the object
- double-click the ValueInputMedium object, set attribute:
- Value.Format : %6d
- close object
- repeat for the first ValueMedium object
- repeat with %6.2f for other ValueMedium object
- View Plant Hierarchy, select Bakery2-Signals-Do2
- press Ctrl key, double-click on ValueInputMedium object
- note: this connects the display object to the target plant signal
- repeat, connect Di4 to ValMed, connect Ai0 to other ValMed
- pick "File | Save"
- close the window
- using "PwR VolPipoc2, pwrp on pipoc":
- from drop-down menu, pick "Functions | Build Node"
- from drop-down menu, pick "Functions | Distribute"
- using "Distributor":
- select rpi2
- from the drop-down menu, pick "Functions | Distribute"
- exit from the Proview development environment (close all windows)
- 23) use the Arduino
- connect to rpi2 via VNC X window
- restart the runtime:
- sudo service pwr restart
- hint: if problems, then to get some diagnostics:
- cd
- source pwr_stop.sh
- rt_ini -i &
- ps -ef | grep rt
- edit ~./.xtt_start to launch the operator station windows:
- !/bin/bash
- source /etc/pwrp_profile
- $pwr_exe/rt_xtt Nodes-Pipoc2-Op &
- save changes and exit
- double-click the Proview desktop icon
- in Display2, the analog in value will vary slightly due to noise (unless you have connected a pot or some signal to it)
- experiment with the Di and Do values
- finish