LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert boolean to numeric write to file

I have a state machine in use, which one of the actions is to measure frequency and calculate RPM from a motor test stand and then write the results to an excel spreadsheet. Currently, it is measuring and comparing the RPM to to high and low limit, then outputting a T/F into excel. The output comes out as Pass or Fail. However, what I need it to do is output the actual calculated RPM in a numeric value. Please help. I have attached some screen shots of the states responsible for performing this function, along with their sub vi's. Let me know if there is anything else I can add/say to clarify the issue. I'm not very proficient with LV yet.
Thank you so much for any help.

 

Best regards,

 

Jon Lunchick

0 Kudos
Message 1 of 8
(4,723 Views)

First you should never post a DOC DOCX XLS or any other proprietary format here. Second it is much easier if you post your code. It is much easier to work with code than to work with pictures.

Tim
GHSP
0 Kudos
Message 2 of 8
(4,713 Views)

Here is the coding

Download All
0 Kudos
Message 3 of 8
(4,702 Views)

and this as well. Thanks

0 Kudos
Message 4 of 8
(4,699 Views)

There are many more VI's, but I don't think they are needed for this TS. However, if there are any holes that need filled in by giving you more of the code, please let me know. Thanks again.

0 Kudos
Message 5 of 8
(4,697 Views)

I'm not going to dig into a state machine with that many numbered states but in the last VI you posted you can convert the frequency from a float to a text string with the 'Number to Fractional String.vi'.  It's in the String > String/Number Conversion Palette.  Then, just write the string to your file instead of the bool.  There are better ways to format data into a text file but your code doesn't look like it will be easy to modify.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 6 of 8
(4,688 Views)

Thank you for the help. I guess I'm just not very fluent at programming, but where in the RPM Calc.vi would I need to add the number to fract string and would it be inside or outside the For Loop? Is this going to give me a number that's written to file, the RPM in numeric value? It seems I would be able to remove the code that determines whether the calculated RPM is "pass/fail", right? Thanks again,

 

Jon

0 Kudos
Message 7 of 8
(4,677 Views)

See the attached VI.  You can put the conversion inside or outside the For Loop since that VI is polymorphic and can work on numbers OR arrays of numbers.  It is usually more efficient to let these VIs work with arrays rather than doing individual conversions in a loop.  Of course you can delete the Pass/Fail code tha generates the boolean if you wish.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 8 of 8
(4,650 Views)