LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

combine 2 while loops using OR

Solved!
Go to solution

This still looks wrong, but since you didn't attach your VI, I'll wait until you attach it before commenting.

 

There is no guarantee for "exactly equal" for DBL. Do you know the number of bits in the digitizer?

0 Kudos
Message 21 of 34
(478 Views)

Please tell me if you are able to access it and as for the digitizer it should be 8-bits 

0 Kudos
Message 22 of 34
(462 Views)

Hi Emma,

 


@plssendhelp1506 wrote:

1) the color box will only be activated if it senses current into the system. So by default, it should all be black at their normal state. 


There is nothing related to "sense current into the system" inside your VI.

So how do you determine when to "activate color boxes"?

To set the colorbox to black you need to define this color in your color range array and define a related range in the numeric array constant…

 


@plssendhelp1506 wrote:

2) The alarm will be activated if the thermocouple were to be operating at a temperature that exceeds the limit ( I did the connection but it doesn't seem to activate when i do simulation) 


Why don't you use an InRangeAndCoerce function to test your Thermocouple array for your range? It has an "in range" output!

And why do you convert the result of your comparision to a numeric frequency value??? Do you know the expected values after the BoolArrayToNum function?

 


@plssendhelp1506 wrote:

3) to answer the question you posted, from left to right the first thermocouple will be reaching the value from up as the temperature is meant to be decreasing while the last thermocouple will be reaching the value from down since it is meant to be increasing...and yes, being exactly the limit value


Comparing floats for "exactly the same" might be dangerous - you should learn about this fact.

Why do you even use floats with 53 bits mantissa when your digitizer provides just 8 bits resolution?

Putting aside these considerations: why don't you compare the Thermocouple array with your limit value? You already know how to compare for ">=" and "<=", so what's the problem with another "=="?

 

On your VI:

  • You forgot to set any senseful default values, so we see an empty color range array! (This should be a constant in the block diagram anyway…)
  • The PID part is completely senseless (right now). What do you want to achieve by placing this function inside the loop?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 23 of 34
(456 Views)

Gerd already mentioned most points.

 

Why can't you leave out these silly things like the beep and focus on the important stuff.

It is not reasonable to wire a few Hz because that's even ignored because "Use system sound" defaults to true.

 

If your sensor is 8 bit, you only have 256 possible temperature values. Assuming there is some scaling/calibration involved, the DBL values will be quantized to 256 temperature values that are unlikely to exactly match your thresholds.

 

0 Kudos
Message 24 of 34
(443 Views)

Hello everyone, the requirement here is that beep will be activated when the temperature of the thermocouples goes beyond 190 degree celsius or below -190 degree celsius.... the colour issue has been resolved....I am not sure what i did wrongly here.....

 

-E

 

Screenshot 2024-05-31 124656.png

0 Kudos
Message 25 of 34
(428 Views)

Hi pls,

 


@plssendhelp1506 wrote:

I am not sure what i did wrongly here.....


  1.  You started a new thread instead of keeping related questions in just one thread so we can have an overview of already provided suggestions…
  2. You still don't understand how to handle boolean arrays…
    (What's wrong with using an InRangeAndCoerce functions as suggested?)
  3. You still don't provide code. We cannot edit/debug/run images in LabVIEW…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 26 of 34
(404 Views)

1. I thought it was different from the previous thread issue, so I started a new thread instead of just following up the old thread. I am so sorry about that!!! 

 

2. updated one, i use temperature here instead...

plssendhelp1506_0-1717135700289.png

 

3. please tell me if the file cannot be opened 

 

ignore PID for now 

 

0 Kudos
Message 27 of 34
(390 Views)

Hi pls,

 

it's still the same buggy VI…

 


@plssendhelp1506 wrote:

updated one, i use temperature here instead...


I converted your hidden (why is it hidden anyway?) control into an array constant:

Right now you check a whole 2D array of values for "in range": what is the EXACT condition to have the computer output the Beep?

  • Should it beep when ALL elements are out of range?
  • Should it beep when ANY element is out of range?
  • Should it beep when some (or just one) specific element is out of range? What would be the requirement for "some" or "one"?

 

Creating programs start with defining good requirements (aka asking good questions)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 28 of 34
(380 Views)

beep when any element is out of range...

 

if temp equals to or greater than 190 degrees Celsius OR equals to or lesser than -190 degree celsius

BEEP activated

Else

nothing will happen

 

so, does that implies that, or function can be used here under the temperature? if so, then how is it possible for us to connect the Boolean array with Boolean?sorry...this is my first-time using LabVIEW 

0 Kudos
Message 29 of 34
(372 Views)
Solution
Accepted by topic author plssendhelp1506

Hi pls,

 


@plssendhelp1506 wrote:

beep when any element is out of range...so does that implies that or function can be used here under the temperature ?


Yes, the OR function (or in your case the OrArrayElements function) will output TRUE when atleast one element of an input array is TRUE!

(Keep in mind the other function is called InRangeAndCoerce, not OutOfRangeAndCoerce…)

 


@plssendhelp1506 wrote:

sorry...this is my first-time using LabVIEW 


This question has NOTHING to do with the used programming language, it's all about developing basic algorithms independently from the programming language…

 

(You would have the same problem of "recognize if there is atleast one element in an array of elements out of range" if you would program in C, Java or anything else.)

 


@plssendhelp1506 wrote:

if temp equals to or greater than 190 degrees Celsius OR equals to or lesser than -190 degree celsius

BEEP activated

Else

nothing will happen


Again you failed in providing good pseudocode!

  • You missed to note that "temp" is an array in the pseudocode.
  • You missed to note that you want to beep when one or more elements of this "temp" array is out of range…
  • In pseudocode you would iterate over all elements of the array, but there is no loop in your pseudocode…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 30 of 34
(369 Views)