FogLAMP "expression" C++ Filter plugin
Apply an expression to the data stream.
This filter allows an expression to be defined that can create a new data point within a reading. The expression can use up to 20 data points in the original reading in order to calculate the new data points.
E.g. Assume you have a reading that contains the values Peak and RMS and you wish to create a third data point in each reading which was the peak divided by the RMS. Then the expression wouth be set to
Peak / RMS
and name would be set to the name of the new data point.
Expression may contain any of the following...
- Mathematical operators (+, -, *, /, %, ^)
- Functions (min, max, avg, sum, abs, ceil, floor, round, roundn, exp, log, log10, logn, pow, root, sqrt, clamp, inrange, swap)
- Trigonometry (sin, cos, tan, acos, asin, atan, atan2, cosh, cot, csc, sec, sinh, tanh, d2r, r2d, d2g, g2d, hyp)
The plugin uses the C++ Mathematical Expression Toolkit Library by Arash Partow and is used under the MIT licence granted on that toolkit.
To build FogLAMP "expression" C++ filter plugin:
$ mkdir build $ cd build $ cmake .. $ make
- By default the FogLAMP develop package header files and libraries are expected to be located in /usr/include/foglamp and /usr/lib/foglamp
- If FOGLAMP_ROOT env var is set and no -D options are set, the header files and libraries paths are pulled from the ones under the FOGLAMP_ROOT directory. Please note that you must first run 'make' in the FOGLAMP_ROOT directory.
You may also pass one or more of the following options to cmake to override this default behaviour:
- FOGLAMP_SRC sets the path of a FogLAMP source tree
- FOGLAMP_INCLUDE sets the path to FogLAMP header files
- FOGLAMP_LIB sets the path to FogLAMP libraries
- FOGLAMP_INSTALL sets the installation path of Random plugin
- The FOGLAMP_INCLUDE option should point to a location where all the FogLAMP header files have been installed in a single directory.
- The FOGLAMP_LIB option should point to a location where all the FogLAMP libraries have been installed in a single directory.
- 'make install' target is defined only when FOGLAMP_INSTALL is set
$ cmake ..
no options and FOGLAMP_ROOT set
$ export FOGLAMP_ROOT=/some_foglamp_setup
$ cmake ..
$ cmake -DFOGLAMP_SRC=/home/source/develop/FogLAMP ..
$ cmake -DFOGLAMP_INCLUDE=/dev-package/include ..
$ cmake -DFOGLAMP_LIB=/home/dev/package/lib ..
$ cmake -DFOGLAMP_INSTALL=/home/source/develop/FogLAMP ..
$ cmake -DFOGLAMP_INSTALL=/usr/local/foglamp ..
Packaging for 'expression' filter
This repo contains the scripts used to create a foglamp-filter-expression Debian package.
The make_deb script
Run the make_deb command:
$ ./make_deb help make_deb [help|clean|cleanall] This script is used to create the Debian package of FoglAMP C++ 'expression' filter plugin Arguments: help - Display this help text clean - Remove all the old versions saved in format .XXXX cleanall - Remove all the versions, including the last one $
Building a Package
Finally, run the
$ ./make_deb The package root directory is : /home/ubuntu/source/foglamp-filter-expression The FogLAMP required version : >=1.4 The package will be built in : /home/ubuntu/source/foglamp-filter-expression/packages/build The architecture is set as : x86_64 The package name is : foglamp-filter-expression-1.0.0-x86_64 Populating the package and updating version file...Done. Building the new package... dpkg-deb: building package 'foglamp-filter-expression' in 'foglamp-filter-expression-1.0.0-x86_64.deb'. Building Complete. $
Cleaning the Package Folder
clean option to remove all the old packages and the files used to make the package.
cleanall option to remove all the packages and the files used to make the package.