Done
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,7 +28,6 @@
|
|||||||
.idea/
|
.idea/
|
||||||
.idea_/
|
.idea_/
|
||||||
.vs/
|
.vs/
|
||||||
.vscode/
|
|
||||||
__history/
|
__history/
|
||||||
__recovery/
|
__recovery/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "iir1"]
|
||||||
|
path = iir1
|
||||||
|
url = https://github.com/berndporr/iir1.git
|
||||||
19
.vscode/c_cpp_properties.json
vendored
Normal file
19
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Linux-GCC",
|
||||||
|
"includePath": ["${workspaceFolder}/**", "/opt/opendaq/include/", "${workspaceFolder}/iir1/"],
|
||||||
|
"defines": ["MODULE_PATH=\"/opt/opendaq/lib/modules\""],
|
||||||
|
"compilerPath": "/usr/bin/g++",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++17",
|
||||||
|
"intelliSenseMode": "gcc-x64",
|
||||||
|
"browse": {
|
||||||
|
"path": ["${workspaceFolder}"],
|
||||||
|
"limitSymbolsToIncludedHeaders": true,
|
||||||
|
"databaseFilename": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
33
.vscode/launch.json
vendored
Normal file
33
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "(gdb) Launch",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/app",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceFolder}/build",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
80
.vscode/settings.json
vendored
Normal file
80
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"cmath": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"span": "cpp",
|
||||||
|
"regex": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"charconv": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"unordered_set": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"format": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"future": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"numbers": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"semaphore": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"stop_token": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"variant": "cpp",
|
||||||
|
"executor": "cpp",
|
||||||
|
"io_context": "cpp",
|
||||||
|
"netfwd": "cpp",
|
||||||
|
"timer": "cpp",
|
||||||
|
"filesystem": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
29
.vscode/tasks.json
vendored
Normal file
29
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "run",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "./fb_application_example",
|
||||||
|
"options": {"cwd": "${workspaceFolder}/build/bin"},
|
||||||
|
"dependsOn":["build"],
|
||||||
|
"group": {
|
||||||
|
"kind": "test",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "make",
|
||||||
|
"options": {"cwd": "${workspaceFolder}/build"},
|
||||||
|
"args": ["-j12"],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -31,12 +31,13 @@ if(OPENDAQ_FB_EXAMPLE_ENABLE_APP)
|
|||||||
set(DAQMODULES_REF_DEVICE_MODULE ON CACHE BOOL "" FORCE)
|
set(DAQMODULES_REF_DEVICE_MODULE ON CACHE BOOL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(external)
|
|
||||||
find_package(openDAQ)
|
find_package(openDAQ)
|
||||||
add_compile_definitions(MODULE_PATH="${OPENDAQ_MODULES_DIR}")
|
add_compile_definitions(MODULE_PATH="${OPENDAQ_MODULES_DIR}")
|
||||||
|
|
||||||
add_subdirectory(example_module)
|
add_subdirectory(example_module)
|
||||||
|
|
||||||
|
add_subdirectory(iir1)
|
||||||
|
|
||||||
if(OPENDAQ_FB_EXAMPLE_ENABLE_APP)
|
if(OPENDAQ_FB_EXAMPLE_ENABLE_APP)
|
||||||
message(STATUS "Enabled example function block application")
|
message(STATUS "Enabled example function block application")
|
||||||
add_subdirectory(example_application)
|
add_subdirectory(example_application)
|
||||||
|
|||||||
BIN
OD_task.pdf
Normal file
BIN
OD_task.pdf
Normal file
Binary file not shown.
10
TODO.md
Normal file
10
TODO.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
sudo apt remove opendaq
|
||||||
|
|
||||||
|
cmake -DOPENDAQ_FB_EXAMPLE_ENABLE_APP=ON ..
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://rosettacode.org/wiki/Apply_a_digital_filter_(direct_form_II_transposed)#C++
|
||||||
@@ -5,22 +5,34 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <opendaq/opendaq.h>
|
#include <opendaq/opendaq.h>
|
||||||
|
|
||||||
|
using namespace std::literals::chrono_literals;
|
||||||
using namespace daq;
|
using namespace daq;
|
||||||
|
|
||||||
int main(int /*argc*/, const char* /*argv*/[])
|
int main(int /*argc*/, const char* /*argv*/[])
|
||||||
{
|
{
|
||||||
const auto instance = InstanceBuilder().addModulePath(MODULE_PATH).build();
|
const InstancePtr instance = InstanceBuilder().addModulePath(MODULE_PATH).build();
|
||||||
auto referenceDevice = instance.addDevice("daqref://device0");
|
|
||||||
auto renderer = instance.addFunctionBlock("RefFBModuleRenderer");
|
|
||||||
auto exampleModule = instance.addFunctionBlock("ExampleScalingModule");
|
|
||||||
exampleModule.setPropertyValue("Scale", 3);
|
|
||||||
exampleModule.setPropertyValue("Offset", -2);
|
|
||||||
|
|
||||||
exampleModule.getInputPorts()[0].connect(referenceDevice.getSignalsRecursive()[0]);
|
DevicePtr device = instance.addDevice("daqref://device0");
|
||||||
renderer.getInputPorts()[0].connect(referenceDevice.getSignalsRecursive()[0]);
|
|
||||||
renderer.getInputPorts()[1].connect(exampleModule.getSignals()[0]);
|
|
||||||
|
|
||||||
std::cout << "Press \"enter\" to exit the application..." << std::endl;
|
ChannelPtr channel = device.getChannels()[0];
|
||||||
std::cin.get();
|
|
||||||
|
SignalPtr signal = channel.getSignals()[0];
|
||||||
|
|
||||||
|
FunctionBlockPtr renderer = instance.addFunctionBlock("RefFBModuleRenderer");
|
||||||
|
FunctionBlockPtr module = instance.addFunctionBlock("ExampleIIRFilter");
|
||||||
|
|
||||||
|
module.setPropertyValue("CutoffFrequency", 10);
|
||||||
|
|
||||||
|
module.getInputPorts()[0].connect(signal);
|
||||||
|
renderer.getInputPorts()[0].connect(signal);
|
||||||
|
renderer.getInputPorts()[1].connect(module.getSignals()[0]);
|
||||||
|
|
||||||
|
|
||||||
|
// Set the frequency to 5 Hz
|
||||||
|
channel.setPropertyValue("Frequency", 5);
|
||||||
|
// Set the noise amplitude to 0.75
|
||||||
|
channel.setPropertyValue("NoiseAmplitude", 0.75);
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(5s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <opendaq/function_block_impl.h>
|
#include <opendaq/function_block_impl.h>
|
||||||
#include <opendaq/opendaq.h>
|
#include <opendaq/opendaq.h>
|
||||||
#include <opendaq/stream_reader_ptr.h>
|
#include <opendaq/stream_reader_ptr.h>
|
||||||
|
#include <iir/Butterworth.h>
|
||||||
|
|
||||||
BEGIN_NAMESPACE_EXAMPLE_MODULE
|
BEGIN_NAMESPACE_EXAMPLE_MODULE
|
||||||
|
|
||||||
@@ -50,8 +51,7 @@ private:
|
|||||||
std::vector<uint64_t> inputDomainData;
|
std::vector<uint64_t> inputDomainData;
|
||||||
|
|
||||||
bool configValid = false;
|
bool configValid = false;
|
||||||
Float scale;
|
Float cutoffFrequency;
|
||||||
Float offset;
|
|
||||||
Float outputHighValue;
|
Float outputHighValue;
|
||||||
Float outputLowValue;
|
Float outputLowValue;
|
||||||
Bool useCustomOutputRange;
|
Bool useCustomOutputRange;
|
||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
void createSignals();
|
void createSignals();
|
||||||
|
|
||||||
void calculate();
|
void calculate();
|
||||||
void processData(SizeT readAmount, SizeT packetOffset) const;
|
void processData(SizeT readAmount, SizeT packetOffset);
|
||||||
void processEventPacket(const EventPacketPtr& packet);
|
void processEventPacket(const EventPacketPtr& packet);
|
||||||
|
|
||||||
void processSignalDescriptorChanged(const DataDescriptorPtr& dataDescriptor,
|
void processSignalDescriptorChanged(const DataDescriptorPtr& dataDescriptor,
|
||||||
@@ -72,6 +72,8 @@ private:
|
|||||||
void initProperties();
|
void initProperties();
|
||||||
void propertyChanged(bool configure);
|
void propertyChanged(bool configure);
|
||||||
void readProperties();
|
void readProperties();
|
||||||
|
|
||||||
|
Iir::Butterworth::LowPass<4> filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
END_NAMESPACE_EXAMPLE_MODULE
|
END_NAMESPACE_EXAMPLE_MODULE
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ if (MSVC)
|
|||||||
target_compile_options(${LIB_NAME} PRIVATE /bigobj)
|
target_compile_options(${LIB_NAME} PRIVATE /bigobj)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${LIB_NAME} PUBLIC daq::opendaq
|
find_package(iir)
|
||||||
)
|
target_link_libraries(${LIB_NAME} PUBLIC daq::opendaq iir::iir_static)
|
||||||
|
|
||||||
target_include_directories(${LIB_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
target_include_directories(${LIB_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
BEGIN_NAMESPACE_EXAMPLE_MODULE
|
BEGIN_NAMESPACE_EXAMPLE_MODULE
|
||||||
ExampleFBImpl::ExampleFBImpl(const ContextPtr& ctx, const ComponentPtr& parent, const StringPtr& localId)
|
ExampleFBImpl::ExampleFBImpl(const ContextPtr& ctx, const ComponentPtr& parent, const StringPtr& localId)
|
||||||
: FunctionBlock(CreateType(), ctx, parent, localId)
|
: FunctionBlock(CreateType(), ctx, parent, localId)
|
||||||
{
|
{
|
||||||
initComponentStatus();
|
initComponentStatus();
|
||||||
createInputPorts();
|
createInputPorts();
|
||||||
@@ -14,14 +14,9 @@ BEGIN_NAMESPACE_EXAMPLE_MODULE
|
|||||||
|
|
||||||
void ExampleFBImpl::initProperties()
|
void ExampleFBImpl::initProperties()
|
||||||
{
|
{
|
||||||
const auto scaleProp = FloatProperty("Scale", 1.0);
|
const auto scaleProp = FloatProperty("CutoffFrequency", 1.0);
|
||||||
objPtr.addProperty(scaleProp);
|
objPtr.addProperty(scaleProp);
|
||||||
objPtr.getOnPropertyValueWrite("Scale") +=
|
objPtr.getOnPropertyValueWrite("CutoffFrequency") +=
|
||||||
[this](PropertyObjectPtr& obj, PropertyValueEventArgsPtr& args) { propertyChanged(true); };
|
|
||||||
|
|
||||||
const auto offsetProp = FloatProperty("Offset", 0.0);
|
|
||||||
objPtr.addProperty(offsetProp);
|
|
||||||
objPtr.getOnPropertyValueWrite("Offset") +=
|
|
||||||
[this](PropertyObjectPtr& obj, PropertyValueEventArgsPtr& args) { propertyChanged(true); };
|
[this](PropertyObjectPtr& obj, PropertyValueEventArgsPtr& args) { propertyChanged(true); };
|
||||||
|
|
||||||
const auto useCustomOutputRangeProp = BoolProperty("UseCustomOutputRange", False);
|
const auto useCustomOutputRangeProp = BoolProperty("UseCustomOutputRange", False);
|
||||||
@@ -61,8 +56,7 @@ void ExampleFBImpl::propertyChanged(bool configure)
|
|||||||
|
|
||||||
void ExampleFBImpl::readProperties()
|
void ExampleFBImpl::readProperties()
|
||||||
{
|
{
|
||||||
scale = objPtr.getPropertyValue("Scale");
|
cutoffFrequency = objPtr.getPropertyValue("CutoffFrequency");
|
||||||
offset = objPtr.getPropertyValue("Offset");
|
|
||||||
useCustomOutputRange = objPtr.getPropertyValue("UseCustomOutputRange");
|
useCustomOutputRange = objPtr.getPropertyValue("UseCustomOutputRange");
|
||||||
outputHighValue = objPtr.getPropertyValue("OutputHighValue");
|
outputHighValue = objPtr.getPropertyValue("OutputHighValue");
|
||||||
outputLowValue = objPtr.getPropertyValue("OutputLowValue");
|
outputLowValue = objPtr.getPropertyValue("OutputLowValue");
|
||||||
@@ -72,7 +66,7 @@ void ExampleFBImpl::readProperties()
|
|||||||
|
|
||||||
FunctionBlockTypePtr ExampleFBImpl::CreateType()
|
FunctionBlockTypePtr ExampleFBImpl::CreateType()
|
||||||
{
|
{
|
||||||
return FunctionBlockType("ExampleScalingModule", "Scaling", "Signal scaling");
|
return FunctionBlockType("ExampleIIRFilter", "Scaling", "Signal scaling");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExampleFBImpl::processSignalDescriptorChanged(const DataDescriptorPtr& dataDescriptor,
|
void ExampleFBImpl::processSignalDescriptorChanged(const DataDescriptorPtr& dataDescriptor,
|
||||||
@@ -145,15 +139,15 @@ void ExampleFBImpl::configure()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto outputHigh = scale * static_cast<Float>(inputDataDescriptor.getValueRange().getLowValue()) + offset;
|
auto outputHigh = static_cast<Float>(inputDataDescriptor.getValueRange().getLowValue());
|
||||||
auto outputLow = scale * static_cast<Float>(inputDataDescriptor.getValueRange().getHighValue()) + offset;
|
auto outputLow = static_cast<Float>(inputDataDescriptor.getValueRange().getHighValue());
|
||||||
if (outputLow > outputHigh)
|
if (outputLow > outputHigh)
|
||||||
std::swap(outputLow, outputHigh);
|
std::swap(outputLow, outputHigh);
|
||||||
|
|
||||||
outputRange = Range(outputLow, outputHigh);
|
outputRange = Range(outputLow, outputHigh);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto name = outputName.empty() ? inputPort.getSignal().getName().toStdString() + "/Scaled" : outputName;
|
auto name = outputName.empty() ? inputPort.getSignal().getName().toStdString() + "/Filtered" : outputName;
|
||||||
auto unit = outputUnit.empty() ? inputDataDescriptor.getUnit() : Unit(outputUnit);
|
auto unit = outputUnit.empty() ? inputDataDescriptor.getUnit() : Unit(outputUnit);
|
||||||
|
|
||||||
outputDataDescriptor = DataDescriptorBuilder()
|
outputDataDescriptor = DataDescriptorBuilder()
|
||||||
@@ -172,6 +166,9 @@ void ExampleFBImpl::configure()
|
|||||||
inputData.resize(sampleRate);
|
inputData.resize(sampleRate);
|
||||||
inputDomainData.resize(sampleRate);
|
inputDomainData.resize(sampleRate);
|
||||||
|
|
||||||
|
|
||||||
|
filter.setup(sampleRate, cutoffFrequency);
|
||||||
|
|
||||||
setComponentStatus(ComponentStatus::Ok);
|
setComponentStatus(ComponentStatus::Ok);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
@@ -208,17 +205,20 @@ void ExampleFBImpl::calculate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExampleFBImpl::processData(SizeT readAmount, SizeT packetOffset) const
|
void ExampleFBImpl::processData(SizeT readAmount, SizeT packetOffset)
|
||||||
{
|
{
|
||||||
if (readAmount == 0)
|
if (readAmount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto outputDomainPacket = DataPacket(outputDomainDataDescriptor, readAmount, packetOffset);
|
const DataPacketPtr outputDomainPacket = DataPacket(outputDomainDataDescriptor, readAmount, packetOffset);
|
||||||
const auto outputPacket = DataPacketWithDomain(outputDomainPacket, outputDataDescriptor, readAmount);
|
const DataPacketPtr outputPacket = DataPacketWithDomain(outputDomainPacket, outputDataDescriptor, readAmount);
|
||||||
auto outputData = static_cast<Float*>(outputPacket.getRawData());
|
Float* outputData = static_cast<Float*>(outputPacket.getRawData());
|
||||||
|
|
||||||
for (size_t i = 0; i < readAmount; i++)
|
for (size_t i = 0; i < readAmount; i++)
|
||||||
*outputData++ = scale * static_cast<Float>(inputData[i]) + offset;
|
{
|
||||||
|
// *outputData++ = static_cast<Float>(inputData[i]);
|
||||||
|
*outputData++ = filter.filter(inputData[i]);
|
||||||
|
}
|
||||||
|
|
||||||
outputSignal.sendPacket(outputPacket);
|
outputSignal.sendPacket(outputPacket);
|
||||||
outputDomainSignal.sendPacket(outputDomainPacket);
|
outputDomainSignal.sendPacket(outputDomainPacket);
|
||||||
@@ -243,8 +243,8 @@ void ExampleFBImpl::createInputPorts()
|
|||||||
|
|
||||||
void ExampleFBImpl::createSignals()
|
void ExampleFBImpl::createSignals()
|
||||||
{
|
{
|
||||||
outputSignal = createAndAddSignal("Scaled");
|
outputSignal = createAndAddSignal("Filtered");
|
||||||
outputDomainSignal = createAndAddSignal("ScaledTime", nullptr, false);
|
outputDomainSignal = createAndAddSignal("FilteredTime", nullptr, false);
|
||||||
outputSignal.setDomainSignal(outputDomainSignal);
|
outputSignal.setDomainSignal(outputDomainSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,20 +10,20 @@ using ExampleModuleTest = testing::Test;
|
|||||||
TEST_F(ExampleModuleTest, TestAdd)
|
TEST_F(ExampleModuleTest, TestAdd)
|
||||||
{
|
{
|
||||||
const auto instance = Instance();
|
const auto instance = Instance();
|
||||||
ASSERT_TRUE(instance.addFunctionBlock("ExampleScalingModule").assigned());
|
ASSERT_TRUE(instance.addFunctionBlock("ExampleIIRFilter").assigned());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ExampleModuleTest, TestPropCount)
|
TEST_F(ExampleModuleTest, TestPropCount)
|
||||||
{
|
{
|
||||||
const auto instance = Instance();
|
const auto instance = Instance();
|
||||||
auto fb = instance.addFunctionBlock("ExampleScalingModule");
|
auto fb = instance.addFunctionBlock("ExampleIIRFilter");
|
||||||
ASSERT_EQ(fb.getAllProperties().getCount(), 7);
|
ASSERT_EQ(fb.getAllProperties().getCount(), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ExampleModuleTest, TestDataScaling)
|
TEST_F(ExampleModuleTest, TestDataScaling)
|
||||||
{
|
{
|
||||||
const auto instance = Instance();
|
const auto instance = Instance();
|
||||||
auto fb = instance.addFunctionBlock("ExampleScalingModule");
|
auto fb = instance.addFunctionBlock("ExampleIIRFilter");
|
||||||
fb.setPropertyValue("Scale", 2);
|
fb.setPropertyValue("Scale", 2);
|
||||||
|
|
||||||
auto dataDescriptor = DataDescriptorBuilder().setSampleType(SampleType::Float32).setValueRange(Range(-10, 10)).build();
|
auto dataDescriptor = DataDescriptorBuilder().setSampleType(SampleType::Float32).setValueRange(Range(-10, 10)).build();
|
||||||
|
|||||||
10
external/CMakeLists.txt
vendored
10
external/CMakeLists.txt
vendored
@@ -1,10 +0,0 @@
|
|||||||
set(CMAKE_FOLDER external)
|
|
||||||
list(APPEND CMAKE_MESSAGE_CONTEXT external)
|
|
||||||
|
|
||||||
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|
||||||
message(FATAL_ERROR "In-source build is not supported!")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
add_subdirectory(openDAQ)
|
|
||||||
12
external/openDAQ/CMakeLists.txt
vendored
12
external/openDAQ/CMakeLists.txt
vendored
@@ -1,12 +0,0 @@
|
|||||||
set(OPENDAQ_ENABLE_TESTS false)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
openDAQ
|
|
||||||
GIT_REPOSITORY https://github.com/openDAQ/openDAQ.git
|
|
||||||
GIT_TAG v3.20.2
|
|
||||||
GIT_PROGRESS ON
|
|
||||||
SYSTEM
|
|
||||||
FIND_PACKAGE_ARGS 3.20.2 GLOBAL
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(openDAQ)
|
|
||||||
1
iir1
Submodule
1
iir1
Submodule
Submodule iir1 added at bb21b64ea2
32
notes.md
Normal file
32
notes.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
Po instalaciji opendaq-3.30.apt
|
||||||
|
|
||||||
|
in poskusu compile quick_start_full.cpp ne najde work_impl.h obstaja v dir
|
||||||
|
|
||||||
|
dobim error
|
||||||
|
```
|
||||||
|
In file included from /home/nik/Downloads/naloga/examples/applications/cpp/quick_start/quick_start_full.cpp:2:
|
||||||
|
/opt/opendaq/include/opendaq/work_factory.h:20:10: fatal error: opendaq/work_impl.h: No such file or directory
|
||||||
|
20 | #include <opendaq/work_impl.h>
|
||||||
|
| ^~~~~~~~~~~~~~~~~~~~~
|
||||||
|
compilation terminated.
|
||||||
|
make[2]: *** [CMakeFiles/quick_start_full.dir/build.make:76: CMakeFiles/quick_start_full.dir/quick_start_full.cpp.o] Error 1
|
||||||
|
make[1]: *** [CMakeFiles/Makefile2:115: CMakeFiles/quick_start_full.dir/all] Error 2
|
||||||
|
make: *** [Makefile:91: all] Error 2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
[tid: 8406][2026-02-23 11:39:09.966] [ModuleManager] [warning] Failed to check for network settings: open: Operation not permitted [system:1 at /__w/openDAQ/openDAQ/build/__external/src/Boost/libs/asio/include/boost/asio/detail/reactive_socket_service.hpp:133 in function 'open']
|
||||||
|
|
||||||
|
|
||||||
|
sudo apt-get install libudev-dev
|
||||||
|
sudo apt-get install libfreetype6-dev
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Odstranil sem buildanje opendaq in uporabil installiranega
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user