If you are new to github, then you should read the following link to get an understanding of the workflow required.
https://github.com/emesene/emesene/wiki/GitHowTo#what-should-i-do-if-im-in-a-bad-situation
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tmux git build-essential gcc g++ cmake make xsltproc scons doxygen graphviz libgtk2.0-dev libssl-dev libxml2-dev libcap-dev
mkdir ~/src ~/dev ~/dev/LOGSsudo apt-get update
sudo apt-get upgrade
sudo apt-get install fake_hwclock
sudo systemctl enable fake-hwclock.service
sudo systemctl start fake-hwclock.service
sudo nano /etc/cron.hourly/fake-hwclock
add "fake-hwclock load force" above the save function. Don't include quotes.
``
### Hostname
To make connecting remotely from the local network easier, update the hostname. Modify the hostname under (2. Network Options), (N1 Hostname) in raspi-config.
``` console
sudo raspi-configOnce the hostname has been set use the following tutorial to connect remotelying using putty. Instead of using the IP Address to connect, simplty type the hostname you just used followed by ".local" for putty to find the raspberry pi.
https://www.raspberrypi.org/documentation/remote-access/ssh/windows.md
The DCS used OpenVPN to extend AllJoyn's routing capability to the wide area network. It is not an ideal solution, but it is relativly easy to setup and can handle a couple hundred clients. Request .ovpn file link through PSU powerlab google drive. In the commands below replace and with the actual path to the ovpn file and the actual ovpn file name.
sudo apt-get update
sudo apt-get install openvpn
cd <path>
chmod 700 <client-name>.ovpn
sudo mv <client-name>.ovpn /etc/openvpvNote: the current vpn setup does not allow internet access through the vpn and setting up a split-tunnel with AllJoyn is difficult. Ensure you have updated all the things you need to update before starting the OpenVPN client.
First clone the AllJoyn repository into your /src folder. The run the following "scons" command that corresponds to your processor.
cd ~/src
git clone https://github.com/alljoyn/core-alljoyn
cd core-alljoynscons BINDINGS=cpp WS=off DOCS=htmlscons OS=linux CPU=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- BINDINGS=cpp WS=off DOCS=htmlNote: the CPU variable is dependant on your system.
export CPU=x86_64
export AJ_LIB=~/src/core-alljoyn/build/linux/$CPU/debug/dist/cpp/lib
export LD_LIBRARY_PATH=$AJ_LIB:$LD_LIBRARY_PATH
cd $AJ_LIB
cd ../bin/samples
./AboutServiceIf the BusAttachment/AboutObj succeed, then the installation should be fine.
cd ~/src
git clone https://github.com/stephane/libmodbus
cd libmodbus
sudo apt-get install automake autoconf libtool
./autogen.sh
./configure
sudo make installOpen two terminals run the random-test-server in one and the random-test-client in the other. The client will send a variety of response to the server and should response with test success if all signals are processed correctly.
cd src/libmodbus/tests
sudo ./random-test-servercd src/libmodbus/tests
sudo ./random-test-clientThe boost libraries will be sued to create the XML property trees used for modbus querries. Follow the getting started to download and move the bost libraries into the ~/src directory with other libraries.
https://www.boost.org/doc/libs/1_66_0/more/getting_started/unix-variants.html
cd ~/dev
git clone https://github.com/psu-powerlab/DCS- Open /DCS/tools/build-run.sh
- Modify "CPU" to reflect the system you are working on
- Ensure "AJ_ROOT" path is correct
- The program arguments can be modified to change config file path and enable the auto operator.
The config file holds the initialization variables for the DCS program.
-c ../data/config.ini
-o y/n
Open a terminal an start the vpn client.
sudo openvpn --config /etc/openvpn/<client-name>.ovpnNext open another therminal and start the dcs.
cd ~/dev/DCS/tools
./build-run.shThe program can be controlled three ways:
- The method handlers built into the "Smart Grid Device" that execute when an AllJoyn method call is recieved.
- The Command Line Interface (CLI).
- The Operator that uses a predetermined schedule.
[Help]
> q quit
> h help
> i <watts> import power
> e <watts> export power
> o <y/n> operator enable/disable
> p print properties
Once all dependencies have been satisfied and the DCS will run using the build-run.sh script you can set it as a service that will restart on crash and start on boot. open the dcs.service file and modify paths for the the following:
- ExecStart
- ExecStop
- WorkingDirectory
cd ~/dev/DCS/tools
sudo cp dcs.service /etc/systemd/system/dcs.serviceUse the systemctl command to start the service and then check the status to see if it is running. If successful, the Active: active (running) will show in green. Once everything is running properly, enable the service to have it autostart on boot.
sudo systemctl start dcs.service
sudo systemctl status dcs.service
sudo systemctl enable dcs.serviceThe service will spawn a tmux session that can be attached to to use the CLI of the DCS. To detach from the tmux session hit (ctrl and b) then d. Reference tmux manual for more functionality.
tmux ls
tmux a