SNAT602TAC触点是与左侧母线相连的常开触点,某STL触点接通,则对应的状态为动步;
2)与STL触点相连的触点应用LD或LDI指令,只有执行完RET后才返回左侧母线
3)STL触点可直接驱动或通过别的触点驱动Y、M、S、T等元件的线圈;
4)由于PLC只执行活动步对应的电路块,所以使用STL指令时允许双线圈输出(顺控程序在不同的步可多次驱动同一线圈);
5)STL触点驱动的电路块中不能使用MC和MCR指令,但可以用CJ指令;
函数是一定作用的代码块的集合。我们比如可以把计算两个数和写成一个函数,所以函数是具有一定意义的功能代码块,平时我们工作种,习惯性把重复使用到的代码块编写成函数,这样方便阅读和理解,同时也精简了代码量。
函数其实是用作用域,一般函数默认是全局都可以使用,我们也可以限制函数只能在固定的Task或者只能在某个模块里面生效。这个涉及到函数的作用域我会在下一章节和大家一起讨论这个问题。
函数都要有个函数名,函数名和变量名相同规则相同,也就是说是字母和数组的排列组合,当然其中0一个字符必须是字母,我们在命名函数的时候不能太长,也不能太短,我记得以前在学校的时候学校有了老教授,教我们单片机,他写程序命名就喜欢取汉语拼音的手写字母比如下面这个函数“JQRDD”名称就是“机-器-人-断-电”,你会发现看他写的程序,相当费劲,尤其是没有注释的函数简直是灾难,0搞笑的是这老头子,给他的车拍买了个“80C51”的号码。简直没谁了。我建议可以这样命名“Robot_Power_Off”,你也可以不用下划线直接取命名“RobotPowerOff”。好吐槽完那个老头子了。函数的主要有点就是,可以在需要该函数的地方执行该函数任意的次数,如果不能把代码函数话,那我们项目都写在Main函数里面,那将是一个巨大的流水账,正如一句话:用时一时爽,重写火葬场。大家好自为之。




函数的另一个有点就是方便开发测试和维护,比如对某一段函数添加一些功能或者修改之前遗漏的Bug,只要函数的输入输出没有变化逻辑没有错误,以前程序的其他部分调用该代码的部分都不会收到影响。当然你可以在修改后的函数名字后面加上一个“V2”,或者“New”,那问题来了,下次再修改了该怎么命名呢?“V3”或者“New_New”,我以前就见多有同事这么写,后来他也发现不对,直接再函数后面谢谢了“年月日”。我当时看到真的和小哪吒一样,“沙子里进了眼睛”。
当然如果你上面的原则都懒得遵守,为了以后的你依旧能看到从前的你写代码,你可以再一个函数的开头进行备注,写下如下几行:当我们再ABB RAPID 中写下人生0一段机器人代码的时候,大部分人都是从Main函数开始,“Mian” 就是函数函数名,也就是该函数的函数头,后面跟着的就是函数体,我们的函数。
ABB RAPID 如果没有返回的函数,就写 “PROC” 和 “ENDPROC”直接,风格和VB的风格很像。
当让我们可以在函数的头里面添加参数,我们也可以让函数返回结果,“PROC”函数是没有返回结果的函数格式,有返回的函数格式是”FUNC”我会在这一章节的下面和大家分享。有了前面的两个小节的讨论其实可以足够应对我们工作中的大部分情况甚至是99%的情况,但是总有一些情况我们比较棘手,比如我们编写了一个函数,是发送数据给上位机的,以前是通过串口发送,现在客户想要通过网线发送,但是我程序框架都写好了,只要把发送数据的函数单独修改一下就好了,结果到下一个客户要求两个功能都要,还要可以自由切换,这次难道,可能你感觉可以写两套程序,使用需求,但是如果你掌握了下面的编程技巧,你就会发现你的人生从此改变,老板欣赏你,同事尊重你,食堂打饭的阿姨手也不抖了。
下面就是我们的一个比较有意思的编程语法糖,“Swith“关键字,可选参数。
我们依旧用之前的例子,两个数据的相加,现在我们需求改成同样的函数,可以实现相加,同时也能实现计算两个数据的减法,虽然减法是特殊的加法但是在编程的时候我们还是需要告诉机器人该如何进行操作。话不多说直接上代码:
6)在中断程序和子程序内,不能使用STL指令。
作为全球能源管理和自动化领域的数字化转型专家,施耐德电气始终都在关注着中小企业的成长和良性发展,并在2020年开启了“绿色智能制造创赢计划”0一季。
2022年3月29日,施耐德电气在生态圈逐渐强大之时,重磅开启“绿色智能制造创赢计划”0三季。在0一季和0二季实践的基础上,施耐德电气在0三季中给我们带来了更多、更0的全新亮点。工业和信息化部国际经济技术合作中心副主任李毅锴在启动仪式上特别表示:“尽管受复杂多变的国内外环境和疫情影响,中小企业作为支撑经济发展0活跃的主体和创新活动的主力军,为经济社会发展做出了重要贡献,但也面临着诸多挑战。国家高度重视中小企业发展。今年《政府工作报告》从加大企业创新激励力度、坚持纾困和培优两手抓,着力培育‘专精特新’中小企业等方面,出台了若干惠企政策。工业和信息化部作为国家促进中小企业发展工作的主管部门,也在不断加大中小企业纾困帮扶力度,强化0企业培育,引导广大中小企业走‘专精特新’发展道路,促进产业数字化绿色化转型。”
创赢计划的推出,将帮助具有智能制造技术创新潜力的中小企业,突破技术与商业壁垒,让中小企业找到成长壮大的新突破口,快速成长为0的绿色智能制造工程和系统集成解决方案提供商,真正为拥有某一领域技术专长的中小企业和工业应用场景之间搭建“桥梁”,合力打通工业企业数字化转型的“0后一公里”。
借此契机,工控网很高兴与施耐德电气工业自动化业务中国区数字化生态圈进行了深入交流,她为我们分享了她对于“绿色智能制造创赢计划”的深刻理解,前两季创赢计划的复盘感受以及对0三季创赢计划的期望。截至目前,“绿色智能制造创赢计划”已经为二十余家初创型企业提供技术和资源,涌现出了大量创新的工业技术和应用场景。在今年的启动仪式上,参加过2021年创赢计划的悠桦林信息科技(上海)有限公司市场总监胡奇豪更是表示:“我们在培训和POC实践中收获颇丰,更是超预期地开拓了一个新的营销思路和业务赛道。”
单打独斗不是好汉,凝聚众心才是英雄。从前两季创赢计划的报名、落地、场景和合作数据来看,施耐德电气已经将整个生态圈一步步发展壮大,创赢计划的关注度也越来越多。
:“经过对前两季创赢计划的深度复盘,我们在未来还是会继续把信息化、工业化深度融合,践行地更加扎实,寻找对于工业企业用户更有价值的场景,再融合到创新型中小企业或者科技型企业,大家一起打造一系列联创方案。”
1) The STL contact is a normally open contact connected to the left bus. If an STL contact is connected, the corresponding state is moving;
2) The contact connected with STL contact shall apply LD or LDI command, and return to the left bus only after RET is executed
3) STL contacts can directly drive or drive the coils of Y, m, s, t and other elements through other contacts;
4) Since PLC only executes the circuit block corresponding to the active step, double coil output is allowed when STL command is used (the sequence control program can drive the same coil multiple times in different steps);
5) MC and MCR commands cannot be used in circuit blocks driven by STL contacts, but CJ commands can be used;
A function is a collection of functional code blocks. For example, we can write the sum of two numbers into a function, so the function is a functional code block with certain significance. In our work, we habitually write the repeatedly used code block into a function, which is convenient for reading and understanding, and also reduces the amount of code.
The function actually uses the scope. Generally, the function can be used globally by default. We can also restrict the function to be effective only in a fixed task or in a certain module. This involves the scope of functions. I will discuss this issue with you in the next chapter.
All functions should have a function name. The function name and the variable name are the same, and the rules are the same. That is to say, it is the arrangement and combination of letters and arrays. Of course, the first character must be a letter. When we name functions, we can't be too long or too short. I remember that there were old professors in school who taught us SCM, For example, the name of the function "jqrdd" below is "machine - machine - Human - power off". You will find that it is very difficult to read the program he wrote, especially the function without comments. It is a disaster. The most funny thing is that the old man bought a "80C51" number for his car. There's hardly anyone left. I suggest that you can name "robot_power_off" this way, or you can directly name "robot power off" without underlining. OK, I'm finished talking about that old man. The main advantage of the function is that the function can be executed any number of times where it is needed. If the code function can not be written, our project will be written in the main function, which will be a huge daily account. Just like a saying: it is a good time to rewrite the crematorium. Let's take care of ourselves.
Another advantage of the function is that it is convenient for development, testing and maintenance. For example, if you add some functions to a certain section of function or modify the bugs that were missed before, as long as the input and output of the function are not changed and the logic is correct, other parts of the previous program that call the code will not be affected. Of course, you can add "V2" or "new" after the name of the modified function. The question is, how to name it next time you modify it? "V3" or "new_new", I have seen many colleagues write this before. Later, he also found that it was wrong, and directly added "month, year and day" after the function. At that time, I saw that it was really like little Nezha, "the sand went into his eyes.".
Of course, if you are lazy to follow the above principles, in order that you can still see the code you wrote in the past in the future, you can make comments at the beginning of another function and write the following lines: when we write the first robot code in ABB rapid, most people start from the main function, "mian" is the function name, that is, the function header of the function, followed by the function body, Our function.
ABB rapid writes "proc" and "endproc" directly if there is no function returned. The style is very similar to that of VB.
When we can add parameters to the function header, we can also let the function return results. The "proc" function is a function format that does not return results, and the function format that has returned is "func". I will share it with you in this chapter. With the discussion in the previous two sections, we can actually cope with most of the situations in our work, even 99% of the cases. However, there are always some situations that are difficult for us. For example, we wrote a function to send data to the upper computer. In the past, it was sent through the serial port. Now the customer wants to send it through the network cable, but my program framework has been written. Just modify the function to send data separately, As a result, the next customer requires both functions and can switch freely. This time, you may feel that you can write two sets of programs and use them. However, if you master the following programming skills, you will find that your life will change from now on. The boss will appreciate you, the colleagues will respect you, and the aunt in the canteen will not shake her hands.
The following is one of our more interesting programming syntax sugars, "Swiss" keyword and optional parameters.
We still use the previous example to add two data. Now we need to change the same function to realize addition and subtraction of two data. Although subtraction is a special addition, we still need to tell the robot how to operate during programming. Without much to say, go directly to the code:
6) STL instructions cannot be used in interrupt programs and subprograms.
As a digital transformation expert in the field of global energy management and automation, Schneider Electric has always paid attention to the growth and benign development of small and medium-sized enterprises, and launched the first quarter of the "green intelligent manufacturing win plan" in 2020.
On March 29, 2022, Schneider Electric started the third quarter of the "green intelligent manufacturing win plan" with a heavy weight at the time when the ecosystem was becoming stronger. On the basis of the practice in the first and second quarters, Schneider Electric brought us more and better new highlights in the third quarter. Li Yikai, deputy director of the international economic and technological cooperation center of the Ministry of industry and information technology, especially said at the launching ceremony: "although affected by the complex and changeable domestic and international environment and the epidemic situation, small and medium-sized enterprises, as the most active subject supporting economic development and the main force of innovation activities, have made important contributions to economic and social development, they also face many challenges. The state attaches great importance to the development of small and medium-sized enterprises. This year's government work report We have introduced a number of preferential policies for enterprises in terms of increasing incentives for enterprise innovation, adhering to the two pronged approach of poverty relief and cultivating excellent enterprises, and focusing on cultivating "specialized, special and new" small and medium-sized enterprises. As the competent department for promoting the development of small and medium-sized enterprises, the Ministry of industry and information technology is also constantly increasing the efforts to help small and medium-sized enterprises, strengthening the cultivation of high-quality enterprises, guiding the large number of small and medium-sized enterprises to take the development path of "specialization, specialty and innovation", and promoting the digital and green transformation of the industry. "
The launch of the win-win plan will help small and medium-sized enterprises with the potential of intelligent manufacturing technology innovation to break through technical and commercial barriers, enable them to find new breakthroughs for growth, quickly grow into high-quality green intelligent manufacturing engineering and system integration solution providers, and truly build a "bridge" between small and medium-sized enterprises with technical expertise in a certain field and industrial application scenarios, Work together to open up the "last kilometer" of digital transformation of industrial enterprises.
Taking this opportunity, industrial control network was pleased to have an in-depth exchange with Schneider Electric Industrial automation business China digital ecosystem. She shared her deep understanding of the "green intelligent manufacturing win plan", her feelings about the resumption of the win plan in the first two quarters and her expectations for the third quarter. So far, the "green intelligent manufacturing win plan" has provided technology and resources for more than 20 start-ups, and a large number of innovative industrial technologies and application scenarios have emerged. At this year's launch ceremony, Hu Qihao, the marketing director of youhualin information technology (Shanghai) Co., Ltd., who participated in the 2021 win plan, said: "we have gained a lot in training and POC practice, and have more than expected opened up a new marketing idea and business competition."
It is not a hero to fight alone. It is a hero to unite the hearts of the people. According to the registration, landing, scene and cooperation data of the previous two quarters, Schneider Electric has developed the whole ecosystem step by step, and more and more attention has been paid to the win plan.
"After the in-depth review of the win-win plan of the previous two quarters, we will continue to deeply integrate informatization and industrialization in the future, practice more solidly, find more valuable scenarios for industrial enterprise users, and integrate them into innovative small and medium-sized enterprises or technology-based enterprises. We will create a series of joint innovation programs together."