Jump to content

maxprs

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by maxprs

  1. If your only concern would be the variable names, I do have a completely rewritten version of the formula parser that allows for arbitrary (well must start with alpha character and then can contain any alphanumeric character and the underscore) and performs quite a bit better than the NI parser as it does not do all kinds of complicated string reformating on the input string. I also has a clean string to RPN parser so that as long as the string doesn't change one can simply execute the RPN evaluator only, which speeds up the actual calculation of the formula even more. The code was posted long ago here.

    Not the only concern, as the application is already written with all the formula nodes.

    But sure I'll keep your suggestions under consideration.

     

    Thank you very much

  2. Another possible solution would be to use the Eval Formula Node vi. It's functionally similar as a formula node, but would also have the formula already in string format as an input.

    That's a possibility that I already knew.

    I gave up because of the modifications needed to adapt the actual formula nodes, and also because of the limitations about the variables name (a, a0... z, z0...). The content of the formula node instead can use any type of strings, i.e. "Energy", "Mass", that makes the formula self explaining.

  3. Okay so I have a working test of what I was talking about with the Pre Build action.  Attached is a project with a VI in it that gets the text of a Formula Node in the development environment.  It also has a string constant that is blank, but before building the EXE it will take the value from the expression node and put it in the string constant.

     

    Build the EXE and you'll see that the value of the string constant will change to the value in the expression node.  Not ideal but it can be done with minimal engineering effort, and using all built in tools.

    I think that the use of the pre build action is a way to get the info that I need very interesting.

    I will do some test to see if it can fit my needs...

    Thank you very much for your effort.

  4. Not ideal but the only possible solution then:

     

    Create a string constant and copy the script into it and then put the script in a case structure and the string constant in the other case of the structure. Now you can call the VI with a boolean input control to execute the string or retrieve the contents.

     

    Requires some discipline to update the string constant when the developer makes changes to the script but is the most straightforward and simple solution if you do not want to go with an external script solutions.

     

    Or alternatively if your required scripting formulas are not to complex you might go with the script parser that comes as example in LabVIEW. It is however limited to basic mathematical operations, doesn't support arrays, and interprets the formula each time you execute it.

    Yeah, that what I've thought to do as well; the problem is that there will be many formulas in the application, so discipline required is a lot.

     

    On the other hand the limitation of the script parser is not accettable.

     

    I just wonder why NI didn't put a read only property for the formula node where you can get what is written inside as a string.

  5. I don't think any of these methods will work in a build executable. 1) because it is not supported in the runtime engine, 2) because it makes use of the node in 1) and 3) only maybe if you set the VI explicitedly to not remove the diagram when building the executable. The text of the script is part of the diagram like anything else. LabVIEW compiles this in fact into code and then the script text is not really necessary anymore in a build application and therefore gets removed with the diagram. But even if you leave the diagram there it may still not work as a lot of VI scripting operations do not work in the runtime engine since they don't make to much sense anyways when there is usually anyhow no diagram to work on.

    Infact, I forgot to tell you that the project is set so the block diagram of the VI where the formula node is contained is not removed.

    But it doesn't work anyway.

     

     

    Also since the formula node is really compiled into the rest of the VI code, you can't change it in a build application anyways as it would need to be recompiled but the runtime engine does not have any compilation possibilities.

    But I don't want to change it with the run time engine.

    I want only to read it. Only the developer will be able to change it, and this is the way it has to be.

    I want the user to be able only to get how the formula is written.

     

     

    What you want to do is probably using some external scripting solution like LabPython or Lua for LabVIEW as there you can have the script in the form of a string that you can load from disk or simply contain in your VI and even let the user modify to run the changed code. 

    Never used... I would prefer to find a solution inside LabVIEW, but if there is no way I'll give that a chance.

     
  6. Hi guys,
    new to LAVA forum, this is my first post here.
    I'm a long time LabVIEW user, and I'm stuck with a problem... so I thought maybe some one here could help me.
    There is a formula node in my application (more than one, but let's find the solution for one), and the developer can change the formula depending on how it want to customize the application. What I need to do is to show the content of the formula node to the user, so he knows exactly what's the formula in use at the moment.
    This must work on the deployed application, so with the run time engine. Infact the developer build the application after the customization of the formula.
    I have tried the following:
    1) I put the formula node in a separate VI, in order to capture the block diagram image and then show that image to the user. I've used the BD.Get Image Scaled method, but it's clearly written in the help that id doesn't work with the run time engine.
    2) Using the report generation toolkit I can call the Append VI Block Diagram to Report to an HTML report. I can't find in the help if it is supposed to work in run time engine, but I've had bad experiences in the past with that tool. And it doesn't seem to work.
    3) I've tried a different approach using the labview scripting. I'm able to open the object reference to the formula node and then to load its content in a string with the property Formula Expression. But once the application is built it doesn't work, even if I'm not creating any code with the scripting, just reading.
     
    In the end I don't care if the formula is captured on an image rather than a string, or whatever... but it must be what is written in the formula node inside the executable.
    Just wonder if I've used the above methods in a wrong way, or if there is a different way to do it.
     
    Thanks
     
    Max
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.