ChatGPT and PLC programming

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Japanese [Music] open AI chapter [Music] open AI [Music] chat chipity chat chippy tea that has been on the news constantly for two months now and I guess you've heard about it as well for you that have been living under a rock the last month or so and don't know what it is it's a chatbot launched by open AI in November 2022 so very recently it's already valued at 29 billion dollars that went very very fast so I've been of course thinking about this a lot however I have made the assumption that this is not applicable for PLC programming of course I assume that it's probably gonna work for Java for C plus plus for python for a traditional programming language but I assume that it's not gonna work that good for plcs and the simple reason is that this bot needs some data input from various sources and as you know with plcs it's really really hard to find information on the web as it is but I thought today we're gonna have a little bit of fun and we're just gonna play around with this a little bit so this is gonna be the first time for me and I thought it would just be fun to record that so let's just go nuts buckle up chip and ask it some questions okay tiny friend do you know how to do PLC programming [Music] I am okay yeah this was an easy question I guess we'll start easy and get with the tougher questions later okay that's cool okay it starts out good I like this already if you have any other questions about PLC programming yep sure I have more questions uh [Music] for example can you write me a pip controller in structure text oh does it have a concept of what structured text is I'm actually surprised about that that it knows that I'm talking about structured text in ISC yeah and it's actually using correct ISC types okay so it's writing a whole program not the function block or something but the whole program that for the pit controller okay this is really interesting so it runs a while one Loop which basically simulates the site the task of a PLC um which is of course makes sense here because it you know we can't add stuff like task configuration and task stuff in in the code here but yeah I assume that this is correct but for sure the syntax is correct the only thing is of course that it makes some methods here uh where you get the set point and you get the input where you read the input proportional blah blah blah is this is just an example you need to adjust the program for the specific PLC as this example doesn't include an input and output function or variables you need to use the input and notification functions of your PLC for that that's yeah that's amazing because that's actually different for for various plcs so this is probably what would make sense the most impressive let's ask it more questions can you can you what do we want can you help me write a random random number generator in structured text sure it starts good I mean it it answers quite quickly the problem you know when I ask in structured texts that's asking a lot of it because you know the different PLC vendors they have their different interpretation of structure text so you know there is the standard but there's always specific libraries and specific versions of structure text but that's the same here so it does a program you have a seed you have the random number it returns this as a real and then the white one which kind of simulates the task yeah okay so I guess this generates a random number I can't quite see where the randomness comes from here but the syntax looks good so I'm actually really surprised by that let's ask it something less serious is c c months PLC better than black coffee [Music] okay it's aware of what Siemens and back off are it's giving a very politically correct answer I didn't expect anything else it's interesting Siemens plcs are known for the robustness and reliability well on the other hand back of plcs on the other hand are known for the flexibility in open architecture you can interpret that in whatever way you want and the last sentences in summary both Siemens and backup plcs are reliable and high quality so that's a very nice General answer it's recommended to consult with the manufacturer or experts in the field I agree what can we ask now what is what is the difference between a function block and a function So In traditional programming you use classes in plcs you use function blocks so I'm just curious whether it will actually detect this and still talk about plcs yeah amazing [Music] yeah I think this is actually quite a good summary of the difference I would probably say that I mean the important thing with function blocks is that they can have state but that's implicitly by saying that yeah you can execute it multiple times within a program maybe and I this is actually not correct it doesn't have its own local variables a function can have local variables but they're not stored between cyclic calls so the local variables are only used in one in one call of the function not between multiple calls but still I would say they've hit on the most important points here though actually it says here that functions cannot have their own inputs and outputs which isn't correct either because they can in ISC they can have instruction text and I see you can have inputs and outputs for a function as well so not sure why it answers it in this way to be honest if you have any idea why it answers it in this way please leave a comment below let's be a little more specific and ask it something that I don't think it will be able to ask can you write me a function block for a pack of el1008 Terminal A very common terminal sure okay it's very optimistic I like it okay um let me think here it wants the channel this function block is called el 1008 input it takes two inputs Channel and input value the channel input is the channel number of that one okay so it's aware of the different channels and the input value is the value read from the terminal okay so you provided the channel whoops network error what happened there okay let's do that again we generate response no nothing maybe we overloaded it when we asked for a backup terminal maybe we scared it with the with the back of digital input terminal but it it looked good so let's ask it something else can you write me a function block that function blocking structure text I don't know whether I need to mention that or not but it takes a bottom press can you write this button press is that even a correct word let's see button press as input and provide a string of whether the bottom whether the button is pressed or not just as output that's what we want okay it's been thinking for like 30 seconds error crap do I need to reload the page Maybe yeah obviously I mean I assume that this page is overloaded with people like me probably not PLC programmers but people that are curious of what the purpose of life is and other important questions so let's just reload this page now I got we're experiencing exceptional high demand yeah not surprised let's try again can you write me a function block that takes a bottom press as input and provides a string yeah of whether the top press pause output ah error okay I've reloaded the page let's try it again [Music] in structure text Maybe [Music] it wrote a function instead of function block that's fine the syntax seems to be correct okay I'm not sure this this looks very weird because oh it's just scrolling here I mean it it gives the bass that that's what I would see I mean obviously you have to use VAR input here instead of this I don't think this this Syntax for sure in Twin cat you can do it like this and then it returns both a string here and as um okay it's not on power output it's just a local variable string if button then blah blah blah and then return button press as output yeah that's correct except for this one which has to be a for input normally uh other than that it's actually correct so with very minor modifications you can actually make this work and compile in twinket or codices even gives a nice tiny description of what the code is doing and an example of how to how to use it so this looks a little weird and function and which function is this a function or yeah but I mean I'm honestly really surprised of how good this is this is much more than I mean this is magic you know well apparently it didn't like that that's that I thought it was magic it crashed again well I had to restart it again and now it's actually warning me about we're experiencing exceptionally higher demand so I hope they will upgrade their servers I'm sure they can afford it can you write me a piece of code instructor text and that sets um I'll post it through five seconds after our button has been pressed my fantasy is really bad today I'm gonna copy this guy in case I will have to ask it again okay so it is using a timer a ton there it's more or less correct I see two problems with this code it's using a timer on which is a good thing the only thing is that it assumes that the button has to be pressed all the time because if you press it once and then you remove the Press then it's gonna reset the timer because button is gonna go low and the timer on will reset that's the first problem secondly when you use an output from Q this is not the correct syntax this is a this is the assignment operator you would need the one where yeah you know the the output operators so to speak but other than that it's correct I'm actually surprised it even gave an answer on this question let's ask something even trickier can you write me a function block blocking structure text that transmits uh text string over uh TCP IP socket using a back of screen capture three wow okay this will be interesting I don't think anything like TC3 open socket exists neither does TC3 send socket but the base structure is correct it's just that this is not obviously not done using twink at 3 or any other PLC that I can think of the syntax looks very weird and function block but I mean maybe we should see this a little more like seldo code and not the actual correct syntax that's using the the libraries because I mean if you just look at look at this normally so yeah if you go to Google tf6310 DCP IP Infosys we would normally be doing you know this guy socket connect and FB socket sound that's what you normally do when you want to transmit over sockets using Trinkets and you would also need a state machine right that governs this so making the socket connection and then sending the data but it is still structure text I mean you have string 255 not sure you use this I would I think you normally use parenthesis instead to set the size of the string but it confidently says here please note that this is just an example and you should adjust IP address import number to match your specific setup and obviously there are many other changes that would have to be done here so actually let's take this question and be a little more specific let's see if it makes any difference using back holes pf6310 I doubt it knows what this is okay so more or less the same something very weird I mean this doesn't exist tf6310 open socket but still it's interesting because it gives me an answer as if it knows what it is doing but still I mean this is correct you you have a when you use Sun socket you normally provide a handle to a socket which it does with what this does and you need to provide the the address of the byte buffer that you're gonna send which it does here as well because text is a byte puffer or a string buffer and the length of the of the buffer or the data that you're going to send interestingly here enough it says please note that the tf6310 is a device from backup that allows to use ethernet communication on plcs and it and it's not the standard library from yeah that's correct actually so you may need to import the library for using the socket functions so somehow it knows what it is still still I'm still impressed okay so let's ask it what's the difference difference between tf63 term and tf6311 so tf-63 ton is the non-real-time TCP communication library and tf6311 is the one that's connected to the twin cut scheduler so the real-time one let's see whether it's going to guess or whether it will know what it actually is well not that's actually not the difference it's it's it's not the difference between the speed I mean it is the difference between speed but not whether it's 100 or megabit or 1000 megabits though it is true that with tf6311 you can actually get the higher throughputs done with tf6310 however here it it seems to be really confused because it's talk about a built-in switch like there are actual physical devices which is not the case these are this is software pure software both of them so mounted around in real I think here I think chat GDP Jeep chat GPT is confused let's continue can I do Version Control using cap free yes you can correct you can let's see what it says twinkle three supports integration with virus control systems such as git subversion and TFS interestingly enough here it talks about the Version Control integration through the twin cat 3 PLC control editor I guess we can call the xae this that works for me please note that the integration of Twinkle three with Version Control Systems is not a straightforward process it requires such a knowledge of Version Control fully agree I fully agree with this so I would say it answered that question it did so you can do Version Control actually if you want to know how to do Version Control then watch the video here above with full instructions and a course on how you do that for free I'm impressed I'm impressed can I do tdd with plcs should we do yep so test driven development okay it starts with explaining what test driven development is which is nice so if you want to know more about test driven development and twinka3 please watch my video up here I have a video and a course about that that's for free as well I think it gave an excellent answer here because it actually says the problems it is possible to do tdd with plcs but it can be more challenging than with traditional software development due to inherent real-time nature appeals is and the fact that plcs interact with physical equipment so okay that's true although you can still do tdd with you know because the idea with tdd is to test the lowest level of your code so your functions and your function blocks there are some Frameworks and libraries that enable tdd for plcs I haven't looked into these two but um I guess they exist for twinket you can use a TC unit if you want to test driven development it's important to note that tdd can be challenging to implement implcs due to the nature of the systems and it may require more effort and specialized knowledge than tradition software development and that's also true and also the case that we don't have the tooling that we're used to for doing tdd like we have in the traditional software development world but overall I'm impressed by the answer it answers the question let's ask it even an even more tricky question so can should not come why don't don't automation Defenders towards source code in plain text that's a very general question I don't expect anything okay interesting it has an answer amazing let's see what it says no network error I wanted to see I wanted to see what it what I said I'm gonna ask this question again let's copy paste it and reload the page let's try ask the question again here we go okay so it actually doesn't I mean all of this is of course true um but the most important reason is money money they want to make money by locking you in that's the reason okay let's not get too political here uh what are the pros and cons of mqtt versus OPC I would say you can mix them they're not mutually exclusive so to speak so you can I even worked in a project where we were using both it's just I'm really curious whether it knows about these Concepts and can give some form of comparison or answer let's see what it says okay so it gave up very long and very good answer so it actually talks about their both communication protocols for Industrial Automation and internet of things and then it mentions some pros of mqtt low overhead efficient flexible and some of the columns limited security and limited data modeling right so you have to do your own data modeling for mqtt while with opcoa you get rich data modeling to as a contrast it's secure it has security building and it's interoperable so but with higher overhead so it's of course much much more overhead to get all of this stuff and more complex and this I can assure you if you ever tried to implement an opcua client and or you even use an OPC client Library compared to using mqtt it's like night and day mqtt is much much easier so but in summary there's some it gives this nice summary when mqtt is a good choice and when OPC way is a good choice I would want to add to this that you can actually use even both in some scenarios for different type of data streams but this was a very very good answer I'm really um this fields like magic you are cool okay it's very humble I am just a machine learning model but it thanked me okay it feels a little bit like chatting with a human let's ask something more generic why do automation vendors charge so much for the development environment oh crash again okay let's copy this question and ask it again okay so automation vendors May charge a high price because it includes a significant amount of research and developing cost as well as costs associated with maintaining update in the software other software products which can justify higher price points some charger premium price for the some vendors may also charge a premium price for their development amount due to its popularity and wide use in the industry yeah that's for sure you know we've been talking structure text structure text here all the time let's ask it can you do a simple program in ladder diagram sure okay how it's going to do ASCII characters or what it's oh yeah seriously it's using yes asking characters to draw ladder diagram that turns on the light when a push button is pressed oh oh how long is it gonna make it PB that's the push button okay it's been drawing this for like one and a half minute now I think it's stuck in something maybe it got confused by this maybe it just wants to say I don't want to use ladder diagram and then it just died no but I'm curious of this one I'm gonna ask the same question again so let's try again okay not sure this is very a very useful leather diagram example but at least it's aware of what it is I mean I ask it for simple example so yeah I mean that's open for interpretation obviously but it's it's aware of it and it did something using ASCII characters and I think that's that's that just automatically gives it a 5 out of 5 stars for me I didn't expect it to know what to do with this question it even gives some nice General end wording it's important to note that this is a very simple example and the leather diagram can be used for complex control system in industrial applications so yeah this is a lot of fun this is really really fun I I didn't think I would have so much fun doing this can I make a backhook PLC talk to a Siemens PLC it gave an excellent answer here actually it is possible to do it but may require additional hardware and software to convert the communication protocols between the two backoff uses etiquette yeah so it's aware of this that it got is de facto standard for back off while siemen uses severity protocols such as profinet profit profit bus and Industrial internet on their if they're on the same network you can use a Gateway or Bridge device or just normal TCP IP as well of course and you can yeah convert to the different communication protocols from one to the other so another alternative is going the open way and using opcoa so yeah I mean this was a really really good answer and it answered my question now let's ask something more a more soft question what makes a good automation engineer yeah this one is um again an excellent answer I would say so it gave a very very long answer this time I think it was about to give an even longer answer but it just stopped I'm not sure it's finished but basically says technical expertise which is of course the thing we first think about but then it mentions the problem solving skills that automation engine often need to find Creative Solutions some project management skills absolutely you know how it is you have to lead yourself you have to lead others and often you get a lot of responsibility strong communication skills absolutely not just within your team but with the customer going out and meeting them adaptability attention to details safety oriented very important aspect of it absolutely working with safety is a critical aspect of automation engineering I agree detail-oriented and strong analytical skills and strong understanding of Industry standards I mean it's I guess it took really the most important things if you have any additions to this you're of course welcome to add them in the comments below but overall I'm really impressed by the answer that it gave me now I'm gonna ask a very Politically Incorrect question and I assume I will receive many comments about this question here in the in the comments here on YouTube is structure text or leather diagram the best very general question the best it can there can only be one right I'm not expecting it to give me the pointed to one to one of them I would say it gave an answer that most of us would agree with maybe not most of us but I think it gave up quite a good answer here actually each has its own advantages and disadvantages and the best one to use depends on the specific application and preferences of the programmer that's that's true so it just mentions that it's a graphical programming language easy to understand for people who are familiar with electrical control absolutely it's also a simple to troubleshoot and debug if you have that background yeah structure text is a text-based programming language Pro similar to C or yeah I would say it's more similar to Pascal but it's not important it is more versatile than the other diagrams and it is more powerful than expressive for yeah complex blah blah in summary lab diagram is commonly used in Industrial Automation application and it is easy to understand troubleshoot and debug or structure checks is more versatile powerful and expressive and is more suitable for complex automation applications and mathematical operations Choice depends on the specific application and preferences of the programmer yeah I would agree with everything that's set here though I would want to add more stuff than this of course but a very nice General answer I actually more expected something like I'm not going to answer that because I don't want to get into a politically loaded conversation but it is just on AI after all and hopefully it doesn't have any feelings okay I think I'm just gonna ask it one more question because I mean I have so much fun I could do this the whole night but I guess this video is going to be insanely long so I'm just gonna ask it one more question and then we're done why is it taking back off so long to release twin caps 3 1 40 26. that will be my final question I'm not expecting it to give any answer to this one to be honest [Music] okay yeah okay so even though it's not aware of doesn't know about beckoff and Wing cat so much in this context it's still aware of that it is a softer product so it could give us a general answer about how complicated it is to do software releases so it mentions that yeah the some of the reasons could be complexity of the update absolutely I think back off for this release they're making big big big changes so I think they complexity this time is much much bigger than any of the other major build releases that beckoff have released prior to this one in twinka 3. quality assurance absolutely the way this we can all agree on that's a big problem in not just for back off but for any software project and this time yeah back off may be taking extra time to thoroughly test the update before releasing it that's good I think we can all agree on that dependencies may depend on other software yeah I guess so although in this case I think it's mostly the the internal complexity for doing the the changes for for the new functionality limited resources yeah I guess I mean that's true that's true for almost all software companies We're Never Enough developers or developers are doing the wrong things feedback from beta testers this I don't know I don't know what the beta tester program is for back off I'm not aware of any big one I think this is mostly an internal thing and here is a general thing it's worth noting that development of software products often takes more time than initial plan and it's common for release dates to slip yep I think that each and one of my viewers can agree with this statement it's also important to note that beckoff is a German company and their release schedule may be different from other companies okay because it's German it has a different release schedule I don't get this one but okay it is a German company that's true okay that's the final question I I've got to say this was a lot a lot of fun it was a really really great experience I mean obviously there's a lot that there's a lot of limitations here in the system it's in it's just impossible for me not to smile about it and be happy about what they've done here and just see the potential possibilities with the system I've seen some people complain on the web like oh this is going to take our jobs it's going to take our jobs as software developers and after trying this out I can't quite see this happen anytime soon I don't see this as something that's going to take our jobs the impression I get here by I mean I just use this for half an hour now but my first impression is that it's gonna extend my capabilities more and make me more efficient so it's just gonna make me a better an even better developer and I see it more like something that I can live with in symbiosis so to speak and yeah I'm I mean I'm hooked this is really really great well that's it for this video I hope I made you a little curious to try this out yourself please leave your thoughts in the comment section below and don't forget to give this video a like if you liked it and yeah see you in the next video [Music]
Info
Channel: Jakob Sagatowski
Views: 89,681
Rating: undefined out of 5
Keywords: ChatGPT, AI, PLC, TwinCAT, TwinCAT3, Beckhoff, Programmable logic controller, Software engineering, Software development, Control engineering, Automation, TwinCAT tutorial, TwinCAT software, TwinCAT 3, PLC tutorial, EtherCAT, Programming PLCs, How to program PLCs, TwinCAT3 tutorial, ADS, Beckhoff PLC, Software development using TwinCAT, TwinCAT 3 tutorial, TwinCAT XAE Shell, TwinCAT ads, TwinCAT 3 Beckhoff, CODESYS, PLC course, Programming, Development, Industrial Automation
Id: c_-1d3aV3Dk
Channel Id: undefined
Length: 32min 17sec (1937 seconds)
Published: Thu Jan 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.