07-06-2011 12:39 PM
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
07-06-2011 01:13 PM
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.
07-06-2011 02:27 PM
Here is the coding
07-06-2011 02:29 PM
and this as well. Thanks
07-06-2011 02:31 PM
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.
07-06-2011 02:46 PM
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.
07-06-2011 02:59 PM
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
07-07-2011 10:57 AM
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.