In the field, we often need to display the cumulative flow of the flow instrument on the upper computer , Of course, if you can use communication, you'd better use communication , Without communication, we need to PLC Write your own program , The following describes how to write a program about traffic accumulation ：
1. newly build FC, The interface is as follows
After defining the interface , Next, write the program
① Instantaneous flow rounding
② The instantaneous flow is taken as the decimal part
③ Fraction of instantaneous flow + The result of the fractional part of the cumulative flow is rounded
④ The fractional part of the accumulated flow is used as an intermediate operation
⑤ Cumulative flow + Integral part of instantaneous flow + Integer part after adding decimals = Cumulative flow
⑥ Initialize assignment
⑥ Call in circular interrupt block FC
So far, the program is partially completed （ notes ： Instantaneous flow unit m³/h, Cumulative flow has no decimal places ）
2. About host computer wincc Configuration and setting of
（ open wincc, New projects , The new drive link is omitted ）
New screen , Connect variables , Here's the picture
After the project runs for a period of time , You will find that there is an error between the cumulative flow on the screen and the cumulative flow on the actual instrument , Now what? ？
At this time, we need to correct the accumulated traffic on the upper computer , So that it will not deviate more and more , But we don't want ordinary operators to see our flow correction buttons and inputs （ Avoid unnecessary misunderstandings , You'll see ~~~）, That is, we need higher permissions to display and enter correction values , In other words, you can't see the flow correction button and input when the upper computer screen is running .
① stay wincc Create the following in the user manager （ Fill in the corresponding password ）
② stay wincc Create a new binary memory variable in variable management
③ Create a new... In the global script C Script , The script is as follows
So far, the basic work has been completed , The next in wincc New buttons and... Are created in the screen IO Domain and connect variables
In the properties of the flow correction button — other — Show -- Dynamic configuration dialog box , And connect the built memory variables “ Variables visible to advanced users ”
Flow correction IO The operation process of the field is the same as that of the button above , I won't go into details here .
thus , All the work is done , If there is something wrong , Welcome criticism , learn from each other ！
Author's brief introduction
Guo Peng ： Industrial control man , Sword finger industrial control QQ Administrators , It's called ： Pay equal attention to handsome and wisdom , Yushu Linfeng wins pan an . since 2013 Since graduation in, mainly engaged in automation programming and on-site debugging , The first three years mainly engaged in mine automation , I have been in the water treatment industry for more than half a year , I hope I can communicate with you more , To learn more , Let the sword finger industrial control take you off ！
This article is from WeChat official account. - Sword finger industrial control （JZGKCHINA） , author ： Guo Peng
The source and reprint of the original text are detailed in the text , If there is any infringement , Please contact the email@example.com Delete .
Original publication time ： 2017-07-13
Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .