Jump to content

pascal

Members
  • Posts

    97
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by pascal

  1. In my opinion, like the sequenc to "stop the motor and reverse the direction with another speed", you have to check this in accordance with the machine you want to control.

    first you have to stop the engine,

    then , when checked the motor is topped, sending the new speed and afterwards, setting the run command.

    If you want to take full control of the modbus communication, you have to create your own routines to make the modbus com.

    In fact, it's really simple.....

    modbus tcp/ip communication goes with a TCP connection and sending following data :

    image.png.79ab44b1d9f4980be2e5f14e57fd5f53.png

    transaction ID and protocol are 00 00 00 00

    message :

    first byte is function code (like 03 for read holding register)

    second word (2 bytes) is startadres

    last word (2 bytes) number of words to read...

    check this manual  https://www.fernhillsoftware.com/help/drivers/modbus/modbus-protocol.html

    If you want to be sure, maybe packetsender(external free software found on the internet) can help you to send the commands to your machine and see how it reacts....

  2. I had a similar "problem"

    I made a calendar as a indexed table, with 366 days (so it's always a leap year)

    to know the index of the current day, I take the day of the month and add a fixed value corresponding the actual month.....

    so if we are may 2, then I add 91 minus 1 and my index in my data table is 92....

    used a switch case....

    image.png.cab071419a6fc3b894c63660b67bc816.png

  3. 10 hours ago, kvlada said:

    Ah yes, that's it. Thank you @Saragani! ❤️

    Why I couldn't do it, is that I forgot the "Properties Window" on the right, I have to select proper data type in there. Otherwise it won't work!

    Now I have additional question: can I have multiple struct types as inputs to a for-each loop? Because I've defined one struct for "current" data which isn't retained, and other one with different settings data which *is* retained. For example: Run, Feedback, RPM, CurrentLoad... are stored in a non-retained struct, and data like WorkingHours, OnDelayTime, IsMonitored, ... are stored in retained struct. I've done this to save memory space, because max space for retained vars is less than non-retained.

    If this isn't possible then,... I might have to merge these two structs into one which is wholly retained. Or are there any other workarounds? Can I have structs within structs? Or an array of structs?

    unfortunately, you can't have a struct in a struct.... nor an array of structs 😒

  4. have you tried to do it with aperiodic sending ?

    I don't know if the periodic sending is done on how you program your modbus thing.

    If you program a aperiodic, then you send your group in 1 command.

    but like ausman said -> maybe a good idea to send it with a pc software

  5. Gabriel,

    when you carefully read the alicat manual, you must send 2 modbus commands to set the setpoint...

    you must send the first 2 bytes to adress 1010 and the second 2 bytes to adress 1011... (i think) (taking care of big or little endian)

    so you can not send a real, but 2 int16 variables ! so you have to split your real into 2 int16 variables

    image.png.26457d0a25147b75de21a170f67085f8.png

     

  6. Hi Ivgeny,

    Thanks for your reply. Indeed, I think I have, like you said, to use the message composer for publishing nested structs in JSON and send them as raw data.

    I only have 1 question about the message composer -> you can scan a message, but what with receiving a variable as ascii, but the length of the ascii can be different...

    the ascii variable in JSON is always between "", but I don't see how to program this. I thought the ascii variable has a fixed length in message composer ?

  7. Hi,

    I want to communicate with a IoT trough MQTT. I managed to send simple JSON commands, but i'm looking how to configure more difficult JSON structs...

    I want to send this telegram to my IoT device, but I don't have any idea how to setup my json struct....

    has to look like this.....

    {

        "FountainSchema": {

            "enable_pump_1": true,

            "startclock_pump_1": "08:30:00",

            "stopclock_pump_1": "14:00:00",

            "enable_remote_frequency": false,

            "remote_frequency": 32.8

        }

    }

    I know I can make a struct like this :

    enable_pump_1 = BIT

    startclock_pump_1 = ascii[8]

    stopclock_pump_1 = ascii[8]

    enable_remote_frequency = BIT

    remùote_frequency= BIT

     

    but how do I get the tag FountainSchema into my json struct ?

    like I want to receive some publications made from my IoT device :

    {

      "metrics" : [ {

        "name" : "response",

        "tags" : {

          "organization_id" : 1,

          "company_id" : 1,

          "tasktype_id" : 91,

          "service_id" : 77,

          "project_id" : 501,

          "task_id" : 1659,

          "property_id" : 111,

          "propertytype_id" : 999

        },

        "fields" : {

          "measurement" : "switch_pump_1",

          "value" : 5,

          "type" : "switch"

        },

        "timestamp" : "2024-02-14T14:45:16.000Z"

      } ]

    }

    how and where do I program my JSON struct  I want to publish or to subscribe ?

     

  8. I've made a routine - a for each loop - with a list of tags including buffer tags and real tags.

    I want to copy one tag (real) into a data table with the instruction Set DTI column value

    B = real value C= real value of the structure  current item

    image.png.34a728a13536294e37c347c959dc254e.png

    after compiling I get a lot of errors....

    image.thumb.png.79af4eadb4903866b252c1c43c8fceac.png

    as you can see, 118 error's........

    But I found a solution -> store the real tag of my structure into a local real tag and then put this tag as value to store (C), then I have no error's.....

    Good to know, so I wanted to share this with thee community (or maybe this is a bug?)

  9. Hi,

    I have a table with all my IP adress of all my connected things.

    I made a webpage, showing my table with all the IP adresses 

    when clicking on a field in the table, I put the IPadress (ASCII) into a tag -> IP adres (reading the selected row of the datatable)

    on the webpage a put a hyperlink "GO TO" with the adress of this hyperlink the value of tag IP adress

    but when clicking on the hyperlink, he's calling another IP adress.....

    I did an inspect of the webpage (clicking right mouse button 😁) and found something strange....

    image.thumb.png.0054c5e4574b9445749640adeb3e6696.png

    BUT I FOUND a solution ? -> the problem is the leading zero's of the IP adres in my tag....

    when I remove the leading zero's, then I have a correct hyperlink (only tried one (172.20.25.40)

    image.thumb.png.3dad5a46f9f73d26950fdee90ea34936.png

     

    something to keep in mind...

  10. Elad,

    with UaExpert, when disconnecting the server, my counters goes from 2 to 1 (because kepware is also connected)...

    But ....

    today I was trying some more things on my kepware and everything is working fine now.

    The thing is, I didn't changed anything. Not on my PLC and not on my Kepware...

    (altough I deleted on PLC side some  not used communication protocols ( on CPU, deleted 1 UDP port I didn't used anymore and 1 TCP server with 16 number of connections, also didn't used))

    Last friday this hadn't brought me a solution.

    When I started checking on monday again, suddenly it worked ???????

    strange.....

    I still have to check some things with our IT department to know why it works (now).....

    I'm not accusing somebody, but most of my communication problems are IT related 😁😁😁(and they never never did something) 

    PS

    When I had al the trouble (last week) and I disconnected Kepware and my UaExpert, the number of connected clients went from 2 to 1(unclean exit Kepware and clean exit of UAexpert), but after the not clean disconnection of Kepware I couldn't even connect again with UaExpert....

    I'll keep you all informed of my situation.....

    TO BE CONTINUED....

     

  11. i'm using OPC-UA, but I don't see any certificates....

    altough my system is reading the OPC-UA variables without problem....

    (unless I disconnect my OPC-UA client -> see my post on Unilogic software)

    i'm trying to copy my opc ua clients certificate to the PLC, but I don't know in wich directory I should place the certificate on my usb...

  12. Hi,

    my system : USP-104-X10 with B10

    I have 3 PLC's (all same model and firmware (1.33.161)) communicating via OPC UA server with Kepware

    Everything is working perfectly.....until I stop my Kepware (to do some upgrading or other stuff)

    When I shutdown my Kepware I see following OPC-AU diagnostics differences :

    PLC A :

    image.thumb.png.8690ce540a7700168ddd88db830b2c3c.png

    PLC  B:

    image.thumb.png.51a83ac28414c0082356d17e32441e6f.png

     

    You see the difference in the current session of current subscription count -> PLC A is 0 and on PLC B it stays on 1....

    When I restart my Kepware, I'm able to reconnect on PLC A, but not on B !

    My Kepware gives me following error

    image.thumb.png.3172e69bbdfe8302c4910ba65c1a3df3.png

    (PLC B is GBS UNI BD1)

    The PLC B is actually refusing the communication

    The only thing is to give a cold boot on the PLC B to restart my communication...

    I checked (several times already 😒😒😒) all parameters (on PLC side and on KEPWARE) but all are the same...

    any suggestions ?

     

  13. image.thumb.png.1b66442dc3ba23b733280a99d5c522a5.png

     

    about the type of operation -> just read holding register (type 3 of modbus)

    I read my weather station every 10 seconds

    my float type is here NONE, but this is made with a previous version of unilogic, where I had to make my own swap "thing"

    So no program is needed, only configuration...

    that's all you need to do....

    If you have a incorrect status of your modbus slave,  try to change the address you want to read....

    sometimes the manual say's it starts at adres 1, but in modbus language it could be address 0 (or 2 ?)

     

  14. ROG,

    very simple :

    make a variable, type buffer, length 4

    image.png.012359ad1a54a2bc5a90653a3f44ca67.png

    address -> depending on the data sheet of your PH meter

    depending on the modbus type, you need to change float type -> if the ph meter sends first the MSB or the LSB ???

    a float is made of 4 bytes -> how it is build check this url  https://www.h-schmidt.net/FloatConverter/IEEE754.html

    after knowing how your meter is transmitting the bytes, then you can chose the correct type of float type

    and in your ladder -> image.png.4b90fc3d1d3760476d6e02a1c00c112c.png

    just copy buffer to tag..... that's it....

  15. Ballza,

    URA-0400T -> 4 inputs 0..20mA or 4..20mA

    You use a  linearize function with

    a = reading input URA 0400T, b= value 0 (if it's 0mA) c= depends of your analog device when it's 0mA D=65535 (16 bits = 20mA) and E the value of your analog device when he outputs 20mA

    if your device is 20mA = 100°C of 100 bar -> then you say value E=100x10 = 1000

    When showing the value on screen or webserver -> you choose decimal point location= 1

    it's that simple....

    • Like 1
  16. hare1978,

    the modbus communication gives -> error 3 = illegal data value.....

    I see you want data of adress 1....

    Sometimes the adresses of the modbus registers starts at 0, instead of 1... This is depending of the manufacturer of your modbus device.....

    I should try using adress 0 and see what happens....

    Maybe the length of the received bytes isn't what you expect ? 

    image.png.ec93bb6e8841e23dfdcb36ac33a795db.png

     

  17. Hi GermanM,

    You HAVE to use struct's !

    When calling a function, you don't use every variable of that struct as seperate Function_in, but only the struct itself...

    image.png.4af3019fe3dfe87bf9a3775a8b16f079.png

    when you change something of the data of your "input" struct variable (like in my case here "hgrp 2 PR spots") after quitting the function, the values are changed also

    my struct has several ints, bits, reals, text.....

    I call the function call scene check with the variable struct hgrp 2... , do something in that function, like setting a bit, changing text or whatever

    after calling the function, the bit's are set, text has changed....

     

    advantage of using structs -> you can use them in data tables.... easy for debugging, just make a screen of that table and you see all variables of your structs (same structs of course)

     

     

     

  18. On 4/16/2023 at 4:52 AM, Joe Tauser said:

    The I/O scheme you've shown will work just fine.

    You'll be pleasantly surprised with how easy the URB adapters are to work with.  You define everything in UniStream and assign IP addresses to each URB, and then plug them all in.  They work great.

    This is actually the real problem.  In the US, UniStream I/O is still running at 8-24+ weeks delivery, depending on the part number.  That will affect your Comms modules, which are on the 24+ side right now.   Your distributor should be able to give you an answer on the Ethernet I/O.

    Joe T.

      

    I prefer the TCP/URB IO modules instead of the "local" IO modules of unistream PLC's

    -> the analog output modules (like ARU-0004X) are galvanic isolated , the  UIA-0006 are not (already blown a few up😒😒)

    Remember that you can only use max. 8 URB/TCP modules connected to one PLC....

    another advantage -> when you loose connection with a URB adapter, the rest is still available.... 

  19. 22 hours ago, MELDAW said:

    So you created 40 PID with diffrent parametres? 

    yes I have (altough every PID uses the same pid auto_parameters)

    for each PID i have to connect the proces value, set point,.... and run the PID

    and this 40 times.....

    I tried to make a subroutine with al these parameters as input variables and in the subroutine call PID -> not working

  20. Meldaw,

    I had the same "issue"

    I control 40 heaters with a pid, so I made 1 subroutine that i called 40 times with different parameters.....

    DIDN'T work !!!!!

    For each process, you have to use a different PID ! PID is running in background of PLC -> so you can't use 1 PID with different IO's....

×
×
  • Create New...