Missing some parameters in from buffer node nodered

Discussed topic

As Discussed on the pervious topic i understand some knowledge and how to use it but infact of changing everything from Address to address name and setting the offset in buffer node after knowing that it is not getting a list of 10 Address when i join everything together as a example you gave to me infact i run it in a single and joint it to other i found that some Address is making it conflicts and so it gets disappeared in debug node so i removed the conflict
Now the thing is i need to know about M,Y,X also single address which are like D164, D268 which are not in offset things and where buffer parser does not shows them

Sorry, I've read that really long sentence several times but I am struggling to understand what you are asking.

Please provide clear specification and specific questions. Include sample input data, screenshots and expected results (where necessary).

@Steve-Mcl
flows (1).json (52.0 KB)

  • if i joint everything then i get output like this
{"plcname":"Puller6_Unit3","P4 Position":0,"Last Length":0,"pic":0,"P1 Speed":0,"P2 Speed":0,"P3  Speed":0,"P1 Position":2,"P2 Position":0,"P3 Position":0,"P1 Error No":0,"P1 Alram No":0,"P1 Status":0}

  • Else i get the output with remove other stuff and take some so i get the output like below
{"plcname":"Puller6_Unit3","P4 Position":0,"Last Length":0,"pic":0,"P1 Speed":0,"P2 Speed":0,"P3  Speed":0,"P1 Position":0,"P2 Position":0,"P3 Position":0,"P1 Start SET":15,"P1 Drag speed":10,"P2 Start set":20,"P1 Return speed":150,"P2 Drag speed":0,"P2 Return speed":0}

So I really dont understand why it is making a issue.

  • Second thing is that what about single address which if i add it also make a problem

  • Third thing is about Subtracting And Decimal Problem

Again, super unclear. But i will try to decipher.


In your flow you wrote:

I Have this some Single address and i need to know that how to get it displayed in merged as if i used D164,1 then it give me error and if i used D164,2 then it shows a value and 0

  1. Since you have set the buffer Parser to convert the input data to int32(le), it MUST be sent 4 bytes.
    • int32 is 32 bit number. 32 bits is 2x 16 bit or 4x bytes
    • Requesting D164,1 from the PLC returns a single 16bit signed value
    • Thats why you get an error (cannot convert 16bits to 32bits!)
    • QUESTION: What is the value type in the PLC? (is it a 16 bit signed integer? 32 bit integer? float? or ???) - my guess is the PLC value is 16 bit and you simply need to set the Buffer-Parser to int16(le)



In your flow you wrote:

I Have issue about substracting value as the real value show 3619 but i get 13619 and when i substract -10000 it still shows 13619

I Have read it but still did not understand how to put decimal value

  1. How are you subtracting - show me on a screenshot. Include the debug value going IN and OUT of the place you perform the subtraction

  2. for scaling integers to decimal values, enter a division



In your flow you wrote:

I have add D220,49 and i dont know why it does not show me in deubg node

Because you overwrite it in the next block

By adding debug nodes this is VERY easy to see.



In your flow you wrote:

I have this M85,9 but i never used it like above other i need to put name as you gave example like that i used it.

What is stopping you? Set up the buffer parser to extract the bits as per your documentation e.g.

[{"id":"0dc88cd8d42face2","type":"function","z":"12858bec79eb2936","g":"57dccf9b0ad74ea7","name":"merge payloads","func":"msg.payload = {\n    ... msg.payload1,\n    ... msg.payload2,\n    ...msg.payload3,\n        ...msg.payload4,\n                ...msg.payload5,\n        ...msg.payload6,\n        ...msg.payload7,\n        ...msg.payload8,\n\n    //Y: {\n        ...msg.payload9,\n    //}\n    ...msg.m85_bits\n}\ndelete msg.payload1\ndelete msg.payload2\ndelete msg.payload3\ndelete msg.payload4\ndelete msg.payload5\ndelete msg.payload6\ndelete msg.payload7\ndelete msg.payload8\ndelete msg.payload9\ndelete msg.m85_bits\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":1020,"wires":[["daa446284c32ea78"]]},{"id":"213cf6bdc3760de5","type":"change","z":"12858bec79eb2936","g":"57dccf9b0ad74ea7","name":"K4M85","rules":[{"t":"set","p":"topic","pt":"msg","to":"K4M85","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":920,"wires":[["6d85926fb59b7d38"]]},{"id":"cfbffccd939ce196","type":"comment","z":"12858bec79eb2936","g":"57dccf9b0ad74ea7","name":"Read Comment For M,Y","info":"**I have this M85,9 but i never used it like above other i need to put name as you gave example like that i used it.**\n\nSTEVE:\n\nK4 as described in Mitsubishi Manuals means READ 4 nibbles ","x":450,"y":960,"wires":[]},{"id":"6d85926fb59b7d38","type":"link call","z":"12858bec79eb2936","g":"57dccf9b0ad74ea7","name":"Read PLC","links":["6f9a219624cd4334"],"linkType":"static","timeout":"30","x":570,"y":920,"wires":[["294b7c36a294c245"]]},{"id":"294b7c36a294c245","type":"buffer-parser","z":"12858bec79eb2936","g":"57dccf9b0ad74ea7","name":"Convert to named values","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"bool","name":"bit0","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"bool","name":"bit5","offset":0,"length":1,"offsetbit":5,"scale":"1","mask":""},{"type":"bool","name":"bit8","offset":0,"length":1,"offsetbit":8,"scale":"1","mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"m85_bits","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":770,"y":920,"wires":[["0dc88cd8d42face2"]]}]

Why i used K4M85 for the address:

  • The K4 in K4M85 means "4 nibbles" or "4 digits"
  • Each nibble consists of 4 bits, so K4 represents 4 x 4 bits = 16 bits (or 2 bytes, which Mitsubishi also calls a word sometimes, depending on the context).

Therefore, when you see K4M85, it means you're referencing a 16-bit block starting from M85, which includes bits M85 to M100.

Then you can use the buffer-parser to pick out the bits of interest.

@Steve-Mcl
Thanks A Lot for the Explanation, I really want to workout on this and would let you know if i get success.

My 3 Questions are as follows

  • First is that I have an issue in between mc read node shows me not connected and why I don't know as I am using it as a trial base not yet deployed it to a real working plc which consist of the data.
  • Second is why did you use K4M85 only if i had M85 to M100 then how would i write it as you gave me a flow which show a single address but i did not yet understand that if we can take out offsets and byte for tag Address D-- then why cant we do for M,Y,X is it different from that.
  • Third is that why i have to add payload1,2,3,4,5,6,7 etc to a function node which is named as merged payload can we make a better code

@Steve-Mcl
this image you gave me and i did as you explain the thing is that when i subtract it give unwanted values i test in your fake plc data

Below is the example which i tried

flows (1).json (12.0 KB)

the result i got wrong for protecaoa which i tried to subtract by 100 which gave me output -24500

{"extrusionRodNumber":2,"extrusionTime":1200,"temperatureGiven":3.5,"temperatureSetting":360,"rapida":1,"chamdaDe":0,"protecaob":250,"protecaoa":-24500,"freagem":100,"limitPressureOfMasterCylinder":2800,"veloc4":4,"veloc3":3,"veloc2":2,"fillingPressureGiven":1500,"slopeGivenOfBreakthroughPressure":50,"velocityAttenuationRatio":95,"velocityAttenuationStroke":500,"maximumStrokeGiven":1024,"actualValueOfCoil":0,"breakthroughPressure":0,"residualPosition":0,"masterCylinderPosition":10,"rateOfDecay":11,"pressureOfMainCylinder":0,"speedGiven":2500,"settingPointOfCoil":1200,"pressureOfSideCylinder":50,"coilCurrent":1750,"masterCylinderSpeed":0}

You can just do the scaling yourself...

chrome_I3XqRP5oiH

Function

msg.payload.temperatureGiven = msg.payload.temperatureGiven / 100
msg.payload.protecaoa = msg.payload.protecaoa - 100
return msg;

@Steve-Mcl you might missed this post

No i did not, i just did not respond. Your questions are too open and take a lot of time to decipher. And most of them I have already answered or the answer can be worked out by "trying things for yourself"

As it stands, I have already spent many hours supporting you and I feel I have given you all of the help and advice you need to get up and running.

It is now up to you to learn by doing.

Please note, this does not mean i will not help you further, but I will only do so for precise questions, with a single objective and with supporting demo flows and/or screenshots.

@Steve-Mcl
Ok no Problem But the issue i am facing this

  • First is that I have an issue in between mc read node shows me not connected means that when its shows good in between it goes to not connected if this thing happen then it will make me a loss and why I don't know as I am using it as a trial base not yet deployed it to a real working plc which consist of the data.

Start simple.

  1. Disable repeat on the inject.
  2. Disconnect wires so that only 1 read operates
  3. Can you do 1 read?
  4. Connect wire - can you do 2 reads?
  5. Connect wire - can you do 3 reads?
  6. And so on

chrome_9OOtU4z5IY

@Steve-Mcl
I tried it also but still the problem i face so i added a ping node to check if the issues with ipaddress but there is no problem in that , so i need a thing that why it goes is there any thing to do it should not go or if it gos not connected i had to restart nodered for that

This is why i find it difficult to assist.

You say things like "still the problem" but you dont show or explain what "the problem" is.

If you want help, please be clear and include screenshots if necessary.

How about you start by answering the question: "Can you read one thing?"

@Steve-Mcl
Yes i tried with one thing to read and i observe it for whole night everything was perfect to show the payload values but in between the status got change from good to not connected so i tried to restart nodered again and it gets solved but that's not the solution for this.

In between what?

Did the computer go into sleep mode?

Did the network go offline?

For a means of auto recovery, you can use a status node to monitor the MC READ node & send an appropriate disconnect followed by connect as is explained in the built-in help:

INFO: To open / close the MC Protocol connection, send boolean true in msg.connect or msg.disconnect. Alternatively, send string connect or disconnect in msg.topic to the any mc read / mc write node.

Did the computer go into sleep mode?

Did the network go offline?

@Steve-Mcl
No the computer is on and network did not go offline
@Colin
its about mcprotocol read node

@Steve-Mcl
I have use inject node to boolean as msg.connect :true then it did not work for mcprotocol read node

I said...

Show me what you did.

i have done this i dont know where it is proper or not

[
    {
        "id": "9dc7770b4c7c3f93",
        "type": "inject",
        "z": "1d3a5f2487f4631e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "connect",
                "v": "true",
                "vt": "bool"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 620,
        "wires": [
            [
                "4ad9f57b4129d369"
            ]
        ]
    },
    {
        "id": "7bf22ac74850455e",
        "type": "debug",
        "z": "1d3a5f2487f4631e",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 760,
        "wires": []
    },
    {
        "id": "4ad9f57b4129d369",
        "type": "MC Read",
        "z": "1d3a5f2487f4631e",
        "name": "",
        "topic": "",
        "connection": "696ab6a1f1c895a8",
        "address": "payload",
        "addressType": "msg",
        "outputFormat": "1",
        "errorHandling": "throw",
        "outputs": 1,
        "x": 480,
        "y": 640,
        "wires": [
            [
                "7bf22ac74850455e"
            ]
        ]
    },
    {
        "id": "0d7611edc1579fce",
        "type": "inject",
        "z": "1d3a5f2487f4631e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "disconnect",
                "v": "false",
                "vt": "bool"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 680,
        "wires": [
            [
                "4ad9f57b4129d369"
            ]
        ]
    },
    {
        "id": "696ab6a1f1c895a8",
        "type": "MC Protocol Connection",
        "name": "",
        "host": "192.168.2.30",
        "port": "5001",
        "protocol": "TCP",
        "frame": "1E",
        "plcType": "Q",
        "ascii": false,
        "PLCStation": "2",
        "PCStation": "255",
        "PLCModuleNo": "2",
        "network": "2",
        "octalInputOutput": false,
        "timeout": "1000"
    }
]