Siemens S7-200 Running Total Help

karnoge

Member
Join Date
Apr 2010
Location
PA
Posts
13
Hi all,

I'm new to the Siemens world and need help with keeping a running total of a value and displaying that on an HMI. Here's what I have:

- Simatic S7-200 PLC using Step 7 Micro/WIN
- Simatic KTP600 HMI using WinCC flexible

I have an encoder that measures linear feet. This value is displayed on my HMI as Current Total Feet. Current Total Feet can be reset at any time. I want to create another tag called Daily Feet that will accumulate the linear footage from the entire day based on Current Total Feet. I want the Daily Feet register to have a reset of its own too. The reset part isn't a problem for me, as I can just move a zero into my register when a button is pressed.

Are there any instructions that will help to do this running total or is there another method?

Thanks,

Ray
 
I don't have much experience with the S7-200, but there are a few questions that would probably help with this problem on any platform.

1) How are you reading the value of the encoder? How many feet is each encoder pulse?

2) what is the smallest value your system will have to consider? This is probably the number of feet per pulse.

3) What is the biggest value your daily value could have to store?

4) Will you only be dealing with whole numbers, or will you need floating points?

Float/real numbers can get huge, but they have a limit where the number is so big where the amount you add consistently is so negligible that it actually doesn't get included in the sum. Integers are lossless (except for decimals, obviously), but they can overflow if you get too large.
 
Mmk42,

1) How are you reading the value of the encoder? How many feet is each encoder pulse? the encoder is connected to the PLC via a 4-20mA signal. Feet/pulse = 0.015

2) what is the smallest value your system will have to consider? This is probably the number of feet per pulse. Other than zero, it would be feet/pulse

3) What is the biggest value your daily value could have to store? The biggest value would be over 100000, but small enough to fit into a dword register

4) Will you only be dealing with whole numbers, or will you need floating points? Only using whole numbers.
 
If you already have a total from the encoder represented by Current Total Feet, you could take the difference in that value between last scan and this scan, and then add that to your daily counter. You would have to take resets of the Current Total into account, which might affect how you program it and where the counter needs to be in your code.
 
Thanks. I had to do a few different moves, and math to get the final result i wanted. thanks for the feedback.
 
The way i usually do it is by triggering 2 separate counting function trigered by the same event. I preffer to use ''ADD'' real instead of counter. On a pulse rising edge you can add the exact amount of distance for each pulse.
1 real would be for total and the other for the dayly. At the end of the day when the time data reach it, you move a 0 value on the register and i usually move that value to another register before clearing it to keep a memory of the last day count.
Dont forget to make a comparator to clear the total count before it could reach the data format limit.
 

Similar Topics

commentaire communiqué siemens s7-1200 avec vfd delta ? (cablage et sur tia portal )
Replies
0
Views
80
Hi, I have a 1214 on ip 192.168.0.100. This is connected to other modules through a switch on same network. I need to connect this to a company...
Replies
1
Views
140
Hi Experts, I would like to make firmware upgrade from v3.0 to v4.5 (S7-1200 CPU 1215C). Can I do it from v3.0 to v4.5? Do I need to take some...
Replies
6
Views
205
Hi Guys, I am trying to establish communication over profinet between Siemens S7-1200 PLC as IO device and codesys plc as IO controller. But I am...
Replies
43
Views
2,528
Which signals do I have to use to get data from camera. For example camera detects a defect and sends signal to controller. Power cable: CCB-PWRIO-05
Replies
1
Views
176
Back
Top Bottom