Це відео не доступне.
Перепрошуємо.
ChatGPT and PLC programming
Вставка
- Опубліковано 14 сер 2024
- ChatGPT... ChatGPT... It's been on the news every day for the last two months. I've seen it being used for traditional IT-oriented languages/programming, but the question is: can it be used to do PLC-programming? Let's find out!
Please support this channel by either:
- A donation by using the "Thanks" button under the video
- A donation through PayPal → www.paypal.com...
- Becoming a Patron → / sagatowski
Subscribe so you don't miss new videos → www.youtube.co...
0:00 Introduction
1:40 "Do you know how to do PLC-programming?"
2:25 "Can you write me a PID-controller in Structured Text?"
4:09 "Can you help me write a random number generator in Structured Text?"
5:10 "Is Siemens PLC better than Beckhoff PLC?"
6:00 "What is the difference between a function block and a function?"
7:30 "Can you write me a function block for a Beckhoff EL1008 terminal?"
8:27 "Can you write me a function block in structured text that takes a button-press as input and provide a string of whether the button is pressed as output?"
11:44 "Can you write me a piece of code in structured text, that sets an output to true, five seconds after a button has been pressed?"
12:55 "Can you write me a function block in structured text that transmits a text string over a TCP/IP socket, using Beckhoff's TwinCAT3?"
15:56 "What's the difference Beckhoff's TF6310 and TF6311?"
16:54 "Can I do version control using TwinCAT 3?"
17:44 "Can I do TDD with PLCs?"
19:09 "Why don't automation vendors store source code in plain text?"
20:03 "What are the pros and cons of MQTT vs OPC-UA?"
22:00 "Why do automation vendors charge so much for their development environments?"
22:43 "Can you do a simple program in ladder diagram?"
24:34 "Can I make a Beckhoff PLC talk to a Siemens PLC?"
25:21 "What makes a good automation engineer?"
26:35 "Is Structured Text or Ladder Diagram the best?"
28:35 "Why is it taking Beckhoff so long to release TwinCAT 3.1.4026?"
30:52 Wrap-up
#chatgpt #plc #openai
One important thing is also that is designed to hold an conversation. For example if you're not sure about something it wrote or how it would handle a situation (like the button pressed). You can ask it and it will most of the times improve the existing, which is even more magical imo
An entire UA-cam channel on PLC programming -- fascinating. I actually learned a fair amount on the topic just watching your Q&A session. My background is in INFOSEC so I would be curious on your thoughts about ICS/SCADA security to include advanced PLC attacks like STUXNET.
If you want it to write ladder just ask it to do it in XML for import.
Same trick also works for translating from, say, AB to Siemens, in ladder - give it XML and ask for XML back.
I used ChatGPT during the Christmas holidays to generate some code for my home automations in YAML. To get somewhat usable results, you want to give it very precise instructions.
It didn't understand that it had to turn heating off, when the max temperature was reached. Or to turn it back on if the temperature go below the threshold at a later time.
After a bit of fiddling and being very precise in my descriptions and telling it to fix certain errors, I got a very good starting point that saved me a lot of time writing code.
In the relatively near future I see it as a wonderful tool to help developers.
In the future I can see this as a completely automated factory, where you input text or speech input in one end. The AI makes a bunch of simulations and gives you options of what you want, it then choose manufacturing processes, writes it's own code on the way and spits out a complete physical product in the other end.
Very cool stuff. But remember to not ask for the most efficient machine to fix the world's problems, and tick off the box for auto accept. That's how we get Terminators!
😮😅😊 2:46 2:53
It's the end of human memory and skills. This is terrifying to me.
@Perius said "....and being very precise in my description." The lesson learned by any systems developer reading the specs for a new system to be bid on........ How many times I've sat in meetings listening to in-house "experts" describe how their business works, only to find later that there were many, many exceptions to how things really work. That's why a good systems developer is also a good people person with lots of billable patience.
Confidently burping out a slightly WRONG answer. It's so convincing you still need a specialist to tell it's wrong or not 😂
It’s programmed to be a politician
Hi Jackob.
Great video on this specific topic.
I was skeptical about ChatGPT OpenAI for Industrial Automation Software Programming.
Now I do believe that it can be a side helper mostly for some particular algorithm integration.
The complexity of the PLC programming related to the processes, ,machines, equipments or so specific applications cannot lead to a solution coming from this kind of AI.
Anyway ChatGPT is so impressive and scary at the same time.
I can totally see process engineer writing control narrative and GPT based tool converting that into logic. Just a matter of time. Lets see who will do it first, Siemens Emerson, Honeywell or someone else. Now, GPT cannot do whole design for you (for now) but can definitely fill up the gaps and speed up the design process.
Great video. Increadible that it can produce more or less correct structured text. One hint though, at the left you see your past conversations so when restarting you can continue where it crashed.
Thanks for the tip!
very good video, you are right, this can enhance our abilities to do more in shorter time.
Perhaps computer science or c language can be replace some day but plc still had hard time due to many method and internal ladder built by each manufacturer
Hi Jakob,
You can use the history on the left side to bring back the context you had previously added to chatgpt so it remember the correct context you were talking about earlier. I asked get and it said it can't get the context off other conversations.
It gives you better answers when you do that. Also, if you think it could continue the answer, ask it to 'continue from line: "the line context"' and it continues from there.
Very cool video!
I've used Google Translate as a language study tool for almost a decade. It's been insanely helpful. I see ChatGTP's potential as an extension of this. Want to learn PLC programming? Add to your study routine coming up with challenges, trying to solve them, then asking ChatGTP to solve them and compare.
Very nice Video Jakob 😊
Thanks! 😃
It can make complete ladder logic programs. You just need to define the question well and to ask to give it in XML.
Thanks for the suggestion!
If you are looking for a video sponsor PLC related. Add a business inquiry email in your about section and I will ping you. Thanks for all you do 👍
It's already added. Cheers!
Nice challenge for ChatGPT...One step forward and automation guys are out. :) Just kidding. But anyway, nice to get documentation regarding IL, ST, SFC, FB, FBU, LD. :). And for AI also. :)
It can generate a start for a project, but ChatGPT can be confidently incorrect. That and personally the code I write (for work) is really dependent on the other code, and not so much on general functions.
Nice video!
I asked it about configuring opcua in m241. It went in quite wrong direction. Suggested me to use a expansion module for a different plc (different manufacturer)!
I agree though, it is amazing how much it knows and how well it communicates it.
Very Interesting video. Curious as to what your thoughts are regarding ladder and function block programming? what do you think is the future? or do you think Structured Text will take over?
I live in South Africa and here the standard is ladder as it is easier for the electrician to also fault find.
FunctionBlock>LadderLogic>ScriptedText
I asked it how to connect to Beckhoff PLC using Python and it came up with pyads and example code to connect.
That's awesome! 🥳
Great video, Jakob!
Glad you enjoyed it
The ladder diagram stuff it outputs is pretty funny, I tried it myself a couple weeks ago, will watch this video in full later!
Hi Jakob, thanks for the great video. It really made me wanna try it out too. However, my feeling regarding the answers is a bit different compared to yours. I agree they read very comprehensive and "knowledgable". But on second sight they could also have been given in another (probably more general) context using the same pattern. So, my feeling is that they are rather superficial. They read impressive, but do for my taste not exceed the level of a search engine with a good user interface.
Great Sense of Humor Jake// That Helps with Hi-Tech " Jelly-Rolls", Haha
8:05 others probably already mentioned this, but you actually got logged off for some reason^^ happens to me also relatively often
You can copy youre code in to chatGPT and ask for hjelp on how to make youre code. It can take long programs. Or you can get help to make functionblocks etc. I have tride it with C, python and codesys
I knew this, I've been asking chatGPT to make program a month ago. And it's working
Jakob, you are the Tony Stark of industrial automation, and this video is your Iron Man suit. Keep building those awesome robots! 🤩
Tony Stark of industrial automation!!!! 🤣🤣🤣 This made my week!!! 🤣
@@JakobSagatowski 😜
Fun video, never expected it to understand IEC 61131-3 languages! That ladder programming looks about as good as i'm writing it 😂
I agree in the way that this type of AI won't take our jobs directly in the near future. But it can be that makes us much more efficient that what was previously possible, as you said. But if 1 Automation Engineer can now work as fast as 3 current Automation Engineers, then these AIs can make us indirectly loose our jobs. But just like when computers became mainstream and a lot of jobs became obsolete, a lot of new jobs will appear in its place. So I don't see it as a problem either, for a good while at least 😉 Would love to hear a deeper insight about this subject from you in the future.
Hade gött!
Sure, here's an example of a ladder logic program for a smart home using Siemens SIMATIC STEP 7 software and a Siemens S7-1200 PLC.
Assumptions:
- The smart home includes several devices, such as lights, fans, and air conditioners, which are connected to the PLC.
- The PLC receives commands from a user interface to turn specific devices on or off or adjust their settings.
- The PLC continuously monitors the status of all devices and reports any changes to the user interface.
Ladder Logic Program:
| Network | Symbol | Description |
| --- | --- | --- |
| 1 | I0.0 | Start button |
| 1 | Q0.0 | Living room light |
| 1 | Q0.1 | Living room fan |
| 1 | Q0.2 | Living room AC |
| 1 | M0.0 | User interface ready |
| 1 | M0.1 | Living room light command |
| 1 | M0.2 | Living room fan command |
| 1 | M0.3 | Living room AC temperature command |
| 1 | M0.4 | Living room light status |
| 1 | M0.5 | Living room fan status |
| 1 | M0.6 | Living room AC status |
| | | |
| 1.0 | A | I0.0 |
| | | |
| 1.1 | A | M0.0 |
| | | |
| 2.0 | X0.0 | Living room light |
| | | |
| 2.1 | A | M0.1 |
| 2.1 | O | Q0.0 |
| 2.1 | A | Q0.0 |
| 2.1 | A | M0.4 |
| | | |
| 3.0 | X0.1 | Living room fan |
| | | |
| 3.1 | A | M0.2 |
| 3.1 | O | Q0.1 |
| 3.1 | A | Q0.1 |
| 3.1 | A | M0.5 |
| | | |
| 4.0 | X0.2 | Living room AC |
| | | |
| 4.1 | A | M0.3 |
| 4.1 | A | M0.6 |
| 4.1 | O | Q0.2 |
| 4.1 | A | Q0.2 |
| | | |
| 5.0 | X0.3 | Living room AC temperature too high |
| | | |
| 5.1 | I0.1 | Living room temperature sensor |
| 5.1 | GT | 25 |
| 5.1 | A | X0.3 |
| | | |
| 6.0 | X0.4 | Living room AC temperature too low |
| | | |
| 6.1 | I0.1 | Living room temperature sensor |
| 6.1 | LT | 18 |
| 6.1 | A | X0.4 |
| | | |
| 7.0 | X0.5 | Living room AC too long |
| | | |
| 7.1 | M0.7 | Living room AC timer |
| 7.1 | TIM | 00:05 |
| 7.1 | A | X0.5 |
| | | |
| 8.0 | X0.6 | Living room AC too short |
| | | |
| 8.1 | M0.8 | Living room
? write me a ladder logic smart home program using siemans
Actually you can write a program in Ladder, you need to define it as (Ladder Logic)
I like the bossa nova as background music
I'm the plc programing in auto mechan . what help ai to PLC
Thank you 🙏
Any time!
That keyboard caught my attention.. I guess they are pbt keycaps. What's the brand of the keyboard?
Nice video Jacob. Maybe V2 with C# (and ADS communication to Beckhoff) ?
If I manage to get into ChatGPT 😅 It's overwhelmed 😅
Am I the only one that noticed the mistake in the LCG random number generator? It should be
seed := (seed * A + C) mod M;
random_number = seed / M;
inside the loop, no?
you are not alone 😂
I've been dreaming and breathing it in and out 😂 every day
Its too bad it buzz out when asked to write in ladder diagram. It might have been simpler to do an IL or XML.
this is a nice show me video. However the true capabilities of ChatGPT would be demonstrated by having more experienced placing the text request to ChatGPT. 😎 Thanks.
If you ask ChatGPT the same question twice the second answer might be worded a little different as the AI is still learning. 🥳
Goot Morgan sir
Cool video and amazing what ChatGPT could already do!
good topic
Very Good!!!
24:00 oh no :D
I have started trying to use this for Automation Direct PLC. If there is anyone who would like to talk about it over phone let me know.
Any idea how to get ladder from it ?
Google gives better answers in this case than Chatgpt, you had test and show this point here. In addition your questions were simple, like write for me a function in struct text. Automation is more than one function block. If you ask Chatgpt to give you a design of a while system, including plcs, scada and communications protocols it could not give this design. .
I there, try another video and ask for code in ST but with norma IEC 61131-3 and you love the answer.
What's crazy to me is that not only can it write valid code but that it can also modify and troubleshoot the code upon request. And it's not even meant to be good at it, it just happens to be.
The company I work for intends to use ChatGPT to fill the gap in manpower instead of hiring additional programmers.
I'm not convinced that it'll reduce the workload on us, but we'll see I guess... he's the boss.
Can we get a follow up?
Whelp time to move to the woods and get used to the taste of deer jerky.
You should ask if ST or SCL is better ;)
You actually contradicted yourself a bit; When YOU get more productive, someone doesn't get any work at all. I.E if we become 10x more productive eventually, one of two things happens, a) a large portion will not get any work, or b) downward pressure on what one can charge for the output, or a combination of both.
You are assuming the amount of work is constant and will not increase, and that this will not bring more opportunities and shift what we will do instead. From what I can see, there has never been more automation work to do and I don't see it decrease. I can already see me and others doing more work on other value-bringing things instead that are lacking in the world of industrial automation, such as writing proper tests for our code.
@@JakobSagatowski True... Although I am looking at the entire IT sector, not only industrial automation.
anazing!
Ask it can you write a chatGPT in plc structured text
Here we go haven't even graduated yet ai can take my job
😅
Don’t worry, chatgpt cannot, by definition, acquire tacit knowledge, which is where most value in engineering comes from. Also code generation has been around for a while. By the time you get chatgpt to output something usable, you could have configured a code generation tool or rolled your own, which many people have been doing since the 90s.
4026 is coming soon! lol
Not bad:
please describe the scan cycle of a plc
The scan cycle is the process by which a PLC (Programmable Logic Controller) periodically reads input data, processes that data, and updates output data. The scan cycle is typically broken down into several steps:
Input Scan: The PLC scans the input devices and reads their current state. The input data is then stored in the PLC's memory.
Program Execution: The PLC then executes the program stored in its memory. The program uses the input data to make decisions and perform calculations.
Output Scan: The PLC scans the output devices and updates their state based on the results of the program execution. The output data is also stored in the PLC's memory.
Housekeeping: The PLC performs any necessary housekeeping tasks, such as checking for errors or updating diagnostic information.
Repeat: The entire process is repeated, typically at a high frequency, such as every few milliseconds, to ensure that the PLC is continuously monitoring and controlling the process or system.
The duration of the scan cycle can vary depending on the PLC model and the complexity of the program, but typically is between 1-10 milliseconds.
It may helps, but it is not perfect
chat gpt sucks now it only lets you have n number of tries then it shuts down an wants money!
Another loud typer,
Not easy to get old & deaf 😅