04-24-2020 04:45 AM
Hi. I would like to be able to set the IP Adress and related NIC-parameters of an cDaq9132 which runs Labview's RT-OS. The version is 2018.
I have tried to use the vi which is linked here: https://forums.ni.com/t5/Example-Code/Programmatically-Change-Network-Settings-for-Linux-RT-CompactR...
This works if I start it on my laptop and connect to the RT-Target by using it's IP-Adress. But I want to change the settings from within a vi that runs on the RT-Target itself. This does not work. I tried to use the IP-address of the unit and the phrase "localhost" instead. The message says "cannot find the system" or something similar (don't have the message text here at the moment).
Solved! Go to Solution.
04-25-2020 09:27 AM
Suppose you have two PCs connected to each other using a Cross-over Cable. PC A uses 192.168.1.100, while PC B uses 192.168.1.101. They exchange messages just fine, since A "listens" to B and when something is there, it "reads" B's message, meanwhile sending its messages to B (knowing where B lives).
Now assume B changes its IP to 102. The communication instantly "breaks". A doesn't get any messages from B (because it is "listening" to 1.101, not 1.102), and any request that A sends to B ("Hey, B, where are you?") aren't received (because B is no longer listening on 1.101, where A is sending).
You could, I suppose, have a complicate "Song and Dance" routine. B sends "I'm thinking of changing my IP to 1.102. Is that OK?". A replies "OK, warn me before you do it"). B sends "OK, I'm doing it ...") and does it. The link breaks. Now A tries to establish a new link to 1.102, waiting for B to respond.
This seems very messy to me. When I've done TCP communications, I've always tried to establish the links first, and not change them for the duration of the routine. When running LabVIEW Real-Time code, where there are independent devices communicating over TCP/IP, I use MAX to "search out" devices out there using some protocol that I don't worry about. When it finds a Device, it "knows" how to set low-level "hooks" to it, MAX, can control setting the IP of the Device.
I guess the bottom line is "There Needs to Be a Single Boss when setting up IPs".
Bob Schor
04-25-2020 12:28 PM
Thanks for your answer and I am sure that you are correct. I also use max to set the IP-addresses, but what I am trying to do has another background.
I have created a system that takes dimensions of a product In a rolling mill continuously. The hardware is a cdaq 9132 with RT-Os. It provides the data by being a opc-ua Server. The data can be read by the rolling mills plc and is used to control the roll setting.
If I sell such a system to a customer, then I have to set a static IP adress before shipping, because my customer does not use DHCP in the PLC‘s network. I do this with Ni-Max or I could even use the tool as per the downloading above. But it would be much nicer, if my customer could just start the system an set the IP in the application itself.
04-26-2020 03:00 AM
... and of course I know that my customer could set the IP via the web access through the IE browser, but still this is not very comfortable.
04-28-2020 01:42 PM
Any ideas?
04-28-2020 09:28 PM
As it happens, I'm creating a new LabVIEW-RT routine, and plan to try to have the Host "discover" the Target. I vaguely remember doing this a decade ago, hope to figure it out shortly ...
Bob "Famous Last Words" Schor
04-29-2020 02:35 PM
Ah, I may have been doing the "inverse problem". I'm writing code that will connect to a remote LabVIEW RT Target, and have to know the Target's IP in order to "reach out" and establish contact. You know how MAX can "discover" Remote Targets? LabVIEW can do the same, and it can take 5-10 seconds to do so (in which case you might want to do this once and save the IP in a Config file if you are sure it won't change, just to save time).
As I re-read your question about what you want to do, it occurs to me you are perhaps wanting to do a different thing (but also setup-able, if that's a word, from a Configuration file). Namely you Ship your product, the User runs a little utility that says "Enter the IP of the device you want me to monitor", and it saves it. You'd do this if the device was not "MAX-discoverable", for example.
I assume that if you know the Remote IP (either because you found it in MAX or the User told you want it was), you know how to configure your LabVIEW code to establish a Connection with a Remote Target at that address. So does this "hand-waving" solve your problem?
If, in fact, you want your Shipping Product to "act like MAX and find me all of the Remotes that MAX would find", you need only to use the "Find Systems", which (for me) was under the Real-Time Palette in RT Utilities/System Configuration. I recommend you look at the Help and not accept the default settings (by default, it will return cached systems that might be no longer present).
Bob Schor
04-29-2020 03:08 PM
Hi Bob and once again thanks for your input. I have gone through the labview project which I linked above and took the core steps to create a quite simple vi which allows me to change the IP of one of the two nics of my cdaq 9136 by selecting it by the Mac-Address. I will extend this to a sub vi wich enables me to set some other nic parameters like gateway, dhcp, etc.
I upload this simple solution so anyone who has the same problem may use this as a basis. I don't know if it is coded correctly, but i works.
I am sorry for my wordings in the previous posts which obviously created some misunderstandings. I am German ...
04-30-2020 01:36 PM - edited 04-30-2020 01:36 PM
I wish I would of know that was what you were looking for... I am just finishing up a project that does exactly that (IE configure cRIO NIC)
They make it look so easy in <\LabVIEW 20XX\examples\nisyscfg\Format Real-Time Target.vi> 🙄
06-29-2020 03:43 PM
Thank you Volker64. Your solution helped me.