Actor Framework Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Actor Framework on CompactRIO (and Other RT Targets)

This example demonstrates using the Actor Framework as the basis for an embedded control solution. An application on the real-time target manages the I/O and provides control logic.  It shares data with and receives instructions from a user interface running on a host computer.  Two network streams move data between the two applications.

The example is based on the Actor Framework Hands-On session, presented at NIWeek 2012, which implements a control solution for an evaporative cooler.   The instructions for that hands-on session describe the cooler application in detail.  Here, the cooler control code moves to the real time target while the user interface remains on the host.  We made no changes to either half of the code other than to build the network connection.

This example was built on a cRIO-9024 controller in LabVIEW 2012 and Actor Framework 4.0.  You will need to download and install the Linked Network Actor, an add-on to the Actor Framework that provides network connectivity.

Comments
Jolt
Member
Member
on

Looks like a great example but I can't get it to run targeting a cRIO 9073. I tried a straight network streams example with this target and had no problems.

With this Linked Actor example I always get error -314004 which suggest a problem with "Create Network Stream Writer Endpoint in Linked Network Actor.lvlib:Linked Network Actor.lvclass:Connect.vi"

I'm not great at debugging AF stuff yet so I may be missing something obvious. Any suggestions?

justACS
Active Participant Active Participant
Active Participant
on

Specifically, you are timing out before you obtain the connection.  It's hard to say what's going on without more information, but here are two things to check.

First, the obvious one.  Did you set the IP address of your cRIO on the front panel of "cRIO Cooler Test.vi"?  (Sorry, I have to ask the easy questions first.)

Second, when the target application is running, the user LED on the cRIO will blink at a rate of 1 Hz.  Do you see that?  If not, then your target application is failing at startup for some reason.

Jolt
Member
Member
on

Yeah, the IP is correct and the LED blinks as expected. When running "Cooler Main" from the development environment (i.e. the "Front Panel" is open) the system seems OK with pump state, temperature, etc. running as expected.

Also, the error (in the error cluster indicator on Target) doesn't show up until about 10 seconds after trying to start the Host app. Something is getting through - it's just not creating a good connection.

Similar behavior (as far as I can tell) when built and launched as a startup app on the Target.

FYI: the 9073 is a couple years old and something else may be going on but given that the other example I tried for network streams was OK I think it might have something to do with the Linked Actor itself.

CaseyLamers1
Active Participant Active Participant
Active Participant
on

I have found that you need to be careful about network adaptor settings.  I run Windows 7 and I need to disable wireless before using the Linked Network Actor.  The LNA that I was connecting to couldn't connect back.  Disabling wireless fixed it immediately.

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

Active Participant
Active Participant
on

doesn't that object rely on Network Streams? i have my own NS actors that experience similar problems. i wonder if it's something in the Network Streams engine and multiple adapters...

CaseyLamers1
Active Participant Active Participant
Active Participant
on

It does use network streams.  In Windows 7 there is no way to define which network adaptor is the default unlike in XP.  Empiricly, as soon as I disable the wireless I make the 2 way connection.  With wireless I can connect the PC sender to the RT receiver, but the RT can not connect to the PC.

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

Jolt
Member
Member
on

Interesting comments. I have bumped into the network adapter thing before but didn't think of it here. Unfortunately, in this particular case (and I still think it could be equipment related), forcing a wired connection without other network adaptors active doesn't change the behavior.

I haven't really spent a lot of time with this so perhaps a detailed review of what is happening in the NS Actors is the next steps for me.

BTW: running the example VIs "Host" and "Target" found at

"C:\Program Files (x86)\National Instruments\LabVIEW 2012\examples\Network Streams\Data Generation" Had no issues whatsoever with the same PC, cRIO, and LV version. These worked fine over wireless (PC to Router) as well...

elset191
Active Participant
Active Participant
on

I'm having the same issues as Jolt I think.  I see the user LED flash on my controller, but the cRIO Cooler Test can't connect to it.  The IP on the front panel matches the cRIO IP from the Target.lvproj.  I tried disabling the wireless networks (We had to do that on the FIRST team I used to mentor.) but it still isn't working.  I have all my firewalls disabled, too.  Did you ever come up with anything Jolt?

EDIT: Dang it, of course right after I posted I figured it out.  Apparently you have to explicitly install Network Streams on the cRIO via MAX.  (Also, my wireless adapter needed to be turned off)

--
Tim Elsey
Certified LabVIEW Architect
AristosQueue (NI)
NI Employee (retired)
on

Glad you figured it out.

Do make sure you pull down the bug fix for LV 2012 RT that was recently posted on ni.com. It fixes one problem with the Actor Framework on some RT devices.

elset191
Active Participant
Active Participant
on

Is that the LabVIEW Real-Time 12.0.0.1?

--
Tim Elsey
Certified LabVIEW Architect
AristosQueue (NI)
NI Employee (retired)
on

Yes.

Todd_Lesher
Active Participant
Active Participant
on

For multiple adapters - and when the remote IP addresses are known - I've had success using "route add [destination IP] [IF]".

CodePeasant
Member
Member
on

Load these projects with LNA 1.0; 1.2 has changed some abstract messages...

justACS
Active Participant Active Participant
Active Participant
on

Urk...  Noted.  I need to do an update.

CodePeasant
Member
Member
on

Allen,  I have read your destructions more thoroughly and will attempt to port the cRIO example to LNA 1.2 by changing inheritence, etc. I will report back if/when i am successful.  Sorry about that, should have scoured the doc. Guess I need a stronger perscription on my glasses. FYI, recently heard discussion about real-world use for AF at a recent AF session of mutual attendance...I got lost in the virtual messages discussion, but have since reviewed and also LNA as this shows.  My group is a jack-of-all-trades group providing solutions ranging from from discrete circuit component design to distributed network applications.  We have used AF for 4 of 6 LabVIEW software solutions in the past year.  Keep these examples and tools like LNA up! We like! Don't let AF die on the vine.

Updated to 1.2 successfully.  Just changed inheritence for Update Interface Connection Msg from Update Status Msg to LNA Connection Status Msg.

ngblume
Member
Member
on

Hello,

quick question: The version to download above is working with LNA 1.2 or not?

I'm asking since I'm missing the "Update Status Msg.lvclass" from the LNA, so I'm assuming that is caused by me having LNA v1.2.

Thanks!

EDIT:

I tried to change the inheritance for "Update Interface Connection Msg" from "Missing Class" (AKA "Update Status Msg") to "LNA Connection Status Msg", but I can't find that class in the Change Inheritance dialog... I'm probably missing something rather simple, but can't see..

Could you point me in the right direction?

TailOfGon
Active Participant
Active Participant
on

Has anyone experienced error -314004 with Network Stream on CompactRIO using executable?

In my development environment, I can communicate between crio and host using LNA. However, after I build and deploy the rtexe and try to do the same thing, -314004 occurs.

TailOfGon
Certified LabVIEW Architect 2013
justACS
Active Participant Active Participant
Active Participant
on

-314004 is a timeout error; your endpoint did not connect to the remote in the expected time.

It does take a little bit of time for the EXE to spin up on the RT target, longer than just launching an EXE in LabVIEW. (This is where the user LED is handy - most RT apps toggle the LED at some interval, so you know the software is up.)

The next obvious thing is to check to make sure the settings for your executable are what you expect them to be.  Each instance of LabVIEW gets its own network settings.  That includes EXEs.  They should inherit from your dev instance of LabVIEW, but it's worth checking.  Look in the INI file for your EXE (colocated with the exe file).

If that's good, I would start looking at my EXE to see if something might prevent the RT-side LNA from launching.  I don't know what's in your application, so I can't comment on what that might be.

MattP
NI Employee (retired)
on

I've also seen errors of this type occur in host-side code when the cRIO being used has the RTEXE installed, but not the network stream SW component from MAX. 

This is typically only an issue when replicating systems, not using the same cRIO.

Cheers,

Matt Pollock
National Instruments
TailOfGon
Active Participant
Active Participant
on

Thank you niACS and MattP. Using the USER LED actually helped debugging the code. My code toggles the LED every second now to make sure the application is running. When the main actor stops due to unexected error, then the LED stops toggling. This way I can make sure the RTEXE is still running.

So after some research and try and error, I figured that the firewall was preventing me from connecting to the network stream on RT. I referred this link to add labview.exe to the exception list. Then the error seems not happening any more.

I am wondering how others are handling this situation. My application will be eventually installed to customer's PC and they may experience the same issue. Letting the customers to configure their firewall settings is the way to go? Or is there any way to handle this through the installation process?

TailOfGon
Certified LabVIEW Architect 2013
MattP
NI Employee (retired)
on

FYI, I typically have a separate loop (can be an actor if using AF) in my systems to manage system health.  This loop is responsible for blinking the LED, amongst other things (monitoring memory usage, CPU usage, available disk space, etc). 

I usually have the LED blink if the system is active, and turn the LED orange if the system stopped or entered an error state.  This way you can distinguish between 'hasn't started running yet' and 'hit a problem I need to investigate.'

Cheers,

Matt Pollock
National Instruments
Contributors