08-24-2022 10:39 AM
08-24-2022 11:19 AM - edited 08-24-2022 11:20 AM
I made something like this. It was a CSV scripting file for testing so you could modify the CSV file (typically in excel) then pass it to the LV program and have it run it. In this case I had a column that defined the method (or case) then the next few columns had variables for that case. In this manner the LV program would execute each row in turn.
In the end there were about 7 columns that were used to define functionality for each executing row.
Using this methodology the technicians were able to script tests in excel which they were comfortable with using.
08-24-2022 11:25 AM
@DoctorAutomatic wrote:
I'd like to make a feature where users could setup rules for certain things at runtime. Let's say something like when Variable X >= 10. When the condition is met, it triggers something. I have some early rough ideas in my head but I'm not enamored with them of how to actually implement the parts where the user selects the variable, the operator, and the value of comparison. The first that comes to mind is obviously a case structure but there's something about that that feels short sighted in terms of extensibility or maintenance. Has anyone implemented such an architecture? Would love to hear some comments/ideas. To be clear, I'm talking about end users being able to create these rules at runtime, NOT in the dev IDE.
By the time you invest in doing that once and poorly you've realized that you should have created the sequence in TestStand.
08-24-2022 11:26 AM
Hi DoctorAutomatic,
I made a subVI, called it preferences and another subVI to read (initiate) and write (update) locally stored ini files at the start and the end of the code respectively.
At the start, I read all the configuration values and store it into an FGV. Then call preferences subVI when needed which then provides a front panel to update specific/ all parts of configuration values and update it into the FGV as needed. Now you can use the values in the FGV at different parts of code as needed.
When closing the program, these values are then written to the same ini file to be used as default configuration values for next call of the application.
I hope this made sense.
08-24-2022 11:27 AM
I think Flexlogger has some functionality like this as well. It's been a few years since I looked at it though.
I believe you can create Flexlogger plugins to do anything complicated, or you can just control IO pins with simple rules. I could be misremembering though...
08-25-2022 05:04 PM
@JÞB wrote:
@DoctorAutomatic wrote:
I'd like to make a feature where users could setup rules for certain things at runtime. Let's say something like when Variable X >= 10. When the condition is met, it triggers something. I have some early rough ideas in my head but I'm not enamored with them of how to actually implement the parts where the user selects the variable, the operator, and the value of comparison. The first that comes to mind is obviously a case structure but there's something about that that feels short sighted in terms of extensibility or maintenance. Has anyone implemented such an architecture? Would love to hear some comments/ideas. To be clear, I'm talking about end users being able to create these rules at runtime, NOT in the dev IDE.By the time you invest in doing that once and poorly you've realized that you should have created the sequence in TestStand.
I'm not trying to make a test sequence of any sort.
Not aimed at you but I wish LabVIEW/community wasn't so geared toward the stereotypical niche of electronic test equipment. Wish it was a little more general purpose. I simply have no need for TestStand and have never even touched an industrial grade DMM in my life (c'mon, what's a LabVIEW example project without a DMM HAL or something?) which makes me feel like I'm using the wrong tool for the job and should consider something like C# or java instead. That new subscription model might be the push I need.
08-25-2022 05:51 PM
I don't do any sort of electronic testing at all, and I find LabVIEW perfectly usable. TestStand isn't just for electronics testing, though of course it is good at it.
It's also quite hard to offer advice when you're asking how to make a program "trigger something when a variable changes". Do you want it to send an email? Turn on a valve? Shut off the computer? It sounds like you're doing some sort of test, and TestStand is good at running tests.
Then again maybe you're automating something? Maybe you're controlling an industrial oven, or a robot arm, or a positioning table, or a high voltage amplifier, or a DC motor (all of which I've personally done with LabVIEW ;)). LabVIEW is used at SpaceX for their launches. It's also used to control particle accelerators. Maybe you're using it for a self-driving robot.
The point is you literally asked the question "How do I make LabVIEW do something" with no further details, so it's going to be very hard to give you suggestions other than "Maybe look at TestStand or FlexLogger, both of which are designed to let end users do some limited scripting."
Heck, at this point we don't know that LabVIEW truly IS the best tool for whatever job you're doing. I'll bet you it can do it though 🙂 Maybe explain your vision for what the software will eventually look like, and maybe walk us through an example routine, and we can make some better suggestions.
08-25-2022 06:03 PM
@DoctorAutomatic wrote:
Not aimed at you but I wish LabVIEW/community wasn't so geared toward the stereotypical niche of electronic test equipment. Wish it was a little more general purpose. I simply have no need for TestStand and have never even touched an industrial grade DMM in my life (c'mon, what's a LabVIEW example project without a DMM HAL or something?) which makes me feel like I'm using the wrong tool for the job and should consider something like C# or java instead. That new subscription model might be the push I need.
Hmm, I understand, there are a lot of T&M people here as that what LabVIEW is great at. I have only worked on a few LabVIEW projects that were not directly T&M and most of those were T&M adjacent, like making a UI for a database that held test data.
Well to your original question I think I misunderstood, I thought you were trying to let users set variables outside of the program (like in an INI file or something). If you would like users to set the variables on the UI that is no problem.
This is a simple VI that I made to grab scope traces off an old GPIB scope but it shows the idea. The user can define some math then when the program runs it will take the user input and apply it to the logic. In this case on some scope traces. So using a case structure works great for this.
08-28-2022 08:54 AM
I think you will find this problem is more complicated than you might think, but that depends on the complexity of what you actually want, so it might help you to start with a couple of concrete examples and try to think them through.
You could implement this using your own simple language and parser, or you could try something like having the users write Python code and executing that, or you could do it entirely in LV, but with all of them, you will need to decide all kinds of things. For example :
If I wanted to this purely in LV (and I have done things along those lines, although not exactly this), I think I would it might require a few class hierarchies (maybe one for the data types, one for the checks and one for the operations), but if possible, I would probably try to limit it as much as possible (for example, decide that variables can only be numeric).