让ChatGPT编PLC程序 点击:841 | 回复:7



abysmal

    
  • 精华:1帖
  • 求助:0帖
  • 帖子:16帖 | 2181回
  • 年度积分:24
  • 历史总积分:11212
  • 注册:2001年10月26日
发表于:2023-08-08 09:59:45
楼主


闲着没事突发奇想,看看ChatGPT能不能帮助我们编写PLC程序,对话如下:


Can you write a PLC ladder program for control the traffic light?
ChatGPT

Certainly! Controlling a traffic light using a PLC ladder program is a common educational example. The typical sequence for a basic traffic light is:

  1. Green (Main road)

  2. Yellow (Main road)

  3. Red (Main road) & Green (Side road)

  4. Red (Main road) & Yellow (Side road)

  5. Red (Main road) & Red (Side road)

Given this, here's a simple outline for a traffic light ladder logic:

Inputs:

  • Start (Push button to initiate the sequence)

  • Stop (Push button to halt the sequence)

Outputs:

  • GreenLight_Main

  • YellowLight_Main

  • RedLight_Main

  • GreenLight_Side

  • YellowLight_Side

  • RedLight_Side

Timers:

  • Timer_Green_Main

  • Timer_Yellow_Main

  • Timer_Green_Side

  • Timer_Yellow_Side

Ladder Logic:

  1. Start and Stop Control:

    • Start button (NO contact) in series with a Set coil for a relay "SequenceRun"

    • Stop button (NO contact) in series with a Reset coil for the same relay

  2. Green Light (Main Road) Sequence:

    • SequenceRun (NO contact) in series with GreenLight_Main (NO contact) in series with Timer_Green_Main

    • Timer_Green_Main (Time Done contact) in series with a Set coil for a relay "NextSequence"

  3. Yellow Light (Main Road) Sequence:

    • NextSequence (NO contact) and SequenceRun (NO contact) in series with YellowLight_Main (NO contact) in series with Timer_Yellow_Main

    • Timer_Yellow_Main (Time Done contact) in series with a Set coil for another relay "NextSequence2"

  4. Red Light (Main Road) and Green Light (Side Road) Sequence:

    • NextSequence2 (NO contact) and SequenceRun (NO contact) in series with RedLight_Main coil and GreenLight_Side coil in parallel.

    • SequenceRun (NO contact) and GreenLight_Side (NO contact) in series with Timer_Green_Side

    • Timer_Green_Side (Time Done contact) in series with a Set coil for another relay "NextSequence3"

  5. Red Light (Main Road) and Yellow Light (Side Road) Sequence:

    • NextSequence3 (NO contact) and SequenceRun (NO contact) in series with YellowLight_Side (NO contact) in series with Timer_Yellow_Side

    • Timer_Yellow_Side (Time Done contact) resets the "NextSequence", "NextSequence2", and "NextSequence3" relays to go back to the start of the sequence.

Note: This is a simplified version. In a real-world situation, additional safety interlocks, sensor inputs (like vehicle detection), pedestrian crossing sequences, etc., would be required. Always consult with a trained PLC programmer or engineer when creating ladder logic for real-world applications.

User
Can you present your ladder logic in a picture?
ChatGPT

I'm sorry for the inconvenience, but I can't directly produce or display images. However, I can guide you through creating a visual representation of the ladder logic:

  1. Start with a vertical power rail on the left. This represents your source voltage.

  2. Add horizontal rungs for each logic sequence I've described.

Here's a step-by-step visual description:

Rung 1:

  • Start with a Normally Open (NO) contact labeled "Start" leading to a coil on the far right labeled "SequenceRun Set".

Rung 2:

  • A Normally Open (NO) contact labeled "Stop" leading to a coil on the far right labeled "SequenceRun Reset".

Rung 3:

  • NO contact labeled "SequenceRun", followed by another NO contact labeled "GreenLight_Main" leading to a Timer labeled "Timer_Green_Main".

  • At the end of this timer, put a coil labeled "NextSequence Set".

Rung 4:

  • NO contact labeled "NextSequence", followed by another NO contact labeled "SequenceRun" and another NO contact labeled "YellowLight_Main" leading to a Timer labeled "Timer_Yellow_Main".

  • At the end of this timer, put a coil labeled "NextSequence2 Set".

Rung 5:

  • NO contact labeled "NextSequence2", followed by another NO contact labeled "SequenceRun", leading to two parallel branches:

    • One with a coil labeled "RedLight_Main".

    • One with a coil labeled "GreenLight_Side".

  • Also, below them, a sequence of NO contacts for "SequenceRun" and "GreenLight_Side" leading to a Timer labeled "Timer_Green_Side".

  • At the end of this timer, put a coil labeled "NextSequence3 Set".

Rung 6:

  • NO contact labeled "NextSequence3", followed by another NO contact labeled "SequenceRun" and another NO contact labeled "YellowLight_Side" leading to a Timer labeled "Timer_Yellow_Side".

  • At the end of this timer, put coils labeled "NextSequence Reset", "NextSequence2 Reset", and "NextSequence3 Reset" in parallel to reset the sequence.

You can use software like TIA Portal (for Siemens PLCs), RSLogix/Studio 5000 (for Rockwell Automation's Allen-Bradley PLCs), or any other PLC programming software to create a visual ladder diagram based on this description. If you're not using a specific PLC software, you can even sketch it out on paper or use a drawing tool like Microsoft Visio, Draw.io, etc., to create a visual representation.


看来ChatGPT无法输出图片,只能用语言来描述梯形图。

不过它的知识储备和语言组织表达能力,确实厉害!




楼主最近还看过



yuanle

  • 精华:0帖
  • 求助:0帖
  • 帖子:9帖 | 10222回
  • 年度积分:3356
  • 历史总积分:48941
  • 注册:2005年4月22日
发表于:2023-08-08 14:37:43
1楼

ChatGpt可以用指令表来描述问题,但是指令表输入到对应的PLC软件中错误百出,你是没有想修正的想法的,最后浪费了时间还要重新回到起点。


HAVE FUN!

ac米兰

  • 精华:4帖
  • 求助:0帖
  • 帖子:234帖 | 12447回
  • 年度积分:4001
  • 历史总积分:30833
  • 注册:2004年4月26日
发表于:2023-08-09 08:15:28
2楼

个别的程序编下还凑合 

gk2017

  • 精华:0帖
  • 求助:1帖
  • 帖子:1帖 | 4回
  • 年度积分:696
  • 历史总积分:746
  • 注册:2019年10月11日
发表于:2023-08-09 08:22:40
3楼

你让他写ST就应该可以写出来了

mangniu10

  • 精华:0帖
  • 求助:2帖
  • 帖子:2帖 | 69回
  • 年度积分:0
  • 历史总积分:109
  • 注册:2010年10月15日
发表于:2023-08-10 09:53:02
4楼

可以提供很强大的思维逻辑支持,非常棒的体验。

松伢子

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 129回
  • 年度积分:0
  • 历史总积分:54
  • 注册:2013年9月01日
发表于:2023-08-12 13:40:20
5楼

学习学习

olove83

  • 精华:0帖
  • 求助:0帖
  • 帖子:6帖 | 414回
  • 年度积分:981
  • 历史总积分:1730
  • 注册:2008年6月17日
发表于:2023-08-15 15:08:57
6楼

太嫩了,ST语言没听说过吗?

abysmal

  • 精华:1帖
  • 求助:0帖
  • 帖子:16帖 | 2181回
  • 年度积分:24
  • 历史总积分:11212
  • 注册:2001年10月26日
发表于:2023-08-29 09:09:19
7楼

ST语言是我用得最多的PLC编程语言。早年曾经用ST语言编写过几个HVAC和列车门控系统。

就是PLC软件技术发展缓慢,现在已经转职不编PLC程序了。


热门招聘
相关主题

官方公众号

智造工程师