LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

combine 2 while loops using OR

Solved!
Go to solution

Hi pls,

 


@plssendhelp1506 wrote:

Hello everyone, I did some modification but I am still facing a little issue here. By right when the thermocouple 1 and 4 reaches 200 degree celsius it is supposed to be in red colour but over here it turn green instead. I am not sure what is wrong here....


You didn't follow Christians suggestions, but still keep you own buggy code.

 

  • Why do you need to convert booleans into float values?
  • Do you know the meaning of coercion dots when ORing float values?
  • Why do you still fiddle with property nodes when you can use colorboxes (as suggested)?

@plssendhelp1506 wrote:

also is it workable to insert PID controller here ?


Yes, sure.

What do you want to achieve with a PID controller in your case?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 34
(487 Views)

I did try to do what Christian suggested however when I changed the color of the LED....4 entire LED color changes instead of 1 and i am not sure why.....sorry 

idk.png

 

With regards,

E

0 Kudos
Message 12 of 34
(477 Views)

Hi pls,

 


@plssendhelp1506 wrote:

I did try to do what Christian suggested however when I changed the color of the LED....4 entire LED color changes instead of 1 and i am not sure why.....sorry 


Now you forgot to attach the block diagram!

When you followed Christians suggestion, but don't get the same result then you did something wrong…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 34
(469 Views)

@plssendhelp1506 wrote:

I did try to do what Christian suggested however when I changed the color of the LED....4 entire LED color changes instead of 1 and i am not sure why.....sorry 

 

 

With regards,

E


They should be Color Boxes, not LEDs.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 14 of 34
(455 Views)

@plssendhelp1506 wrote:

I did try to do what Christian suggested however when I changed the color of the LED....4 entire LED color changes instead of 1 and i am not sure why.....sorry 


A LED has only two possible values, True or false. The color is a property and elements of an array can only differ in value, but share all properties.

 

For a colorbox, the color is the value and can thus differ for each array elements. It is a numeric!

 

altenbach_0-1716822851842.png

 

 

 

 

Have a look at links in this old idea for details.

 

LEDArray.png

Message 15 of 34
(449 Views)

@plssendhelp1506 wrote:

 

Screenshot 2024-05-27 144101.png


While this is definitely not the way to do it, here are some general coding problems. Your code is extremely clumsy with way too many duplicate elements.

 

  • Case structures should only contain what's different between cases  If you would place the property node AFTER the case structure, you would only need one instance each. Same for the color terminals. Place them before the case structure and you only need one each. Don't be afraid to branch the wire.
  • Property nodes are relatively expensive. They only need to be rewritten if the new property differs from the current property.
  • All you color clusters should be diagram constants, not front panel elements.
  • Your loop runs millions of times per second. Unless you monitor a nuclear explosion, it is unlikely that the temperature drastically changes in 100ms.
  • You entire orange bit gymnastic could be replaced with very little code.
  • If the sensor LEDs are not connected, the terminals don't really need to be inside the loop.
  • etc. etc.

 

Of course you can add PID controls. What have you tried? I would recommend to focus on that first and deal with cosmetics (e.g. adding color LEDs) as a last step.

Message 16 of 34
(462 Views)

It managed to work out !!! Thanks for all the suggestions and patience guiding me 😅 Just one more question: Is it possible for me to keep the value constant but make the colorbox light up as blue in color instead of green when the temperature reaches  -99.7,-190,-190 and -38 respectively or must I change the limit then the color will change...

Screenshot 2024-05-28 142310.png

0 Kudos
Message 17 of 34
(436 Views)

Hi pls,

 


@plssendhelp1506 wrote:

Just one more question: Is it possible for me to keep the value constant but make the colorbox light up as blue in color instead of green when the temperature reaches  -99.7,-190,-190 and -38 respectively or must I change the limit then the color will change..


Part of many programming problems is to ask the right questions! Being able to ask the right question often helps to solve the problem correctly

So I have to ask:

  • Reaching the value from top?
  • Reaching the value from down?
  • Being exactly the limit value?
  • Did you consider floating point accuracy problems yet?
  • Did you understand Christians example and did you learn how you can extend it?

Please specify your requirements as exactly as possible!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 18 of 34
(432 Views)

Gerd already raised the important points.

 

Also:

  • Use save for previous (2020 or below) before attaching VIs. Most cannot open things written in LabVIEW 2024.
  • Why woold you distort the colorboxes and make them oval? Keep them round! (If you hold down <shift> while resizing, they keep their aspect ratio!)
  • For the (disabled) range color array, I use the frameless colorbox from the classic palette. looks cleaner! (maybe a diagram constant would be sufficient)
  • I recommend to always show the first invalid row/column when resizing array diagram constants, else we cannot tell how big the array really is! (for larger arrays shows the scrollbar instead)
  • Why scatter front panel elements randomly all over the place? Move the digital display above or below the sliders, hide the increment buttons, and resize the round colorboxes to match the width

 


@plssendhelp1506 wrote:

Just one more question: Is it possible for me to keep the value constant but make the colorbox light up as blue in color instead of green when the temperature reaches  -99.7,-190,-190 and -38 respectively or must I change the limit then the color will change...

 


A colorbox changes colors, it does not light up, whatever that means. Within noise and accuracy, your temperature never exactly reaches these values. You can add as many color ranges as you want by expanding my code by adding more thresholds in the array constant and more colors in the "range" color array. You could go through an entire rainbow of colors as a function of temperature! (ice cold (purple), cold (blue), coldish (bluegreen), nice (green), warmer (yellow), hot (orange), blazing hot (red), white hot (white) as well as a color for missing data or sensor offline (black). etc.).

0 Kudos
Message 19 of 34
(418 Views)

Thanks for the suggestions! I have did some modifications but it still didn't managed to turn out what i am aiming for. The attached picture below is what i did. 

 

Requirements: 

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. 

 

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) 

 

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

 

modification .png

 

 

Best regards,

Emma

0 Kudos
Message 20 of 34
(383 Views)