Go to Post Don'tcha love technology? :p - Cory [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-01-2013, 10:32
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
SubVI Outputs

Hello -

I've created a subVI with two outputs - an enum and a boolean. Within said subVI, there are a few while loops running that cause the output of these two pieces of data to be delayed until the end of the subVI execution when placed within a main VI. To further clarify, the subVI outputs the correct data at the correct time when run alone, however not so when run within a main VI.

Is there a way to configure the subVI to output the data continuously alongside these loops?

Dom
Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2013, 10:45
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: SubVI Outputs

How about running your subvi in parallel to everything else, like what the Periodic Tasks.vi does.
Then creating a subvi to be called by your other loops to just return the last values produced.

Your description sounds like it's a problem because your subvi isn't started until it's called, then it takes too long to run start to finish.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 21-01-2013, 10:54
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: SubVI Outputs

Here is my current code.

PneuController is the "main VI' which will run the subVI.
PneuStateMachine determines which state ReqPos should pass along to PneuState. ReqPos will ensure a state is not run more than once, however I've yet to integrate this code.
PneuState sets the outputs based on the state.

Sorry for the lack of comments and the rather messy block diagrams.

EDIT for clarity: PneuStateMachine functions as expected and desired. When PneuStateMachine is put into another VI to run as a subVI, the outputs are not updated until the end of the loop.
Attached Files
File Type: vi PneuController.vi (7.8 KB, 8 views)
File Type: vi PneuState.vi (10.8 KB, 4 views)
File Type: vi PneuStateMachine.vi (17.8 KB, 7 views)
File Type: vi ReqPos.vi (6.7 KB, 4 views)

Last edited by DominickC : 21-01-2013 at 11:06.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-01-2013, 14:02
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: SubVI Outputs

Think of the shell of the subvi as a single-loop itself.
No output will be released from the subvi until it concludes, just as no new inputs are accepted until it's run again.
It's the same reason that long delays in Teleop.vi are bad.

One way around this is to use a global variable in place of Output and Moving? as a mechanism to pass along intermediate values.
You'd need an additional flag to indicate when it's safe to read those global values, and handle the tiny window where Output has been updated, but Moving? hasn't yet.

Teleop doesn't have this problem, because it writes settings out to the FPGA, rather than producing top-level vi outputs.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 21-01-2013 at 14:31.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-01-2013, 18:12
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: SubVI Outputs

To rephrase what Mark said, the white box inside a loop is called a diagram. The white box inside the window of the subVI is also a diagram. They have many of the same execution rules. To communicate data in parallel, you need to use something like a global, a queue, an event, etc. For most FRC tasks, a global is a fine mechanism to share data.

Greg McKaskle
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi