Jump to content


Photo
- - - - -

Change Remote IP in Host EXE


  • Please log in to reply
7 replies to this topic

#1 Jordan Kuehn

Jordan Kuehn

    Extremely Active

  • Members
  • PipPipPipPip
  • 353 posts
  • Location:Oklahoma
  • Version:LabVIEW 2011
  • Since:2009

Posted 02 September 2011 - 06:14 PM

Hopefully this hasn't been addressed elsewhere, didn't see any relevant posts. We are wrapping up the software development phase of a project that involves the production of a few dozen units. Each one has a cRIO controlling it. We've chosen to give each cRIO a unique IP address so that in the event we have a couple units back for servicing, we won't have IP collisions.

Now what I need to be able to do is take a built host executable and modify the IP address it thinks the cRIO target has. I've tried modifying the aliases file to no avail. Currently I'm stuck rebuilding the exe for each new IP address. Any thoughts or suggestions, or perhaps I'm simply modifying the file incorrectly?
The Colex Group
Lead Software Engineer
Certified LabVIEW Developer

#2 asbo

asbo

    I have no idea what you're talking about... so:

  • V I Engineering, Inc.
  • 1,273 posts
  • Version:LabVIEW 2011
  • Since:2008

Posted 02 September 2011 - 08:22 PM

The alias file is basically a short-circuit for DNS name resolution - this won't change what IP your EXE is trying to connect to unless you're connecting by name in your code.

You can pretty easily expose the IP to connect to, either in the UI, as an INI setting, in the registry, by the command line ...

#3 Jordan Kuehn

Jordan Kuehn

    Extremely Active

  • Members
  • PipPipPipPip
  • 353 posts
  • Location:Oklahoma
  • Version:LabVIEW 2011
  • Since:2009

Posted 02 September 2011 - 08:40 PM

You can pretty easily expose the IP to connect to, either in the UI, as an INI setting, in the registry, by the command line ...


I'm just using normal Network Shared Variables, no datasocket or anything. Does that change your assessment of the ability to configure what the SVE is looking for? I'm not entirely sure what steps to take to programmatically configure the NSVs. This is a unique use case for me as most systems we build are static.
The Colex Group
Lead Software Engineer
Certified LabVIEW Developer

#4 asbo

asbo

    I have no idea what you're talking about... so:

  • V I Engineering, Inc.
  • 1,273 posts
  • Version:LabVIEW 2011
  • Since:2008

Posted 05 September 2011 - 02:49 AM

I'm just using normal Network Shared Variables, no datasocket or anything. Does that change your assessment of the ability to configure what the SVE is looking for? I'm not entirely sure what steps to take to programmatically configure the NSVs. This is a unique use case for me as most systems we build are static.


Ah, in that case, yes it does. I haven't messed around enough with NSVs to guide you here.

#5 PJM_labview

PJM_labview

    The 500 club

  • JKI
  • 761 posts
  • Version:LabVIEW 2009
  • Since:1998

Posted 06 September 2011 - 09:35 PM

I am assuming that you don't want to do that (change the IP Address) in MAX.

Please note that the IP address is not defined in the executable per say (as far as I recall) but somewhere else on the RT target. If you feel adventurous look at the "Automated LabVIEW Real-Time Deployment (RTAD) Reference Application". This tool does more than just changing the IP Address of an RT device, but if you look at the code I think you will probably find what change is required to change the target IP address (most of the code is not pwd protected). I did use that code to create a simple utility for one of my customer to do just that (change the IP address of the image).

On a side note, if you have instruments with an embedded cRIO controller, I will strongly advise considering using the above mentioned tool to avoid future driver set upgrade/downgrade issues when trying to deploy your exe. The above utility take a complete image of the entire cRIO device (OS, driver set, executable [everything]) and allow an image to be created and deploy to target(s).

Good luck

PJM

#6 Jordan Kuehn

Jordan Kuehn

    Extremely Active

  • Members
  • PipPipPipPip
  • 353 posts
  • Location:Oklahoma
  • Version:LabVIEW 2011
  • Since:2009

Posted 07 September 2011 - 01:34 AM

PJM,

That looks quite useful for replicating the cRIO code across units, and I will likely need to move towards making a cRIO image in addition to the image of the host machine that I'm also replicating. Right now it doesn't bother me much to manually configure each cRIO. The thing I am more concerned with is configuring the host machine to know what IP address to look for the cRIO at. (NSVs are hosted on the cRIO). Each unit has a cRIO and a laptop host. In addition to helping me set up each laptop, it would allow us to have a single backup laptop that could be quickly reconfigured in the field by a technician to target a different cRIO.

The obvious answer may be to give each cRIO the same IP address and then it doesn't matter, but I think it's a legitimate concern that at some point we may be servicing multiple units and wanting to place them all on the same router to access from a single computer. If you have higher level suggestions that may eliminate the problem I have, I'd love to hear them.
The Colex Group
Lead Software Engineer
Certified LabVIEW Developer

#7 PJM_labview

PJM_labview

    The 500 club

  • JKI
  • 761 posts
  • Version:LabVIEW 2009
  • Since:1998

Posted 07 September 2011 - 05:39 PM

If you change the cRIO IP address using MAX, does your cRIO executable code stop working? If this is the case, you might want to consider the following (although at this time this might be too much work for your project).

Instead of using "naked" share variable, use the share variable API (Function>>Data Communication>>Share Variable).

9-7-2011 9-58-24 AM.png

By using this palette function you are able to use string "path" reference (NI Call this this string the "Share Variable reference In") to address the share variable.

9-7-2011 10-28-16 AM.png

This string path reference look like this: ni.var.psp://IP Address/Mod#/IOName.
So for instance:
  • For code running in the cRIO, the IP address will be 127.0.0.1. For code running in the laptop the IP address will be the cRIO IP [ex: 192.168.10.125].
  • Mod# is the module number (ex: Mod2).
  • IOName is the name that you gave that specific IO on that specific module (ex: External Interlock Status)
Withe the above parameters:
  • in the cRIO the SV path reference is: ni.var.psp://127.0.0.1/Mod2/External Interlock Status
  • in the laptop this would be: ni.var.psp://192.168.10.125/Mod2/External Interlock Status
If you do something like this, you can the store the cRIO share variable configuration string path reference in ini files (possibly one for the cRIO itself and one for the laptop).

Now when you change your cRIO IP Address, you just need to change your IP address in your laptop ini file and everything will work fine.

I am using this method on a shipping instrument that can have various IP address and this method works great.

I Hope that this help.

PJM

Note: Now, the crazy/cool thing with that approach is depending on what is in your cRIO code, you could potentially run part (or all) of the cRIO code directly into the laptop by replacing the cRIO IP Address from 127.0.0.1 to its "real" one (ex: 192.168.10.15).
  • Wire Warrior likes this

#8 swenp

swenp

    Active

  • Members
  • Pip
  • 22 posts
  • Location:Cologne / Germany
  • Version:LabVIEW 2011
  • Since:2004

Posted 08 September 2011 - 09:42 AM

jkuehn,

for shared variables changing the aliases file should work supposed you are using them by adding a library to project, adding a shared variable to library and drag&drop the shared variable to your code.

By double clicking the shared variable on the block diagramm the URL to the variable should start with your cRIO target name, not with an IP address. On my machine it works ;)

If your host executable has to connect to the target by e.g. VI server, or UDP/TCP you could parse the aliases file upon start-up for the actual IP address to use.

Attached Thumbnails

  • Untitled 4 Block Diagram on Untitled Project 1My Computer _2011-09-08_11-29-20.jpg