Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Modbus comunication

Modbus comunication 5 years 2 months ago #10184

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
HI Cleas

I.m trying some mod-bus communication between a solar system and a rpi (proview).
This system delivers Ii values and $values.

The Ii reading works.
But with the String values it is difficult.

The 2 messages have a fix configuration. I have made 2 card-Classes and 2-base classes
and 2 Super-classes

Mb_Solar_Card_C with super-class Mb_Solar_Card
Mb_Solar_Card_I with super-class Mb_Solar_Card

Mb_Solar_Base_C with super-class Mb_Solar_Base
Mb_Solar_Base_I with super-class Mb_Solar_Base

I have also make Mb_Solar_Agent and Mb_Solar_Rack with the necessary c-code.



Fist I used chanBi with BiString80 but when i connect the card values with the base values
the system d't not start.
without the string connection the system works.

to look for a working situation i choose to use,

chanBiBlob and Sv (i made some Sv classes with shorter strings Sv16....)

System runs but NO values in the Mb_Solar_Base_C class.

Only One Bad value in the last item: C_SunSpec_Length .

I also make some print during the startup


cp->ChanListSize = 11 count channels is OK
0 pwr_cClass_ChanBiBlob first detected class is OK
pwr_eType_???????
0 pwr_cClass_ChanIi 2E detected class is OK
pwr_eType_UInt16 ---pwr_eType_???????
0 pwr_cClass_ChanIi 3E detected class is OK
pwr_eType_UInt16 ---pwr_eType_???????
chanp->ChanClass = 0 4E detected class is Can't Find The ChanBiBlob Class
chanp->ChanClass = 0 5E detected class is Can't Find The ChanBiBlob Class
chanp->ChanClass = 0 6E detected class is Can't Find The ChanBiBlob Class
chanp->ChanClass = 0 7E detected class is Can't Find The ChanBiBlob Class
chanp->ChanClass = 0 8E detected class is Can't Find The ChanBiBlob Class
0 pwr_cClass_ChanIi 9E detected class is OK
pwr_eType_UInt16 ---pwr_eType_???????
0 pwr_cClass_ChanIi 10E detected class is OK
pwr_eType_UInt16 ---pwr_eType_???????
0 pwr_cClass_ChanIi 11E detected class is OK
pwr_eType_UInt16 ---pwr_eType_???????


It looks like the only the first class ChanBiBlob is registered and the other 4 not.



Mb_Solar_Base_C.jpg


Mb_Solar_Card_C.jpg



If i make separate communication with only strings i get something to work, but this is not what i want.


I also look in the source code and found some strange thinks:


rt_io_base.c



case pwr_cClass_ChanBo:
sigchancon = ((pwr_sClass_ChanBo *) chan_op)->SigChanCon;
number = *chan_cnt;
break;
case pwr_cClass_ChanBiBlob:
sigchancon = ((pwr_sClass_ChanBiBlob *) chan_op)->AttributeChanCon;
number = 0;
break;
case pwr_cClass_ChanBoBlob:
sigchancon = ((pwr_sClass_ChanBoBlob *) chan_op)->AttributeChanCon;
number = 0;
break;
case pwr_cClass_ChanCo:
sigchancon = ((pwr_sClass_ChanCo *) chan_op)->SigChanCon;
number = *chan_cnt;
break;
default:


maybe has to do with this code....

cees
The administrator has disabled public write access.

Modbus comunication 5 years 2 months ago #10185

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3176
  • Thank you received: 502
  • Karma: 133
Hi cees,

If you use a ChanBiBlob you should only have one blob channel and nothing else. Then you interprete the content yourself in for example a DataArithm.

Otherwise you have to use the ChanBi.

/Claes
The administrator has disabled public write access.

Modbus comunication 5 years 2 months ago #10186

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
Hi Claes

Yes its working with only ChanBiBlob 's
in one MB message:

In stead of creating one Message the example I give you Mb_Solar_Card_C

I Create 4 Messages with Class Mb_Solar_Card (the super class of Mb_Solar_Card_C

Mb_Solar_Card Class has no Channels in it
but i put the as child under this Class

message 1:
Mb_Solar_Card
ChanBiBlob

message 2:
Mb_Solar_Card
ChanIi
ChanIi


etc..


message 1: 1x ChanBiBlob

message 2: 2x ChanIi

message 3: 5x ChanBiBlob

message 4: 3x ChanIi

Its working but not the best solution.


If I use ChanBi instead of ChanBiBlob
The system would startup and gives a error. pwr bugcheck.....

ChanBi solution I will try this option again and give you the bug information later


Question: Why is ChanBiBlob not handeld as other Channels, example ChanIi
in rt_bus_io
and rt_base_io

???


cees
The administrator has disabled public write access.

Modbus comunication 5 years 2 months ago #10187

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
Hi cleas

so
I use ChanBi instead of ChanBiBlob
The system would startup and gives a error. pwr bugcheck.....

hier the configuration
ChanBi_2019-02-14.jpg


and this error i get:


File Attachment:

File Name: error.txt
File Size: 3 KB



After deleting all the SigChanCon(s) from the class BiString80
the system startup and runs without errors.

Also the MB communication and memory copying to Inputs(array) is working I can read the information in the array

cees
Attachments:
Last Edit: 5 years 2 months ago by seec.
The administrator has disabled public write access.

Modbus comunication 5 years 2 months ago #10188

  • seec
  • seec's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 78
  • Karma: 0
Hi Claes

I make some analyses


c-code:

File Attachment:

File Name: listclasses.txt
File Size: 1 KB



and the next result I get:


File Attachment:

File Name: listclassesresult.txt
File Size: 0 KB



It looks like pwr_cClass_ChanBi is not found

With: default:
printf("chanp->ChanClass = %d\n", (int) chanp->ChanClass);
break;


I get the Class reference number.


Cees
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 7.796 seconds