From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control design & simulation

Hi,

 

How do I use LabVIEW Control Design & Simulation to run a DLL-file on a RT-target(CompactRIO)? It would also be great to know how much MB RAM it is required on the RT-target. 

 

Thanks in advance:)

0 Kudos
Message 1 of 14
(2,986 Views)

How much memory is required for what?

 

DLL's do not run on most CompactRIOs.  Most of them run VxWorks which requires *.out files, not *.dll.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 14
(2,932 Views)

I know, but some cRIOs are running Phar Lap OS which are compatible with DLL files. Anyhow, I have changed my RT traget to a pc with LabVIEW RT OS. How do I run a model in LabVIEW CD&S on the RT target?

thank you:) 

0 Kudos
Message 3 of 14
(2,924 Views)

If you have LabVIEW, RT, and CDSim installed, then you should have the option in MAX to install Control Design and Simulation to the PXI or RIO target. Once that is installed, VIs with simulation should be runnable on the target.

0 Kudos
Message 4 of 14
(2,918 Views)

Yes, I have done all that, and the VI should be runnable on the target, but HOW do I run it? The file UDP is the original LabVIEW CD&S VI and I have successfully been able to run it in windows. You should be able to open it without the DLL file. 

 

 Also, do I need to implement a simulation loop for the RT target in the VI? 

0 Kudos
Message 5 of 14
(2,907 Views)

As stated earlier, DLL does not work on cRIO. You'll need to compile your code for the VxWorks OS, which produces a .out file instead of a .dll. Then, you'll need to manually FTP your shared library into the system folder on the target. Search the web if you need information on how to use FTP. Once your .out file is in the targets system folder, you should just be able to run your VI using a LabVIEW project with a target for the cRIO. Yes, it would be nice if all this were somehow done for you. However, at least there is a way to do it. I did this awhile back, but it was years ago. Try it, and report back if you have problems.

0 Kudos
Message 6 of 14
(2,886 Views)

In addition to the dll, if the question is more about running a VI in RT, this should be of some help:

 

Getting Started with the LabVIEW Real-Time Module

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 7 of 14
(2,882 Views)

I got the imression the OP is able to run VIs on RT in general without problems. Specifically, his/her pain-point is that they are using functionality that requires their own shared library.

 

By the way, it's the same deal for Pharlap. You'll have to manually FTP your shared library (.dll on Windows and Pharlap) to the target. Basically, LabVIEW needs to be able to find the shared library somewhere. Unfortunately, the shared library doesn't get transferred around with the VI. You have to do it manually. LabVIEW does at least store a relative path to your library, so if you keep place them in the same folder on each platform, LabVIEW should be able to find the library.

0 Kudos
Message 8 of 14
(2,880 Views)

@esplu88 It would be really helpful to not have to keep guessing about what OS your controller is running.

 

Could you check this article and let us know for sure if it's Pharlap or VxWorks? What Operating System is my Real-Time Controller Running and Why?

 

Just for thoroughness the model of the cRIO would be helpful too.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 9 of 14
(2,876 Views)

One more bit of advice. You should really avoid using the feedback node on a simulation diagram. The feedback node will probably not behave like you want. The feedback node is fine outside the world of simulation. Use the memory block or the delay block from the simulation palette instead.

 

Here's a brief explanation of why it's bad. The feedback node maintains its own state that the simulation knows nothing about. In your case, you are using the RK4 solver. The RK4 solver takes three minor steps and then a major step. This means the diagram is executed four times per major step. If you were using the feedback node to increment by 0.1 on each step, you'd be quite surprised to find the feeback node outputing 0.4 instead of 0.1 after the first step. Also, with variable step solvers like RK23, the solver may reject a step and start over from the last step. The built in simulation functions work with the solver to roll their state back. However, the feedback node cannot do this as it was not built to be used within a simulation. Its own internal state is already committed and cannot be rolled back if a step is rejected in the simulation.

0 Kudos
Message 10 of 14
(2,875 Views)