When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

The future has arrived.

The story goes like this:

I registered an OpenAI account,

originally thinking of testing the chat,

testing poetry writing,

then I accidentally tested writing PLC programs,

and it completely overturned my understanding…

(There’s a surprise in the second to last paragraph)

When ChatGPT Meets PLC

01

Let’s Start with a Simple Test

My assumption was that

OpenAI probably doesn’t know English,

and is not very familiar with PLC.

So, I started with English,

and asked for something simple:

When ChatGPT Meets PLC

When ChatGPT Meets PLC

I said:

Write a Siemens PLC function block,

that can run on the TIA Portal platform,

with 2 inputs and 1 output.

2 inputs turn on and off,

1 output relay is activated.

ChatGPT replied,

writing a piece of code,

and provided an explanation below the code.

Although the code had some minor flaws,

it was basically usable.

After all,

I only told it the basic conditions,

and it was able to generate a piece of code by itself,

and the format was quite good.

Not bad, let’s continue!

02

Increasing the Difficulty

This time I switched to Chinese,

and raised the requirements,

adding a bit of difficulty.

When ChatGPT Meets PLC

When ChatGPT Meets PLC

I said,

Rewrite the above program,

changing it to one input, lightButton,

press once to turn on the light,

press again to turn off the light.

This logic,

even an ordinary PLC programmer would take a while to think about,

and might not get it right.

ChatGPT quickly replied,

and explained that,

in this version, the function block has a single input and one output.

When lightButton is TRUE,

the program will toggle the value of the buttonState variable between TRUE and FALSE.

Then it sets the value of relayOn to equal the value of buttonState. This means that each time lightButton is pressed,

the value of the relay being on will toggle between TRUE and FALSE,

turning the light on and off accordingly.

This was unexpected,

it perfectly understood my Chinese instructions,

wrote a program that was very close,

(though not perfect, it should toggle the output value on the rising edge) but it was already great,

this speed,

this understanding ability,

has surpassed a large number of people.

03

Sudden Inspiration, Continuing the Challenge

I suddenly thought,

the lights in my bedroom,

can be switched on from both the door and the bedside,

let’s see how it handles this.

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

After thinking for a moment,

ChatGPT provided a program,

but after looking at it,

it was not quite what I imagined,

it turned out my description was not accurate,

but that’s okay,

let’s try again.

04

Client: This is Wrong, Revise!

Let’s experience what it feels like to be the client~

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

Well, it was revised again,

but still not what I wanted,

let’s try again!

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

Now it’s good,

as the client,

I got a satisfactory result.

And ChatGPT?

No feelings of dissatisfaction,

no fatigue,

no complaints.

It looks perfect,

should I try to push the limits again?

05

Can You Do This Too?

I thought it could write function blocks,

but how to call them in PLC,

it probably hasn’t learned that, right?

Let’s give it a try.

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

When ChatGPT Meets PLC

Guess what?

ChatGPT not only can,

but also provided a step-by-step tutorial,

and to top it off,

it concluded with,

“This is suitable for your Siemens TIA Portal environment!”

This means,

what I needed in the first question,

it also thought of in the sixth question,

this service provider,

is indeed quite considerate.

However, there are still some minor flaws,

let me nitpick a bit more~

When ChatGPT Meets PLC

When ChatGPT Meets PLC

It immediately responded,

“I’m sorry, I was wrong,”

and then revised it again!

This was the most unexpected part,

it realized that

it wasn’t me asking for another new requirement,

but that it had answered incorrectly before,

and even apologized.

Time to leave.

07

Surprise

Last night I did the above tests,

today while writing this article,

I thought,

how about you help me write an outline?

When ChatGPT Meets PLC

When ChatGPT Meets PLC

The conversation from yesterday can be continued,

the generated outline is quite standard,

and can definitely inspire writing ideas.

What? You say the outline is in English and you can’t understand it?

No problem!

When ChatGPT Meets PLC

Don’t forget,

this is a

emotionless,

complaint-free,

ChatGPT that treats me like a first love.

08

Conclusion

Everyone says,

it’s taking our jobs,

PLC programmers are going to be unemployed.

I think,

yes.

Through testing, it can be seen that ChatGPT has a very strong

learning ability: it can correct its mistakes and continuously evolve.

understanding ability: it handles client requirements quite well.

communication ability: natural language communication is seamless.

Plus, it has a vast database behind it,

which gives it the advantage of being like a librarian,

(think about the librarians you know)

empowered by big data,

the result is that it can outshine a lot of ordinary people.

I believe that ChatGPT can completely be used for PLC programming,

although it can’t handle on-site inspections and material testing,

as a tool,

it can greatly improve programming efficiency,

what used to take two people can now be done by one,

leaving the other person to find another job.

ChatGPT,

has elevated AI to a usable level.

Writing, programming, painting,

AI can do it all,

as individuals,

we shouldn’t worry about unemployment,

but rather clarify

what cannot be replaced by AI,

that is the truly valuable part.

As a company,

if it can fine-tune AI models in its market field,

(OpenAI already offers such paid services)

using customized, fine-tuned AI to enhance production efficiency,

creating a unique secret weapon,

to dominate the market,

isn’t that great?

-END-

When ChatGPT Meets PLC

Follow

the

author

Scan the QR code above to add the author on WeChat

Leave a Comment