Quantcast
Channel: All LabVIEW posts
Viewing all 203927 articles
Browse latest View live

Re: Random Sample not updated

$
0
0

 

“Inside this loop, there is no "updated" value of k.  k doesn't get updated until the loop repeats.  If you want to generate a new value of k (call it k-prime) for Function B, guess what? -- you have to generate a new value of k for Function B, which requires a second random number generation and addition to the input "Number.”

 

Given you example, I need k to be updated to k-prime for function B before the loop repeats, and using the same random number generator. Hope this makes clear what I am looking for. Thanks. 

 


Re: LabVIEW "VI cannot be referenced"

$
0
0

 wrote:

 wrote:

Your understanding is incomplete.  It's not inaccessible because it's in the private folder; it's inaccessible because it is either marked as private in a library or is part of a class.  It's marked as "private" for a reason.  Your safest bet is to make a copy and place it in your own project, preferably in its own library to make sure it has its own namespace and doesn't get mixed up with the other VI of the same name.


I disagree -- if the creators of the Library marked a routine as "Private" (and gave it a name like "Special Write"), then you are not supposed to call it directly, but through some other routine that does the necessary preparation and/or cleanup to ensure that things get done correctly.  Read the documentation that came with your device, and use the functions that they provide to you (these will be "Public" functions) and leave the "Private" ones alone (until you get good enough with LabVIEW Object Oriented Programming to make safe changes).

 

Bob Schor


I agree with your disagreement, actually, and for the reasons you specified.

Re: Random Sample not updated

$
0
0

Then you should be using the wire that comes out of function A!  Not the original k wire.  So if you need a second random number generator, then put it in.

Re: VISA stepper motor skips a motion control step every time at cycle 130

$
0
0

Mike,

 

It turns out it did not fix the issue. It then failed at cycle 135 instead of 130 on the next run. 

 

I do have 4 devices connected in series and connected to the computer through the zaber provided USB.

 

Does having more than one device connected have something to do with it?

 

Thanks!

Re: VISA stepper motor skips a motion control step every time at cycle 130

$
0
0

Also the device I am using is the T-NM17C04.

Re: VISA stepper motor skips a motion control step every time at cycle 130

$
0
0

Hi Nick,

 

Thanks for confirming the details of the system; I have a solution for you based on this.

 

When setting up the commands to be sent, you specify device number 0. This device number is reserved for a 'broadcast' type command; all Zaber devices that receive it will act on the command (which I think is what you're trying to do). Each device will respond once it completes its movement. There is the Response Count input in the command cluster for how many responses the Request VI should consume. You have it set to '1', so only one of the four responses to each command are consumed. The rest remain on the serial input buffer. Each response is 6 bytes, so 6 bytes x 3 devices x 2 commands per cycle x 130 cycles = 4680 bytes. The default VISA serial input buffer size is 4096 bytes, which is why you're getting the overflow. 

 

The solution is to change the Response Count input from 1 to 4. This should ensure all the responses are consumed, and avoid the overflow. 

 

Zaber_Screenshot.png

 

Re: Random Sample not updated

$
0
0

 wrote:

Given you example, I need k to be updated to k-prime for function B before the loop repeats, and using the same random number generator. Hope this makes clear what I am looking for. Thanks. 


No, it makes no sense!

 

Why does it have to be the same? if you need more than 1 random numbers, you can place multiple generators.

 

Still, from your formula they cannot be independent, but just time (or k-) shifted, so you need to maintain the correlations and keep a history of at least the last 5 points.

 

Do you have a web link that describes the algorithm you are trying to implement? What's the purpose of all this? What does it all mean? Just having some random numbers dancing incoherently is not really informative or interesting.

Re: Random Sample not updated

$
0
0

Again, I need both functions using “one” random number generator (rng). And the result of function A should be used as input to function B. This can be done easily.

 

The hard part is the following. Given there is a while loop iterates every period of time. 

In one iteration (name it k), I need function A uses the generated number of the rng. Then after 5 k or five iterations, function B uses the generated number of the rng. In other words, I need each function (inside the while loop) works only and every specific number of while-loop’s iterations. For example, if function A uses the generated number x at iteration number k and performs the calculations, the output of it will be used by function B but after 5 iterations. Please note that after 5 iterations, the x value should be updated ( given that a new random number generated in each iteration from the “same source” not a different rng. 


Re: Random Sample not updated

Re: Random Sample not updated

$
0
0

Currently I don’t have access to my laptop and using my cellphone to reply to your comments. I don’t need two random number generators because I am using a “ similar” vi that mimics my original vi. The origin one has one source of input comes from a device called opal-rt through a communication network uses dnp3 protocol which is mostly not supported by many labview basic licenses. That’s why I simplified what I need in a “similar” vi and a diagram.

The one random number is really a mimic to what I have in the real vi.   Hope now makes sense. 

Re: Random Sample not updated

$
0
0

Again, please give us a web link that describes the algorithm. Does it have a name?

 

Maybe something like this? (You can initialize the array with anything you want but discard the first five values later)

 

Meaninglessprocessing.png

 

Re: Random Sample not updated

$
0
0

Altenbach,

 

Do you need a wire from the random number into the element of the right hand side in the IPE?

Re: Random Sample not updated

$
0
0

 wrote:

Do you need a wire from the random number into the element of the right hand side in the IPE?


Yes. Smiley Very Happy

 

(I corrected it...)

Re: Memory leak??? or more likely not knowing proper cleanup

$
0
0

Hi All

 

I figured it's polite to provide an update, so here it is.  I started by focusing on the part that holds all the data I load in, and changed it to a shift register instead of using local variable.  Doing that basically solved the memory issue (which is what I cared about the most).  Incidentally, that was also the first suggestion that was made before even looking at the program. 

 

I'm still trying some of the suggestions for speeding up the response, but now that this is working better, it's become a side project and I might not get to it for a few more weeks.  

Re: Random Sample not updated

$
0
0

I think I am getting very close. The algorithm is not on the web—I am developing it for my PhD. I will definitely share it not only with you but also with the world once I complete it. Now, could you please share your last vi, please. I think you are right I need to understand the shift register very well. Thank you again. 


 wrote:

Again, please give us a web link that describes the algorithm. Does it have a name?

 

Maybe something like this? (You can initialize the array with anything you want but discard the first five values later)


 


Re: Random Sample not updated

$
0
0

Here's a version that initializes with zeroes instead (probably preferred). Modify as needed.

Make sure you completely understand every single part of it!

 

Meaninglessprocessing2.png

Re: Slow Modbus serial communication

$
0
0

Without more information it is very difficult to answer. Need more than vague "very slow". How slow is slow, how are you determining it, what is the hardware you are using, both the modbus interfaces, what you are communicating with?

Re: PID temperature controller with on/off and lm35 sensor

$
0
0

Hi Paddy,

 

If you're still a bit stuck go to Labview home screen. Click on Help > Find Examples. Click on Temperature tab, scroll down and click on temperature. Click on and open On/Off controller VI. This or some other VIs there might give you some ideas. But don't be too bothered if your VI doesn't run. Get a load of snips of VIs, error codes and get cracking on a report. Even if it doesn't work you'll get decent marks for your objectives, plan,method, issues, any learnings and how you go about troubleshooting them. Spending much more time at this stage might affect your exams. 

 

Best of luck.

Fixed (Default) Array Lengths in Typedefs

$
0
0

We are working with some proprietary subVIs (i.e. password-protected) that require a cluster of various elements going into them. One of the possible cluster element types is an array, which must contain the exact size (array length) that is necessary for the application in order for the subVI to work.

 

The problem is that the array lengths for many of these arrays have been changing as our project continues to progress. We have developed code to automatically generate a new typedef based upon a struct file, and it initializes arrays to the correct lengths, however the array lengths do not update in any of the typedefs that currently exist in the project. The only way I've been able to figure out how to do update the array sizes in the typedefs, is to delete and re-add every instance of the affected typedef in the project (which kind of defeats the whole purpose of using a typedef). This is becoming very cumbersome as we now have 100+ typedefs, and each one is used 5+ times in our code.

 

Anybody have any work arounds? Can I reinitialize all typedefs in a project to default values?


Note: I'm ideally looking for something that doesn't execute at run-time because this is code that is running on a RT target running Linux x64 which has various limitations.

Re: Fixed (Default) Array Lengths in Typedefs

$
0
0

VI Scripting is probably your best bet here. You can create a script which traverse your VIs looking for the typedef, then update the value with a new default value. Here's a quick and dirty example:

typedef_script.PNG

Edit: VI Scripting is enabled under Tools -> Options -> VI Server -> Show VI Scripting functions and methods

Viewing all 203927 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>