NodeRED, Network Variables and CC100

Hello

Trying to send some values from NodeRED to CODESYS through network variables and have followed this tutorial: Using Node-RED with Network Variables - YouTube

I want to send from NodeRED running on the same PLC that will recieve the values.

I have changed the list identifier to 3 and the names of the tags in the NVL export before importing it again.

Recieving is no problem, however I don’t get the sending to function properly. The ID-number in the netvar-sender block i NR must correspond to what is seen in the NVL reciever struct in Codesys if I have understood this correct, according to the tutorial the ID number should be 2970419.

But this variable is 0 when I look it up in Codesys.
Device.Application.NetVar_Application_GVL.NetVarManager_UDP_MainTask_0.dwIdentity

When I try to inject the netvar-send I get this error
image

I have started NodeRED with this command

docker run --restart unless-stopped -d --name node-red --network=host --security-opt seccomp:unconfined -v node_red_user_data:/data nodered/node-red:latest-minimal --log-opt max-size=10m --log-opt max-file=5

Hello,
Please see this discussion on similar topic.

Can you confirm you are using two different ports for send & recieve?

2 Likes

No, I hade the same port-number on send and recieve. Tried to change it to 1400 but no change, but I get another error:

image

I have setup like this now:

image

IP-adress is the PLCs IP

image

In Codesys in the NVL sender GVL. These values were default 0 and port 1202. But this seems to be the port for sending data?

Maybe try to run netstat -tulpn to see if another service is using port 1400 ?
And also docker ps -a, maybe you have a somehow a remaining old Node-red container using the same port ?

During development, I have found that when changing ports in NR and Codesys, it is often necessary to reboot the PFC to fully close the old ports and open the new ones. It might start working after a reboot.

1 Like

there is another parser node-red-contrib-nvl that is much easier to use. You just need to type list id and paste NVL content.

2 Likes