Skip to content
Snippets Groups Projects
Commit ab5cf008 authored by Armin Co's avatar Armin Co
Browse files

Scripts

Install script
Control script to turn off the windmill or everything.
parent c4fd1828
Branches
No related tags found
No related merge requests found
...@@ -10,30 +10,17 @@ include_directories(src) ...@@ -10,30 +10,17 @@ include_directories(src)
include_directories(libs/spdlog/include) include_directories(libs/spdlog/include)
include_directories(src/observ) include_directories(src/observ)
include_directories(src/com)
add_library(soc_com
src/com/Protocol.cpp
src/com/ProtocolSgm.cpp
src/com/Socket.cpp)
# Test application to manually send commands to the Arduino # Test application to manually send commands to the Arduino
add_executable(manual_control src/manual_control/ComTest.cpp) add_executable(manual_control src/manual_control/ComTest.cpp)
target_link_libraries(manual_control spdlog) target_link_libraries(manual_control spdlog)
add_executable(sample_client
src/manual_control/sample_client.cpp
src/com/Socket.cpp
src/com/Protocol.cpp
)
target_link_libraries(sample_client spdlog)
# Smart Grid Simulation # Smart Grid Simulation
include_directories(src/i2c) include_directories(src/i2c)
include_directories(src/smart_grid) include_directories(src/smart_grid)
# Add OPC UA # Add OPC UA
option(BUILD_OPC_UA "Build OPC UA library" OFF) option(BUILD_OPC_UA "Build OPC UA library" ON)
if(BUILD_OPC_UA) if(BUILD_OPC_UA)
macro(SET_OPTION option value) macro(SET_OPTION option value)
set(${option} ${value} CACHE "" INTERNAL FORCE) set(${option} ${value} CACHE "" INTERNAL FORCE)
...@@ -49,23 +36,14 @@ if(BUILD_OPC_UA) ...@@ -49,23 +36,14 @@ if(BUILD_OPC_UA)
add_subdirectory(libs/freeopcua) add_subdirectory(libs/freeopcua)
endif(BUILD_OPC_UA) endif(BUILD_OPC_UA)
# add_executable(opc_server.exe src/apps/SmgOPC_server/opc_server.cpp)
# target_include_directories(opc_server.exe PUBLIC libs/freeopcua/include)
# target_link_libraries(opc_server.exe opcuacore opcuaserver)
add_executable(smart_grid.exe add_executable(smart_grid.exe
src/apps/smart_grid/smg_server.cpp src/apps/smart_grid/smg_server.cpp
src/apps/smart_grid/SmgStateMachine.cpp src/apps/smart_grid/SmgStateMachine.cpp
src/apps/smart_grid/SmartOpcServer.cpp src/apps/smart_grid/SmartOpcServer.cpp
src/smart_grid/SmartGridModel.cpp src/smart_grid/SmartGridModel.cpp
src/i2c/Node.cpp src/i2c/Node.cpp
src/com/Socket.cpp
src/com/Protocol.cpp
src/smart_grid/HardwareControl.cpp src/smart_grid/HardwareControl.cpp
) )
# target_link_libraries(smart_grid.exe PRIVATE spdlog)
target_compile_options(smart_grid.exe PRIVATE -Wall -Wextra -pedantic)
target_include_directories(smart_grid.exe PUBLIC libs/freeopcua/include) target_include_directories(smart_grid.exe PUBLIC libs/freeopcua/include)
target_link_libraries(smart_grid.exe PUBLIC opcuacore opcuaserver) target_link_libraries(smart_grid.exe PUBLIC opcuacore opcuaserver)
#!/bin/bash
echo "Turning everything off.."
for i in {0..60}
do
./manual_control $i 0 > /dev/null
done
echo "done!"
#!/bin/bash
echo "Installing Smart Grid OPC UA Server"
start_dir=$(pwd)
if cd build
then
# Build dir already exists..
cd ..
else
# Create build directory.
mkdir build
fi
cd build
cmake ..
make -j2
# copy executable into build dir
cp libs/freeopcua/bin/smart_grid.exe ./
cd $start_dir
\ No newline at end of file
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
#include "i2c/Node.hpp" #include "i2c/Node.hpp"
#include "HardwareControl.hpp" #include "HardwareControl.hpp"
#include "Socket.hpp"
#include "Protocol.hpp"
#include "SmartGridModel.hpp" #include "SmartGridModel.hpp"
#include "SmgStateMachine.hpp" #include "SmgStateMachine.hpp"
#include "SmartOpcServer.hpp" #include "SmartOpcServer.hpp"
...@@ -17,26 +14,18 @@ ...@@ -17,26 +14,18 @@
/// ///
void log_args(int argc, char **argv) void log_args(int argc, char **argv)
{ {
// spdlog::debug("User arguments:");
// for (int i = 0; i < argc; ++i)
// {
// spdlog::debug("[{}] {}", i, argv[i]);
// }
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// spdlog::set_level(spdlog::level::info);
// spdlog::info("Starting - Smart Grid Modell");
// log_args(argc, argv);
uint8_t slave_address{0x14}; uint8_t slave_address{0x14};
i2c::Node i2c_channel{slave_address}; i2c::Node i2c_channel{slave_address};
if (false == i2c_channel.open_device("/dev/i2c-1")) if (false == i2c_channel.open_device("/dev/i2c-1"))
{ {
exit(1); exit(1);
} }
std::cout << "At least hardware works!" << std::endl; std::cout << "Starting OPC server.." << std::endl;
HardwareControl hardware{i2c_channel}; HardwareControl hardware{i2c_channel};
SmartGridModel model{hardware}; SmartGridModel model{hardware};
......
#!/bin/bash
echo "Turning Windmill off!"
./build/manual_control 2 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment