Giter Site home page Giter Site logo

Comments (4)

sparvu avatar sparvu commented on July 30, 2024

The slow part comes when getting data from device:

  DB<2>
main::(./rs485rec_2:17):    my $req = $client->read_input_registers(
main::(./rs485rec_2:18):        unit     => 1,
main::(./rs485rec_2:19):        address  => 0,
main::(./rs485rec_2:20):        quantity => 12
main::(./rs485rec_2:21):    );
  DB<2> n
main::(./rs485rec_2:23):    $client->send_request($req);
  DB<2> n
main::(./rs485rec_2:24):    my $resp = $client->receive_response;
  DB<2>

which sometimes ends with this error:

Unit number is invalid at /opt/kronometrix/perl/lib/site_perl/5.20.3/Device/Modbus/RTU.pm line 105.
 at /opt/kronometrix/perl/lib/site_perl/5.20.3/Device/Modbus/ADU.pm line 44.
    Device::Modbus::ADU::unit(Device::Modbus::RTU::ADU=HASH(0x8158d8), 0) called at /opt/kronometrix/perl/lib/site_perl/5.20.3/Device/Modbus/RTU.pm line 105
    Device::Modbus::RTU::parse_header(Device::Modbus::RTU::Client=HASH(0x47acc0), Device::Modbus::RTU::ADU=HASH(0x8158d8)) called at /opt/kronometrix/perl/lib/site_perl/5.20.3/Device/Modbus/Client.pm line 82
    Device::Modbus::Client::receive_response(Device::Modbus::RTU::Client=HASH(0x47acc0)) called at ./rs485rec_2 line 24
Debugged program terminated.  Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
  DB<2> Use 'q' to quit or 'R' to restart.  'h q' for details.

from device-modbus.

sparvu avatar sparvu commented on July 30, 2024

It takes 2minutes+ to read data from this device. Not sure why.

krmx@raspberrypi:~ $ time /opt/kronometrix/bin/rs485rec
$VAR1 = bless( {
                 'message' => bless( {
                                       'values' => [
                                                     17355,
                                                     0,
                                                     16595,
                                                     13107,
                                                     16852,
                                                     0,
                                                     16888,
                                                     0,
                                                     406,
                                                     66,
                                                     265,
                                                     310
                                                   ],
                                       'bytes' => 24,
                                       'code' => 4,
                                       'function' => 'Read Input Registers'
                                     }, 'Device::Modbus::Response' ),
                 'unit' => 1,
                 'crc' => 19068
               }, 'Device::Modbus::RTU::ADU' );

real    2m25.348s
user    0m1.500s
sys 0m0.710s

from device-modbus.

sparvu avatar sparvu commented on July 30, 2024

Trying to read using function 4, I get these values:

krmx@raspberrypi:/opt/kronometrix/bin $ time /opt/kronometrix/bin/rs485rec
timeout=865.4375
timeout=730.875
timeout=596.3125
timeout=461.75
timeout=327.1875
timeout=192.625
timeout=58.0625
timeout=-76.5
$VAR1 = bless( {
#!/opt/kronometrix/perl/bin/perl
                 'unit' => 1,
                 'crc' => 31385,
                 'message' => bless( {
                                       'values' => [
                                                     405,
                                                     66,
                                                     268,
                                                     312
                                                   ],
                                       'code' => 4,
                                       'function' => 'Read Input Registers',
                                       'bytes' => 8
                                     }, 'Device::Modbus::Response' )
               }, 'Device::Modbus::RTU::ADU' );

real    0m23.482s
user    0m0.660s
sys 0m0.080s
krmx@raspberrypi:/opt/kronometrix/bin $ time /opt/kronometrix/bin/rs485rec
timeout=865.4375
timeout=730.875
timeout=596.3125
#!/opt/kronometrix/perl/bin/perl
timeout=461.75
timeout=327.1875
timeout=192.625
timeout=58.0625
timeout=-76.5
Unit number is invalid at /opt/kronometrix/perl/lib/site_perl/5.24.0/Device/Modbus/RTU.pm line 106.

real    0m11.587s
user    0m0.540s
sys 0m0.110s
krmx@raspberrypi:/opt/kronometrix/bin $ time /opt/kronometrix/bin/rs485rec
timeout=865.4375
timeout=730.875
timeout=596.3125
timeout=461.75
timeout=327.1875
timeout=192.625
timeout=58.0625
timeout=-76.5
Unit number is invalid at /opt/kronometrix/perl/lib/site_perl/5.24.0/Device/Modbus/RTU.pm line 106.

real    0m23.480s
user    0m0.670s
sys 0m0.060s
krmx@raspberrypi:/opt/kronometrix/bin $ vi rs485rec
krmx@raspberrypi:/opt/kronometrix/bin $ time /opt/kronometrix/bin/rs485rec
timeout=1865.4375
timeout=1730.875
timeout=1596.3125
timeout=1461.75
timeout=1327.1875
timeout=1192.625
timeout=1058.0625
timeout=923.5
timeout=788.9375
timeout=654.375
timeout=519.8125
timeout=385.25
timeout=250.6875
timeout=116.125
timeout=-18.4375
Unit number is invalid at /opt/kronometrix/perl/lib/site_perl/5.24.0/Device/Modbus/RTU.pm line 106.

real    0m44.478s
user    0m0.810s
sys 0m0.110s
krmx@raspberrypi:/opt/kronometrix/bin $ vi rs485rec
krmx@raspberrypi:/opt/kronometrix/bin $ time /opt/kronometrix/bin/rs485rec
timeout=1365.4375
timeout=1230.875
timeout=1096.3125
timeout=961.75
timeout=827.1875
timeout=692.625
timeout=558.0625
timeout=423.5
timeout=288.9375
timeout=154.375
timeout=19.8125
timeout=-114.75
Unit number is invalid at /opt/kronometrix/perl/lib/site_perl/5.24.0/Device/Modbus/RTU.pm line 106.

real    0m15.272s
user    0m0.590s
sys 0m0.060s
krmx@raspberrypi:/opt/kronometrix/bin $

from device-modbus.

sparvu avatar sparvu commented on July 30, 2024

not an issue anymore. #2

from device-modbus.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.