01-28-2016 10:20 AM
By now, you've seen numerous ways to generate the kind of cycle (one period of a cosine where the rising phase takes 60% of the cycle and the falling phase takes 40%) you seem to need (for example, see Mateh's post just before this one). However, your overall requirement, I think, is something like this --
Mateh's algorithm gives you all of the points for a specific period. You can, of course, call this algorithm with another Period that you get by running your Poisson process, but how do you write a VI that, say, "gives you the next point" (so that you can send it to your display, your stimulator, what have you)?
I'm going to describe a State Machine that can do this, not worrying about stopping the State Machine, but then I'll turn it into an Action Engine by removing the "Wait for Delta-t" step in "Generate Next Point" and having the (now Action Engine) exit, saving data in its Shift Registers for next time.
I'm going to simplify Mateh's algorithm a bit -- I'm saying this in Words rather than Pictures because I think there is a didactic value to taking concepts and turning them into code using LabVIEW (can you guess what kind of "industry" I'm in?). So here's the State Machine:
I think this will do it for you. Note that the only State with any computation of significance is Start Next Period, which generates all of the points for one period that then get "played out" slowly by Next Point. Note that as described, you don't really need Initialize (but I always like to have Initialize be my first State in a State Machine, with Finalize the last ...). It shouldn't be too hard to convert this to an Action Engine with an "Initialize" Action that "forces" the initial Start Next Period and exits with the Output Point when Output Point is reached, with "Next Point" being the other "callable" action. [You can probably see that since you will do the "waiting" in the caller, you can probably eliminate Next Point, as well, and go directly to Output Point].
Bob Schor
01-29-2016 09:19 AM - edited 01-29-2016 09:20 AM
Hello everyone,
Thank you very much for your help !
Mateh, your solution works perfectly. You've totally unederstand what is my aim.
Thank you too Johnsold and Bob Shcor for your help and proposition. I need little more time to think about it. I will work on it, and I'll turn to you if i've any questions.
Because I'm agree with you Bob Schor, the didactic value is important, mainly in my case as a neophyte in LabVIEW (in addtion, I think Bob works as a reasearcher and teacher (Ph. D)... ).
Thank you again !