[西门子] S7-200 SMART 案例之设备周期循环控制

[复制链接]
查看34261 | 回复0 | 2024-4-24 14:04:21 | 显示全部楼层 |阅读模式
S7-200 SMART案例之设备周期循环控制

相关软(硬)件:

1、编程软件:Step 7 - Micro / Win SMART V2.7

2、CPU硬件:SR20 (IP:192.168.2.1)

控制要求:

1、单台设备周期循环控制,设备自动时,运行N分后停止,等待N分再运行,如此循环,运行时间可调。

2、两台设备交替周期循环控制,设备自动时,设备1运行N分钟停止设备2运行;设备2运行N分钟停止设备1运行;如此循环,运行时间可调。设备1或设备2故障切换至另一台设备运行。手自动切换时,第一次先启动第一台设备,第二次启动第二台设备,依次循环。         

注:程序仅供参考!!!         

一、单台设备周期循环控制

(新建项目、添加子程序、添加变量、编写程序、调用子程序、关联变量、下载测试)

1、建立变量表:   

[img=685.010009765625,940.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhxdArAyAB3znEPm4hcylUicJRLiagAF0SQNGXNEjJTyyZQ6ts1JFKhzwA/640?wx_fmt=png[/img]

建立变量表   

2、编写程序:

[img=697.739990234375,531.2100219726562]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhkPKBC0ceHKZmtCeqMN1U2ksrath7U4Mj31icMBibarUFmNnIkVz5nEDg/640?wx_fmt=png[/img]

时间转换   

[img=697.739990234375,599.280029296875]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhq5TcvyHvicdb9qNlos2dFCdCHLiaICKRxsZA1DnPKw2MFOTv8xbKvT2A/640?wx_fmt=png[/img]

设备沿信号   

[img=697.739990234375,426.739990234375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhyrBVJttWYEQcmXEItwZxBTdZdBBGzdMguDK9wGJ6hzVJyxbmYlFGGQ/640?wx_fmt=png[/img]

设备沿信号

[img=697.739990234375,252.469970703125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrh9vPmg6SS5fWuq8u3WJkRkMzU6ia5BFcia0xQmSupHDkwLjjjREq9CejA/640?wx_fmt=png[/img]

设备手自动控制

[img=697.739990234375,151.0]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhdDgNdV8oliaY0Rhf2qQgZ1k0gEDwFTD2pFmX1ibcWKwg6JibTiaq5SpYZQ/640?wx_fmt=png[/img]

设备运行时间累加   

[img=697.739990234375,387.6099853515625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhweAGbph0CwmdC8kB0KQh1GEFGOSNwpOflJRPdWdAkSyFqgks0x0Lqw/640?wx_fmt=png[/img]

时间清零

[img=697.739990234375,139.13998413085938]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrh9NQQ0HoBYfHElE1tiallUJ46fUMpBSsgg7FkNxwoe1zd0A98JO0vhxA/640?wx_fmt=png[/img]

设备软故障判断   

[img=697.739990234375,434.3399963378906]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhj7ZXe6BVC2UxYqLia0aokpc6QB3POzrzXSSEJMqkXNhjLLlT6v7rwYQ/640?wx_fmt=png[/img]

设备输出

完整程序:



3、下载测试:   

[img=608.010009765625,673.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhrPC5BxNtFS1LLGia4MH5EwfwdKebiaz9yVwnN2sRFJvibFdO7zaGjWUoA/640?wx_fmt=png[/img]

主程序调用   

[img=613.010009765625,671.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhp4y9v5xicyZbR1sBYnknOgjkYNIyB3qtoFIK9bDDkzHrfRVccibug7gA/640?wx_fmt=png[/img]

下载测试1   

[img=618.010009765625,672.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhzUiadtF2d46EIrltJ9CGRcO7ZrGpA4aicJRGT1p3SY4kBhxpoAw1Fgvw/640?wx_fmt=png[/img]

下载测试2

二、视频演示:(单台设备周期循环控制)


video: https://mp.weixin.qq.com/mp/readtemplate?t=pages/video_player_tmpl&action=mpvideo&auto=0&vid=wxv_3383935254293610497
三、两台设备周期循环控制

(新建项目、添加子程序、添加变量、编写程序、调用子程序、关联变量、下载测试)

1、建立变量表:   

[img=636.010009765625,931.2100219726562]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhNzTrzTwiaWTB5G97bpPic3iaTpMXNAY73FjNe5OaJ3tt59VqswI7GF4TA/640?wx_fmt=png[/img]

建立变量表

2、编写程序:   

[img=697.739990234375,535.2100219726562]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhjl0XnsaGOibc5JsBYY6W1DkJGjlwrsT0D5AKISEJyumFuHibRPQtNkZg/640?wx_fmt=png[/img]

时间转换   

[img=697.739990234375,764.8800048828125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhDelmiaT4bECNfIKO1JQGO8YCHvs9vlZSqHDQfFtXTFhHq1RSDq6KkqA/640?wx_fmt=png[/img]

沿信号   

[img=697.739990234375,570.280029296875]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhzWliaNQicKd0icia0qKRuAZQgZmWJVnRUibM6o9pj3YS3CtqsRREU8LsuUw/640?wx_fmt=png[/img]

沿信号   

[img=697.739990234375,509.6099853515625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhLzUwkMpGuOc1J73TSDRe9wfp7hd4WyVg9keQctfajjiaKDc75ByrNibQ/640?wx_fmt=png[/img]

优先启动设备切换

[img=697.739990234375,208.20001220703125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhHDF1MKcOSfxKWaKNMTG5icicRlCdDjHXTIFrl7dhGic4wPibOg58QNzTmQ/640?wx_fmt=png[/img]

1#设备手、自动控制   

[img=697.739990234375,204.6699981689453]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhvrb7F8xxwMTPMVhTeASQ8xtiahjDoicvYSOBTVMdnpTtjkNjSojbH99A/640?wx_fmt=png[/img]

2#设备手、自动控制

[img=697.739990234375,139.19998168945312]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhjqYQFep2IPWqb1LM7q6C7UaYKhKqia3rgDSr4Z6XQEtNibNTOJpbyia8w/640?wx_fmt=png[/img]

运行时间累加

[img=697.739990234375,252.469970703125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhCibfX1NKPHh43gU1lucDGugzMPMGzaVmIN58c23FI7IpRnVZsj9xCOA/640?wx_fmt=png[/img]

时间清零

[img=697.739990234375,201.79998779296875]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhVjmOOOkqM0pXvquYPUFSRXlX3nxjMSYZ4kger3YYyf6D0T0ASVicAiaw/640?wx_fmt=png[/img]

设备软故障判断   

[img=697.739990234375,401.3399963378906]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhicJNEVWGVkSiaVXo2IevJE3asHueu4Bxj4VCaUldm4lpnL8DqP8ovvMw/640?wx_fmt=png[/img]

设备输出、清零

完整程序:



3、下载测试:   

[img=604.010009765625,832.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhpxnJ1DicT0k5lVyiaE0UzXDCopjxozgwyQ2c95icgPz8gy5RXLs68SVAw/640?wx_fmt=png[/img]

主程序调用   

[img=607.010009765625,838.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhiclcoYAE87BicGW5zYibZaTqVoz14RkiadN8Eka3iagtzGDGjcKUJ7J0abQ/640?wx_fmt=png[/img]

下载测试1   

[img=599.010009765625,829.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOia1QeNxBPSDyoa8Ox5TYrhUNn5wnvajYicy8lhBOxibbbaDFYQjxExp3aNXMpficCA4FMzicUQ0w5rAw/640?wx_fmt=png[/img]

下载测试2

四、视频演示:(两台设备周期循环控制)


video: https://mp.weixin.qq.com/mp/readtemplate?t=pages/video_player_tmpl&action=mpvideo&auto=0&vid=wxv_3383941570865102854
注:程序仅供参考!!!   

(参考文章:S7-200 SMART 基础篇之子程序应用)

(参考文章:S7-1200-1500案例之设备定时周期循环控制)

(参考文章:S7-200 SMART 案例应用之一键启停)

(参考文章:S7-200 SMART 模拟量概述及自建库文件)

(参考文章:S7-200 SMART 案例应用之设备轮询控制(冒泡排序))

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册哦

x
您需要登录后才可以回帖 登录 | 注册哦

本版积分规则