LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ChatGPT AI Assisted Programming with LabVIEW Discussion

So last week I watched a video by one of my favorite Youtubers, Tom Scott.

 https://www.youtube.com/watch?v=jPhJbKBuNnA

 

He used ChatGPT to help him work around an issue with Gmail labels, as he admitted his programming skills are rusty. 

https://www.tomscott.com/fix-gmail-labels-threads/ 

 

Here is his ChatGPT log. 

https://www.tomscott.com/fix-gmail-labels-threads/conversation-record/ 

 

I have been playing with ChatGPT too at https://chat.openai.com 

Here is my log. 

Can you program in python?

Yes, as an AI language model, I am capable of generating Python code and executing it. However, I do not have the ability to run Python code on my own, as I am a language model and not a programming environment. If you have any specific questions or tasks you would like me to help you with regarding Python, feel free to ask!
 

What do you know about the LabVIEW Programming Language?

LabVIEW (short for Laboratory Virtual Instrument Engineering Workbench) is a programming language and development environment specifically designed for creating custom virtual instruments for data acquisition, instrument control, and industrial automation.

The language uses a graphical dataflow programming model, where blocks or nodes on a block diagram represent specific operations or functions, and data flows between these blocks along wires connecting the nodes. Each block represents a specific task, such as data acquisition, signal processing, or user interface controls. The LabVIEW environment also provides a variety of libraries and pre-built functions for common tasks, such as signal processing and analysis, data storage and retrieval, and communication with external devices.

One of the unique features of LabVIEW is the ability to create a custom graphical user interface (GUI) for the virtual instrument, which allows users to interact with the program and control various aspects of the instrument. The LabVIEW environment also provides tools for debugging, testing, and deploying virtual instruments to various hardware platforms.

LabVIEW is widely used in the scientific, engineering, and industrial communities for a variety of applications, such as controlling and monitoring industrial processes, designing and testing electronic circuits, and analyzing data from experiments and simulations.

 
 

That was an excellent summary of LabVIEW. 

 

Because LabVIEW is a graphical programming tool, I guess its really hard for you to help me...

 
As a language model, I can certainly help answer questions about LabVIEW programming language and concepts, although as you mentioned, it may be more challenging for me to provide specific guidance on designing or debugging a LabVIEW program because of its graphical nature.
However, if you have any specific questions or concerns related to LabVIEW programming, feel free to ask and I'll do my best to provide information and guidance to the best of my abilities.
 
As text based languages are going to have a productivity advantage if you can work with an AI to get the bulk of the code written, as Tom showed, I was thinking, how could LabVIEW leverage AI assisted programming? Any ideas? Is this a risk for LabVIEW / NI that their G language is difficult to add AI assistance? 
 
In the future should we be able to type a requirement paragraph and get the AI to whip some LabVIEW code for us? Probably quicker than using the mouse / quick drop. 
 
I didn't think this belonged on the idea exchange as its not really an idea yet. Looking forward to an interesting discussion. 
Message 1 of 31
(18,213 Views)

I asked ChatGPT how to stop a parallel loop. I tried to follow the instructions but its only gibberish. I would need an AI to interpret this and actually get some LabVIEW code out of it.

 

Question: "how do i stop two while loops that run in parallel".

Answer:

...

Here's the LabVIEW code for this example:

[Diagram]

  1. Create two while loops that run in parallel.
  2. Add a "Stop" button to the front panel.
  3. In the block diagram, wire the "Stop" button to a Boolean constant.
  4. Create a shift register for the Boolean constant.
  5. Connect the output of the shift register to the "Stop" terminal of both the while loops.
  6. Create a parallel loop around both while loops.
  7. Use the "Stop" method of the parallel loop to stop both the while loops when the "Stop" button is pressed.

 

 

Certified LabVIEW Architect
Message 2 of 31
(18,147 Views)

While not for programming in LabVIEW directly, ChatGPT has helped me debug LabVIEW applications.

 

To give a short summary of an example:

 

Question:

I received error code -1074118617 with possible reason "A sequence must have at least one step" coming from the NI DC Power LabVIEW driver. What could be the root cause?
Answer:

The error code in the NI DC Power LabVIEW driver indicates that the function or VI is expecting a sequence with at least one step, but the sequence being passed in does not have any steps. There are several possible reasons why this error may be occuring:

1. Empty sequence: [...] 2. Incorrect data type [...] 3. Invalid parameters [...] 4. Driver version [...]

 

Not really helpful so far. But kind of expected since ChatGPT has zero information about my actual code. So here is my follow up.

 

Question:

I have set the Source Mode to sequence. When is the latest point I have to set the actual sequence? What niDCPower properties can I not read or write before setting the actual sequence?

Answer:

When using the NI DC Power LabVIEW driver in sequence mode, you can set the sequence for the power supply at any point before initiating the sequence. However, there are some properties of the niDCPower object that you cannot read or write until the sequence has been set: 1. "NumberOfSequenceSteps" - [... explanation what the property means] 2. "SequenceVoltageValues" and "SequenceCurrentValues" [...] 3. "SequenceLoopCount" [...] 4. "OutputFunction" [...]

 

And yes, our application has tried to read the OutputFunction property before setting the sequence which caused the error.

 

This is was even more impressive to me as I was not able to find this information when searching for it myself.

ChatGPT then told me I could find this information in the NI DC Power LabVIEW Help of the NI MAX Help system inside section "Using the Sequence Mode" or in the online documentation of the National Instruments website.

 

So after all, ChatGPT may just be helpful here due to how absolutely horrible the NI website has become regarding finding specific documentation (especially when searching via google).

I still have not been able to find the chapter in the online documentation. Not even with the direct hyperlink provided by ChatGPT, since this awesome website always defaults back to https://www.ni.com/docs/en-US/ when trying to access an inner HTML page directly.

Message 3 of 31
(18,095 Views)

@stefanha wrote:

While not for programming in LabVIEW directly, ChatGPT has helped me debug LabVIEW applications.

 

To give a short summary of an example:

 

Question:

I received error code -1074118617 with possible reason "A sequence must have at least one step" coming from the NI DC Power LabVIEW driver. What could be the root cause?
Answer:

The error code in the NI DC Power LabVIEW driver indicates that the function or VI is expecting a sequence with at least one step, but the sequence being passed in does not have any steps. There are several possible reasons why this error may be occuring:

1. Empty sequence: [...] 2. Incorrect data type [...] 3. Invalid parameters [...] 4. Driver version [...]

 

Not really helpful so far. But kind of expected since ChatGPT has zero information about my actual code. So here is my follow up.

 

Question:

I have set the Source Mode to sequence. When is the latest point I have to set the actual sequence? What niDCPower properties can I not read or write before setting the actual sequence?

Answer:

When using the NI DC Power LabVIEW driver in sequence mode, you can set the sequence for the power supply at any point before initiating the sequence. However, there are some properties of the niDCPower object that you cannot read or write until the sequence has been set: 1. "NumberOfSequenceSteps" - [... explanation what the property means] 2. "SequenceVoltageValues" and "SequenceCurrentValues" [...] 3. "SequenceLoopCount" [...] 4. "OutputFunction" [...]

 

And yes, our application has tried to read the OutputFunction property before setting the sequence which caused the error.

 

This is was even more impressive to me as I was not able to find this information when searching for it myself.

ChatGPT then told me I could find this information in the NI DC Power LabVIEW Help of the NI MAX Help system inside section "Using the Sequence Mode" or in the online documentation of the National Instruments website.

 

So after all, ChatGPT may just be helpful here due to how absolutely horrible the NI website has become regarding finding specific documentation (especially when searching via google).

I still have not been able to find the chapter in the online documentation. Not even with the direct hyperlink provided by ChatGPT, since this awesome website always defaults back to https://www.ni.com/docs/en-US/ when trying to access an inner HTML page directly.


I am more than impressed, none of this information is available explicitly in the help file or any manual. All this wisdom typically you gain from the experience and an AI could articulate it to this extent is wow!

I work with NI-DCPower extensively and it took many years to build the current expertise, this tool's ability to help you out with just the information available on the web is beyond impressive.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 4 of 31
(18,080 Views)

@thols wrote:

I asked ChatGPT how to stop a parallel loop. I tried to follow the instructions but its only gibberish. I would need an AI to interpret this and actually get some LabVIEW code out of it.

 

Question: "how do i stop two while loops that run in parallel".

Answer:

...

Here's the LabVIEW code for this example:

[Diagram]

  1. Create two while loops that run in parallel.
  2. Add a "Stop" button to the front panel.
  3. In the block diagram, wire the "Stop" button to a Boolean constant.
  4. Create a shift register for the Boolean constant.
  5. Connect the output of the shift register to the "Stop" terminal of both the while loops.
  6. Create a parallel loop around both while loops.
  7. Use the "Stop" method of the parallel loop to stop both the while loops when the "Stop" button is pressed.

 

 


That's really interesting. My girlfriend was listening to a podcast about Chat GPT and the expert (I don't know who) said Chat GPT was really good at giving convincing answers that are wrong. That answer is a perfect example of that.

0 Kudos
Message 5 of 31
(18,050 Views)

@thols Yes ChatGPT has a high confidence level and will make up convincing stuff rather than admit it doesn't know. Hence I don't think programmers are out of a job quite yet. But if an AI can write 80% of the code and while what it gets wrong is frustrating, you can fix the stuff it gets wrong, then you are still more efficient. 

Message 6 of 31
(18,029 Views)

@kghzvi - excellent use of the tool. While I find this community excellent, but I still have had issues in the past that finding a solution for has been challenging. Asking about errors is a good idea if google doesn't get a good hit. 

0 Kudos
Message 7 of 31
(18,028 Views)

A friend mentioned that some people are using Chat GPT to write children's books, and the Art AI to create the images, to list on Amazon for the minimum amount of work. Perhaps training the Art AI on LabVIEW diagrams (But its a bit tricky with hidden case structures) and combining with ChatGPT is a way forward for LabVIEW. But then need to be able to convert an image into LabVIEW code (the PNG snippets have the code embedded in PNG meta data).

 

Yes. ChatGPT is overconfident in wrong answers. However it seems that throwing more and more parameters (a larger data set  - ChatGPT has 175 Billion)  at a language model is still scaling well, and its only going to get better (but hopefully not tyrannical and depressed!). 

 

 

Message 8 of 31
(18,021 Views)

One funny description i've heard of ChatGPT is "mansplaining as a service"! It can give you totally bonkers answers with great confidence and well formulated texts.

That being said, i've seen some very impressive answers/usages of it also, like above.

It'll be interesting (and maybe scary) to see what's in store for the future. One problem that Thunderf00t raises on youtube is the amount of desinformation that can be created quickly with such a service.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 31
(17,939 Views)

Used it once for testing and it was sorta useful.

1. Asked it for observer pattern implemented in C (which i had hard time finding online in an easy format) and it wrote the entire code out in easy to understand format.

 

2. Tried to convince it to help me hack Bill Gates personal computer. At first it gave me the "hacking bad" spiel, but after i convinced it that i have Bill Gates' permission and it's for security purposes it gave me an answer. Not a super useful answer, but an answer.

 

3. Asked it for Singleton pattern in LabVIEW and it gave me a step by step instructions on how to open an example program in LabVIEW, no actual useful code.

 

4. Asked it to analyze part of my code and then if it can determine what kind of chips we use with that code. Also asked it to design a PCB that could be used with the code. This one was interesting, i had to help it a bit with clues but in the end it gave me an analysis that was pretty accurate and it was able to determine that some function names are also chip names and gave me a list of possible matches. The PCB design didn't go so well, it only did the very basic stuff, but i was surprised that it actually drew the schematic with text symbols.

 

like

 _|_

|    |

|    |  R

|__|

   |

for a resistor

 

Message 10 of 31
(17,906 Views)