|
|
Re: Problems to compile FORTE+Modbus [message #1817295 is a reply to message #1816300] |
Wed, 20 November 2019 05:07 |
jagadish kavalath Messages: 2 Registered: November 2019 |
Junior Member |
|
|
Hi ,
I am facing build errors with modbus enabled in FORTE. Please help if there is any update on this issue
=======================================================================
[ 95%] Building CXX object src/CMakeFiles/FORTE_LITE.dir/modules/modbus/modbuslayer.cpp.o
In file included from /home/user/4diac/forte/src/modules/modbus/modbusclientconnection.h:16:0,
from /home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:14:
/home/user/4diac/forte/src/modules/modbus/modbustimedevent.h:45:16: error: field 'm_oStartTime' has incomplete type 'SForteTime'
SForteTime m_oStartTime;
^~~~~~~~~~~~
In file included from /home/user/4diac/forte/src/core/../arch/../core/extevhan.h:17:0,
from /home/user/4diac/forte/src/core/../arch/timerha.h:17,
from /home/user/4diac/forte/src/core/monitoring.h:22,
from /home/user/4diac/forte/src/core/utils/../resource.h:21,
from /home/user/4diac/forte/src/core/utils/../device.h:16,
from /home/user/4diac/forte/src/core/utils/extevhandlerhelper.h:17,
from /home/user/4diac/forte/src/core/cominfra/comlayer.h:21,
from /home/user/4diac/forte/src/modules/modbus/modbuslayer.h:16,
from /home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:12:
/home/user/4diac/forte/src/core/../arch/../core/devexec.h:19:8: note: forward declaration of 'struct SForteTime'
struct SForteTime;
^~~~~~~~~~
In file included from /home/user/4diac/forte/src/modules/modbus/modbusclientconnection.h:16:0,
from /home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:14:
/home/user/4diac/forte/src/modules/modbus/modbustimedevent.h:46:16: error: field 'm_oUpdateInterval' has incomplete type 'SForteTime'
SForteTime m_oUpdateInterval;
^~~~~~~~~~~~~~~~~
In file included from /home/user/4diac/forte/src/core/../arch/../core/extevhan.h:17:0,
from /home/user/4diac/forte/src/core/../arch/timerha.h:17,
from /home/user/4diac/forte/src/core/monitoring.h:22,
from /home/user/4diac/forte/src/core/utils/../resource.h:21,
from /home/user/4diac/forte/src/core/utils/../device.h:16,
from /home/user/4diac/forte/src/core/utils/extevhandlerhelper.h:17,
from /home/user/4diac/forte/src/core/cominfra/comlayer.h:21,
from /home/user/4diac/forte/src/modules/modbus/modbuslayer.h:16,
from /home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:12:
/home/user/4diac/forte/src/core/../arch/../core/devexec.h:19:8: note: forward declaration of 'struct SForteTime'
struct SForteTime;
^~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp: In member function 'unsigned int forte::com_infra::CModbusComLayer::convertDataInput(void*, unsigned int, TForteUInt16*)':
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:67:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteUInt16) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:73:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteInt16) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:79:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteUInt16) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:85:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteUInt16) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:92:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteInt16) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:98:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteUInt16) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:104:43: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteWord) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:111:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteInt32) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:117:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteUInt32) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:123:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteDWord) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:129:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteFloat) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:136:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteInt64) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:142:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteUInt64) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:148:44: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteLWord) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:154:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
outLength += sizeof(TForteDFloat) / 2;
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp: In member function 'virtual forte::com_infra::EComResponse forte::com_infra::CModbusComLayer::processInterrupt()':
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:177:39: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(bool);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:181:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteInt8);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:185:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteInt16);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:189:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteInt32);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:193:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteInt64);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:197:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteUInt8);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:201:47: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteUInt16);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:205:47: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteUInt32);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:209:47: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteUInt64);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:213:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteByte);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:217:45: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteWord);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:221:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteDWord);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:225:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteLWord);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:229:46: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteFloat);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:233:47: warning: conversion to 'unsigned int' from 'long unsigned int' may alter its value [-Wconversion]
dataIndex += sizeof(TForteDFloat);
^
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp: In member function 'virtual forte::com_infra::EComResponse forte::com_infra::CModbusComLayer::openConnection(char*)':
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:363:92: error: no matching function for call to 'CModbusClientConnection::CModbusClientConnection(CModbusHandler&)'
m_pModbusConnection = new CModbusClientConnection(getExtEvHandler<CModbusHandler>());
^
In file included from /home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:14:0:
/home/user/4diac/forte/src/modules/modbus/modbusclientconnection.h:35:14: note: candidate: CModbusClientConnection::CModbusClientConnection(CModbusHandler*)
explicit CModbusClientConnection(CModbusHandler* pa_modbusHandler);
^~~~~~~~~~~~~~~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbusclientconnection.h:35:14: note: no known conversion for argument 1 from 'CModbusHandler' to 'CModbusHandler*'
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:382:95: warning: conversion to 'TForteUInt32 {aka unsigned int}' from 'long int' may alter its value [-Wconversion]
static_cast<CModbusClientConnection*>(m_pModbusConnection)->addNewPoll(commonParams.m_nPollFrequency, commonParams.m_nFuncCode, commonParams.m_nReadStartAddress[i], commonParams.m_nReadNrAddresses[i]);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp: In member function 'int forte::com_infra::CModbusComLayer::processClientParams(char*, forte::com_infra::CModbusComLayer::STcpParams*, forte::com_infra::CModbusComLayer::SRtuParams*, forte::com_infra::CModbusComLayer::SCommonParams*)':
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:566:24: warning: conversion to 'int' from 'size_t {aka long unsigned int}' may alter its value [-Wconversion]
int paramLen = strlen(readAddresses);
~~~~~~^~~~~~~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:589:20: warning: conversion to 'int' from 'size_t {aka long unsigned int}' may alter its value [-Wconversion]
paramLen = strlen(writeAddresses);
~~~~~~^~~~~~~~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp: In member function 'int forte::com_infra::CModbusComLayer::findNextStartAddress(const char*, int)':
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:647:25: warning: conversion to 'int' from 'size_t {aka long unsigned int}' may alter its value [-Wconversion]
int strLength = strlen(&pa_acParam[pa_nStartIndex]);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:652:35: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
return pch - &pa_acParam[0] + 1;
~~~~~~~~~~~~~~~~~~~~~^~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp: In member function 'int forte::com_infra::CModbusComLayer::findNextStopAddress(const char*, int)':
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:661:25: warning: conversion to 'int' from 'size_t {aka long unsigned int}' may alter its value [-Wconversion]
int strLength = strlen(&pa_acParam[pa_nStartIndex]);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:667:38: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
return pchDot - &pa_acParam[0] + 2;
~~~~~~~~~~~~~~~~~~~~~~~~^~~
/home/user/4diac/forte/src/modules/modbus/modbuslayer.cpp:671:38: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
return pchDot - &pa_acParam[0] + 2;
~~~~~~~~~~~~~~~~~~~~~~~~^~~
src/CMakeFiles/FORTE_LITE.dir/build.make:11390: recipe for target 'src/CMakeFiles/FORTE_LITE.dir/modules/modbus/modbuslayer.cpp.o' failed
make[2]: *** [src/CMakeFiles/FORTE_LITE.dir/modules/modbus/modbuslayer.cpp.o] Error 1
CMakeFiles/Makefile2:177: recipe for target 'src/CMakeFiles/FORTE_LITE.dir/all' failed
make[1]: *** [src/CMakeFiles/FORTE_LITE.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
user@user-OptiPlex-3050:~/4diac/forte/bin/posix$
|
|
|
|
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1818714 is a reply to message #1818656] |
Tue, 24 December 2019 11:55 |
|
Thanks for the hint. I'll try to fix that in the cmake setup for modbus_ng in the near future. As this is work in progress and an early stage I fear we don't have that fbs yet. However with the information given in the cpp files you can reconsruct the FBs and adapters for 4diac IDE as SIFB rather easily.
|
|
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1821838 is a reply to message #1821834] |
Fri, 21 February 2020 00:10 |
joy woo Messages: 198 Registered: May 2019 |
Senior Member |
|
|
actully, i worked base on the older version of 1.10 version, with 1.11 version there are many imcompliant problems with the modulebus module,
because of the intreval calculation&update(separate for different devices, i didn't check it carefully) way had changed in 1.11 version. so if i have time, maybe i can try on the latest version
[Updated on: Fri, 21 February 2020 00:11] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822789 is a reply to message #1822788] |
Fri, 13 March 2020 14:32 |
Paulo Louro Messages: 31 Registered: February 2020 |
Member |
|
|
modbustimedevent.cpp: like 35.
It crashs after calling the getForteTime;
void CModbusTimedEvent::activate(){
m_oStartTime = CTimerHandler::smFORTETimer->getForteTime();
m_bIsStarted = true;
}
This is also changed in the modbuslayer.cpp:: 392
CModbusHandler& handler = getExtEvHandler<CModbusHandler>();
CModbusHandler* h = &handler;
m_pModbusConnection = new CModbusClientConnection(h);
[Updated on: Fri, 13 March 2020 14:33] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822798 is a reply to message #1822796] |
Fri, 13 March 2020 15:31 |
joy woo Messages: 198 Registered: May 2019 |
Senior Member |
|
|
@Paulo LouroFriend
it worked in 1.10 , then i didn't use this modbus module but program it myself, then upgrade it to 1.11.0, i remember the smFORTETimer principle in 1.11 was difference with 1.10,
in 1.10 smFORTETimer is a static variable created in CDeviceExecution, but there is not any more in 1.11, so why i said it worked in 1.10, the timer princple is totally different.
1.10:
CDeviceExecution::CDeviceExecution(){
memset(mRegisteredEventHandlers, 0, sizeof(SEventHandlerElement) * cg_unNumberOfHandlers);
CDeviceExecution::createHandlers(*this);
getTimer().enableHandler();
if(0 == CTimerHandler::smFORTETimer){
CTimerHandler::smFORTETimer = &getTimer(); //used for develog, CIEC_TIME() and in Modbus
}
}
1.11 not exist
i will check it tommrow, it's too late here
[Updated on: Fri, 13 March 2020 15:31] Report message to a moderator
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822799 is a reply to message #1822797] |
Fri, 13 March 2020 15:36 |
|
Paulo Louro wrote on Fri, 13 March 2020 15:16Thats it, now its working. I will try to revert back to develop branch and make the same changes, to see if it compiles and works.
If it works there es well please provide a patch so that we have some working modbus version.
|
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822815 is a reply to message #1822800] |
Fri, 13 March 2020 23:09 |
joy woo Messages: 198 Registered: May 2019 |
Senior Member |
|
|
I have compared the source code, just recover the smFORTETimer part source code is ok to read result. and i don't know if you have more than one slave,
if you put more than one client FB, then it will cause the concurrent problem,
because the modbus is not full-duplex and you should leave duration to let the read operation to be finished.
so i think there are two options for you, the simplest one is program it yourself,
because the default modbus module did the most of the work, just new
a custom FB and , and create the read/write logic by seqence, i use CThread::sleepThread(35); between the slaves reading.
the second option is in a old post on this forum, ng-modbus, its for tcp/ip,
mine is rtu, so i didn't use it, maybe you can try.
-
Attachment: devexec.cpp
(Size: 2.66KB, Downloaded 100 times)
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822820 is a reply to message #1822819] |
Sat, 14 March 2020 10:58 |
joy woo Messages: 198 Registered: May 2019 |
Senior Member |
|
|
the parameter 0:15, that means we want to read 16 inputs value, that's according to your device, it should keep the same, if you only have 8 inputs but read 16, that also can't get correct result.
i only tested function code 3 and 2, function 3 with my device return 16bit number, i have to use a custom FB to convert to value, such as:
V1() = Registers() & 1;
V2() = Registers() & 2;
V3() = Registers() & 4;
V4() = Registers() & 8;
V5() = Registers() & 16;
V6() = Registers() & 32;
V7() = Registers() & 64;
V8() = Registers() & 128;
V9() = Registers() & 256;
V10() = Registers() & 512;
V11() = Registers() & 1024;
V12() = Registers() & 2048;
V13() = Registers() & 4096;
V14() = Registers() & 8192;
V15() = Registers() & 16384;
V16() = Registers() & 32768;
if you use function 2, i copied Client_1 to Client_16 and add other 15 RD_1.。。RD_15,
then could see the input values.
function code 1 can read single input value.
modbus-ng
https://www.eclipse.org/forums/index.php?t=msg&th=1101083&goto=1818052&#msg_1818052
before you use this, you have to create a custom fb according to the source code. there is no template so far
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822884 is a reply to message #1822874] |
Mon, 16 March 2020 11:16 |
|
hey these are great news. i really have to fix it and get it into the main git.
the idea of the new IO infrastructure is that the names you give the IO blocks are mapped to the IOs provide by the fieldbusses/IO subsystem. Therefore we can now separate better between IO configuration and application needs.
Your IO FBs for mod-bus should have a string input for each IO value they provide. Here you can specifiy the name of the IO FB used in your FB. During initialisation it should lead to an automatic mapping.
|
|
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822989 is a reply to message #1822976] |
Tue, 17 March 2020 16:40 |
|
Ah sorry for the little explanation. As this is a new concept we are still working on ramping stuff up.
i don't have the modbus fbs but I tried to show an example with the EMBrick system which works similar.
So first of all we have the IO System configuration separated from the IO usage. You can see this in my attached image with the bottom part a resource in my device where I configure the available physical IOs. The bus master defines things like the port, the scan cycle, etc. With the adapter connection you can specify which IO modules are connected on the bus. In my case the first IO module is a 8 digital in 8 digital output module. You can have more of these IO module FBs daisy chained. With that you tell the bus master what IO modules to expect and what data to read.
In your application (top part in my screenshot) you use the IO FBs that you are used to (e.g., IX, QX, IW). The big difference is that you are not useing the params input anymore. With the instance name of the FB you specifiy a symbolic name of your IO in the application.
In order to link both parts together you now have to give at the inputs of your IO module FB the according name. you can see this in my figure where i mapped the IX block SensorIn to the digital input #4 of my IO module and the QX block LED to the Digtial output 6.
I hope this clarifies a few things.
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1822998 is a reply to message #1822994] |
Tue, 17 March 2020 19:50 |
|
Hey Paulo,
I'm happy that this brought you forward. The slave FBs have to be specific for your device. Therefore the first patch doesn't have one. The second patch which you are mentioning contains as example a slave, namely a FESTo CMMP drive. You can use that as starting point for developing your own slave. However I must confess I haven't done that by myself either.
|
|
|
|
Re: Problems to compile FORTE+Modbus [message #1823056 is a reply to message #1823046] |
Wed, 18 March 2020 22:47 |
|
This looks strange. Because the ModbusMaster should send events to the slave. however it could also be that the device needs to be addressed correctly. Maybe the code in the slave is very specific to the FEST CMMP drive. With what device do you like to communicate?
|
|
|
|
|
|
|
|