Go to Post I emailed Brandon Martus to have my username changed. It was updated within a day. Champion webmaster at work. - Gregor [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-08-2008, 17:08
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Variable rollover with Labview (suggestions?)

I'm looking for a better way (if there is one) of making a number roll over at a specified value, with Labview. What I have come up with so far is this:



If you don't have the boolean symbols memorized, what it does is determine whether a value is closer to the rollover limit or the highest possible number, and places it where it should have been back within the range. (of course, it only does this when the number is out of range)
The challenge here is that the number may change at an inconstant rate (you can add or subtract values much greater than 1). The problem with this solution is that it doesn't actually tell which way a value has rolled over, and thus could pose some problems if the increment is quite large. Also, it must be in a feedback loop to work for more than one rollover.
Please post your suggestions! I don't mind if you post them as VIs, but other people might appreciate your using pictures.

Thanks!
__________________
-- Marshal Horn

Last edited by kamocat : 21-08-2008 at 18:03.
Reply With Quote
  #2   Spotlight this post!  
Unread 21-08-2008, 17:56
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Variable rollover with Labview (suggestions?)

I suppose this one would work too, but this one requires that the rollover value be no more than half the maximum value of a 16-bit unsigned word. Also, because it gets so close to actual U16 rollover, there's a chance that the value will truly roll over without being caught at the desired value. (To make sure this is a feasible challenge, I'm going with the assumption that there will be no jump in value greater that half the rollover limit).



Again, for those that might not be familar with all the symbols, that division thing with the R and the IQ is a quotient function. It gives the quotient IQ and the remainder R. The triangles with the ? T F on them are boolean selectors; it selects the value wired to T or F according to the boolean input (the ? symbol). Lastly, that green arrow there is a feedback node; it holds a value until the next call. This one happens to be green (boolean).
And I believe you can figure the rest out.

Thanks again!
__________________
-- Marshal Horn

Last edited by kamocat : 21-08-2008 at 18:10. Reason: another error was realized
Reply With Quote
  #3   Spotlight this post!  
Unread 21-08-2008, 18:00
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Variable rollover with Labview (suggestions?)

I'm having a little trouble following exactly what you are trying to accomplish: could you provide example inputs and what you want as an output?

I've included a few options, all assume that rollover is 100.

Which of the following behaviors is correct?
1) 112 becomes 12
2) 112 becomes 100


Another interpretation: You have a variable x, and you are incrementing or decrementing by dx. You want output to "latch" to either extreme if you would otherwise roll.
x=98, dx=5, output = 100
x=98, dx=70, output = 100
x=3, dx=-5, output = 0

Perhaps pulling dx into your function would make it easier, as you can use it's sign without having to guess.
Also, would it help to temporarily use a 32bit int to avoid overflow, and then truncate back down?
Reply With Quote
  #4   Spotlight this post!  
Unread 21-08-2008, 18:10
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Variable rollover with Labview (suggestions?)

You can right click on the addition icon, choose properties, go to the output configuration tab, and change the representation to U16. This will automatically wrap the values at U16 (or whatever other data type you want). It should simplify some of your VI, by not having to worry about the max U16 value.

It would be a lot easier to work with if you posted your vi, rather then just a picture.

Last edited by Joe Ross : 21-08-2008 at 18:18.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-08-2008, 19:27
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Variable rollover with Labview (suggestions?)

Quote:
Originally Posted by EricVanWyk View Post
I'm having a little trouble following exactly what you are trying to accomplish: could you provide example inputs and what you want as an output?

I've included a few options, all assume that rollover is 100.

Which of the following behaviors is correct?
1) 112 becomes 12
2) 112 becomes 100
That's the trouble. I want it to roll in both directions. Say I'm working with degrees, so I have the rollover set to 360. I need it to reset back to zero when it turns past 359, but I also need it to go to 359 when it goes past zero if it's turning the other direction.

Quote:
Originally Posted by EricVanWyk View Post
Perhaps pulling dx into your function would make it easier, as you can use it's sign without having to guess.
Also, would it help to temporarily use a 32bit int to avoid overflow, and then truncate back down?
I'll consider that, and see what I can do without too much hinderance to modification.
__________________
-- Marshal Horn
Reply With Quote
  #6   Spotlight this post!  
Unread 21-08-2008, 20:53
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Variable rollover with Labview (suggestions?)

Quote:
Originally Posted by kamocat View Post
That's the trouble. I want it to roll in both directions. Say I'm working with degrees, so I have the rollover set to 360. I need it to reset back to zero when it turns past 359, but I also need it to go to 359 when it goes past zero if it's turning the other direction.


I'll consider that, and see what I can do without too much hinderance to modification.
It sounds like you might be looking for the "modulus" operator. I'm not a LabView expert, but I did find this in my googling - http://forums.lavag.org/Computing-mo...w-7-t8550.html
Reply With Quote
  #7   Spotlight this post!  
Unread 21-08-2008, 21:21
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Variable rollover with Labview (suggestions?)

Quote:
Originally Posted by EricVanWyk View Post
It sounds like you might be looking for the "modulus" operator. I'm not a LabView expert, but I did find this in my googling - http://forums.lavag.org/Computing-mo...w-7-t8550.html
Thanks, but no. All I want is an artificial rollover. The modulus operator was just another way of getting it done
__________________
-- Marshal Horn
Reply With Quote
  #8   Spotlight this post!  
Unread 22-08-2008, 08:30
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,748
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: Variable rollover with Labview (suggestions?)

There are many ways of doing this.

I'd start along Eric's lines of asking more questions. The easiest way to detect overflow is before the operation that causes it. Before adding or subtracting the delta, determine if dX is greater than the boundary it is approaching. If so, do some wrapping code.

Key operators that may be handy are the "Integer Division", which performs the modulus operation, giving IQ and R. There is also the "In Range and Coerce" node.

Have fun.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with CMUcam & LABView Daniel_H LabView and Data Acquisition 1 30-01-2006 12:07
Problem with freezing frames in LabVIEW pdc LabView and Data Acquisition 2 26-01-2006 01:34
Problems tracking with CMUCam2 in LabVIEW PhilBot LabView and Data Acquisition 5 17-01-2006 20:42
Need help with 255 Variable Joseph F Programming 18 26-02-2002 14:49


All times are GMT -5. The time now is 08:45.

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