04-14-2021 03:05 AM
If you see my complete VI you will see why I need 2 loops. Each loop gets different data. The VI I posted before with 2 while loops in a flat sequence structure is just a representation of what I'm trying to achieve. Also your VI with a case structure does not work because all Data is valid and must be recorded.
04-14-2021 10:36 AM - edited 04-14-2021 10:39 AM
@bajajvishal11 wrote:
If you see my complete VI you will see why I need 2 loops. .
OK, your attached PND is a snippet but your images in the post are not. If you attach code, attach the VI. If you want to show a snippet, embed it in the posts. You need two loops if two things need to run in parallel, but yours are sequential.
@bajajvishal11 wrote:
Each loop gets different data.
This is not sufficient to explain the situation. Where does the data come from? Data is typically different, so that's normal.
@bajajvishal11 wrote:
The VI I posted before with 2 while loops in a flat sequence structure is just a representation of what I'm trying to achieve. Also your VI with a case structure does not work because all Data is valid and must be recorded.
You still need only one toplevel loop and a proper state machine architecture. Your two loops have almost identical code! Why would a case structure prevent data from being valid or recorded? That argument makes absolutely no sense.
04-14-2021 10:55 AM
@bajajvishal11 wrote:
Hey,
thanks a lot for proposing to have a look at my complete VI. I was just scared people would call me out for putting a big VI up there. Happens in other tech forums where people just want you to ask your very specific question and leave
Your VI is not very big in terms of code logic, just the front panel and diagram is unbelievably large for what it does. Why do the front panel objects need to be scattered across twenty HD screens. Why is the code such a sequence worm? I cannot really look at it on my laptop, so this need to wait until I can use a bigger monitor.
From a quick glance, this needs to be rearchitected from scratch. Glaring mistakes are:
04-14-2021 11:40 AM
@bajajvishal11 wrote:
with initial position (2,2) which then increments in steps of 0.001
the distance at which the angle changes( rather shifts from motor X to Y ) increases by 0.002mm. Something like this:
Here's one possibility to create your spiral. I am sure it can be simplified further (one loop, no sequence, no local variables. unified code). You should be easily able to adapt it to your problem and increment your stepper motors depending on the changed complex component (RE or IM). (The history trace is just for illustration. You don't really need it)
04-17-2021 04:55 AM
Hey Thanks a lot for that. I didn't know I could use complex number in this way in LabView. Your solution was elegant and I was able to integrate it as it is with just 2 changes in my code. It was great learning. Thanks for that.