Issues with status node

Hi,
I have configured status nodes in my flow to monitor plc nodes like "pccc" but its doesn't seem to work. The message generated by the node is "undefined".

the "show node status " is enabled in the settings .

What could be the issue?...I am looking to use the status message to pass a null value to MSSQL when the plc connection drops.

Did you set the debug node to complete msg object ?

@bakman2,
I am able to monitor the complete message object now but need a little assistance in meeting the requirement. My flow is as given below:

[
    {
        "id": "3f52fcdee953d32c",
        "type": "status",
        "z": "924e3c32cfb47491",
        "name": "",
        "scope": [
            "66d6e76f56adf489"
        ],
        "x": 120,
        "y": 180,
        "wires": [
            [
                "ab68851ac24be479"
            ]
        ]
    },
    {
        "id": "ab68851ac24be479",
        "type": "function",
        "z": "924e3c32cfb47491",
        "name": "function 36",
        "func": "var log =msg.status\nglobal.set(\"plc_status\",log)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 200,
        "wires": [
            [
                "da02219844b2f66d"
            ]
        ]
    },
    {
        "id": "da02219844b2f66d",
        "type": "debug",
        "z": "924e3c32cfb47491",
        "name": "debug 12",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 220,
        "wires": []
    },
    {
        "id": "66d6e76f56adf489",
        "type": "pccc in",
        "z": "924e3c32cfb47491",
        "endpoint": "094e77d0aee89ede",
        "mode": "single",
        "variable": "plc",
        "diff": false,
        "name": "",
        "x": 110,
        "y": 80,
        "wires": [
            [
                "e57cf786ef412ec1"
            ]
        ]
    },
    {
        "id": "e57cf786ef412ec1",
        "type": "function",
        "z": "924e3c32cfb47491",
        "name": "",
        "func": "var status=global.get('plc_status');\n\nif(status.text==\"failure\")\n{\n    global.set(\"plc\", null);\n}\nelse\n global.set(\"plc\", msg.payload);\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "094e77d0aee89ede",
        "type": "pccc endpoint",
        "address": "192.168.4.108",
        "port": "44818",
        "userouting": false,
        "routingbuf": "[1,0]",
        "cycletime": "5000",
        "timeout": "1500",
        "name": "",
        "vartable": [
            {
                "addr": "F8:1",
                "name": "plc"
            }
        ]
    }
]

What I am trying to do is pass a null value to the global variable "plc" when the connection to the plc (allen bradely micrologix 1400) drops.

The status text shows "failure" when it disconnects but the global variable "plc_status" retains its past value.

Hi,
The 'Change' node has an option for Delete (as well as Change and Move).
I think that's what you need to do.

Cheers,

Paul

I guess , I can use the "Change" node properly only if the status of plc nodes are picked up properly ..need help there!!

Hi,

Try using the 'Switch' node to do an 'IF'... I.e. 'If the value of variable A is lower than X then set the value of my special variable to 1'.

Cheers,

Paul

@ Paul ...got it to work with a switch and change node.

One thing that I noticed was there is no discontinuity in the chart even though I pass null values to variables when the plc disconnects. This might lead to a wrong interpretation of data by the user.
Any workarounds for this issue?

Hi,

You will always need to treat NULL, 0, and no signal differently in any reporting / charting application.

I think a more robust method is to use positive integers only and map anything outside of those to 'no data' or 'error'.

NULL is also an often-used state in databases when no data has been written to that column / row yet - you can get tripped up there as well.

Cheers,

Paul

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.