LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LED light up different depending on case

Hello again!

We are a group of mechanicale students from sweden involved in a real life project. We have created a user-on-track for the worlds biggest treadmill. Right now we use our limited knowledge to try and program it. The idé is to mesure time between different sensors and from that give a new speed to the treadmill. When we`ve gotten a new speed, we send one or 2 signals (we use LED´s to simulate that) to the plc through the old system. The old system increases the speed with 0,5 (km/h)*s (k50) or 1 (km/h)*s. So if we want to increase with 4,5 km/h we send a signal to k100 for 4 seconds and 1 second to k50. 

Now to the problems we are having.

1. We only whant to increase the speed when one are moving forward (S5 to S6, or S6 to S7) and we can get that but we also gets a speed on the way back. 

2. We want the LEDs to light up when signaled and then stop until you get a new time in the right direction. they do light up but then it continues in the same loop. 

3. The signals to k50 and k100 cant come in at the same time and if you sould pass S5 and S6 it will be given a new speed. But let say you continues all the way to S7 and you get a new speed between S6 and S7. We want that speed to start send signal right after the first signals are send, not start while the first signals are still sending.

Hope you guys can help us!

0 Kudos
Message 1 of 3
(2,124 Views)

You need to break this into project that different people can work on. I would suggest that you look into State Machines, Producer and consumer loops and ques. Right now you have the indicators for what you want to do but you do not have any code that supports what you are trying to accomplish. I think if you start looking into the examples that are shipped for these systems that I am suggesting you will start to construct the code you need to run your system.

 

 

Tim
GHSP
Message 2 of 3
(2,096 Views)

Hi Erwa (and fellow students),

 

apart from the good advice aeastet already posted I have some more hints for you:

  • Learn a little "restraint", namely to resist the temptation to put everything in one humongous Block Diagram. Having to scroll around in order to see all the code is no fun. What's the secret? Use SubVIs, especially ones where you have taken the (very minor) effort to create an icon for it, something as simple as a background square that has few words on it saying what the SubVI does. Now your top-level VI's Block Diagram can show important structures (like the Producer/Consumer Pattern aeastet recommended) with most of the "busy work" taking place inside SubVIs with Icons like "Calculate speed", "Generate Output Signal", etc. Simplifying your code by "hiding the details" will make it much clearer what you are doing in the top level, and much easier to read. It also helps keeping your wires straight, left-to-right, without exceptions. Here is tutorial, giving some more detail about this and other typical code issues. Please don't get the title wrong; this article was part of a fun newsletter series, but still, I find it kind of offensive. http://www.ni.com/newsletter/51735/en/
  • The tutorial also give a hint on the Flat Sequence Structure you are using.
  • As you wrote hat you guys are students, your University or Institute might have an Academic Site License that allows you to access NI's Self-Paced Online Training ("SPOT") Courses: http://ni.com/self-paced-training.
    The Knowledge Base article titled "How Do I Access Online Training on an NI Academic Site License?" will tell you how to do so with your University's license: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9aiSAC

 


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 3 of 3
(2,068 Views)