Click here to load reader
Upload
foxberry1970
View
84
Download
2
Embed Size (px)
DESCRIPTION
Counters and Accumulators
Citation preview
Application on Control Technology
Programming example in Ladder Logic
Counters and Accumulators
Warranty, liability and support
Counters and Accumulators
V1.0 2006/05/08 2/6
Cop
yrig
ht ©
Sie
men
s A
G 2
006
All
right
s re
serv
ed
2333
0722
_Cou
nter
s_an
d_A
ccum
ulat
ors.
doc
Note The application examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The application examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible in ensuring that the described products are correctly used. These application examples do not relieve you of the responsibility in safely and professionally using, installing, operating and servicing equipment. When using these application examples, you recognize that Siemens cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these application examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications - e.g. Catalogs - then the contents of the other documents have priority.
Warranty, liability and support We do not accept any liability for the information contained in this document.
Any claims against us - based on whatever legal reason - resulting from the use of the examples, information, programs, engineering and performance data etc., described in this application example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). However, claims arising from a breach of a condition which goes to the root of the contract shall be limited to the foreseeable damage which is intrinsic to the contract, unless caused by intent or gross negligence or based on mandatory liability for injury of life, body or health The above provisions does not imply a change in the burden of proof to your detriment.
Copyright© 2006 Siemens A&D. It is not permissible to transfer or copy these application examples or excerpts of them without first having prior authorization from Siemens A&D in writing.
For questions about this document please use the following e-mail address:
mailto:[email protected]
Warranty, liability and support
Counters and Accumulators
V1.0 2006/05/08 3/6
Cop
yrig
ht ©
Sie
men
s A
G 2
006
All
right
s re
serv
ed
2333
0722
_Cou
nter
s_an
d_A
ccum
ulat
ors.
doc
Table of Content
Table of Content ........................................................................................................... 3
Counters and Accumulators........................................................................................ 4
1 Summary of Counter Operation (FC27) Functions:..................................... 4
2 Summary of Accumulator Operation (FC38) Functions:............................. 4
3 Modifying Your Application for Other Counter Types................................. 5
4 Modifying Your Application for Other Comparator Types.......................... 6
5 Modifying Your Application for Other Mathematical Instructions ............. 6
Reference to Automation and Drives Service & Support This entry is from the internet application portal of Automation and Drives Service & Support. The documentation has the entry ID 23330722. Click the link below to directly display the download page of this document.
http://support.automation.siemens.com/WW/view/en/23330722
All entries referenced in this document are designated by their entry ID and addressed via the above path.
Counters and Accumulators
Summary of Counter Operation (FC27) Functions:
Counters and Accumulators
V1.0 2006/05/08 4/6
Cop
yrig
ht ©
Sie
men
s A
G 2
006
All
right
s re
serv
ed
2333
0722
_Cou
nter
s_an
d_A
ccum
ulat
ors.
doc
Counters and Accumulators
Example Objectives:
• Using a counter for a specific task
• Using a comparator to provide counter reset
• Using an accumulator and comparator to achieve the same reset counter function
1 Summary of Counter Operation (FC27) Functions:
1. Network 1: Counter Operation Using an S_CU (Count Up) Box: If the signal state of I0.2 changes from "0" to "1", the value of counter C1 will be incremented by one - unless the value of counter C1 is equal to "999". The counter is reset if there is a "1" at I0.1 and Q0.4; the count value is then set to zero. Q0.5 is "1" if counter C1 is not equal to zero.
2. Network 2: Counter Reset Using an Integer CMP (Compare) GE_I Box: Since the CMP box is always powered as used in this application, IN1 and IN2 are constantly being compared. If MW8 is greater than or equal to the constant value of 20, output Q0.4 is set to “1” for one scan cycle. In the next scan cycle, Q0.4 resets the counter C1 (in Network 1), the MW8 count value goes to "0", and Q0.4 is turned off.
2 Summary of Accumulator Operation (FC38) Functions:
1. Network 1: Accumulator Operation with ADD_I Box: I0.4, along with M2.0(P), pulses on and off to increment the accu-mulator count. The addition of the constant 1 and MW14 is output to MW14. Each time that I0.4 is pulsed on and off, the MW14 value is increased by 1.
Note M2.0 (P) (positive edge instruction): When the signal state at M2.0 changes from "0" to "1", the instruction returns a signal state of "1" at the ADD_I box for one scan cycle. The edge memory bit M2.0 saves the old signal state, acting like a "one-shot."
Counters and Accumulators
Modifying Your Application for Other Counter Types
Counters and Accumulators
V1.0 2006/05/08 5/6
Cop
yrig
ht ©
Sie
men
s A
G 2
006
All
right
s re
serv
ed
2333
0722
_Cou
nter
s_an
d_A
ccum
ulat
ors.
doc
2. Network 2: Compare Accumulator Value to Setpoint Value with a CMP >=I Box: Since the CMP box is always powered as used in this application, IN1 and IN2 are constantly being compared. If MW14 is greater than or equal to the constant value of 20, output Q0.7 is set to “1”.
3. Network 3: MOVE Box to Zero Out the Accumulator Value: When Q0.7 is powered, the contents of IN are moved to MW14. As a result, a "0" value is loaded into MW14, which resets the accumulator (in Network 1) to "0".
3 Modifying Your Application for Other Counter Types
This example uses a Count Up (only) Counter. Three different counters are available for your use. There three variations are as follows:
• Count up/down
• Count up only
• Count down only
The counting range for all three counters is 0 to 999. Count values are entered in the C# data format (for example, C#25). Table 3-1 Behavior of the Five Timer Types
Timer Description
S_CUD Up-Down Counter The counter is incremented by one if the signal state at the input changes from "0" to "1" and the value of the counter is less than "999". The counter is decremented by one if there is a positive edge at the input and the value of the counter is greater than "0".
S_CU Up Counter The counter is incremented by one if the signal state at the input changes from "0" to "1" and the value of the counter is less than "999"
S_CD Down Counter The counter is decremented by one if the signal state at the input changes from "0" to "1" and the value of the counter is greater than zero.
Counters and Accumulators
Modifying Your Application for Other Comparator Types
Counters and Accumulators
V1.0 2006/05/08 6/6
Cop
yrig
ht ©
Sie
men
s A
G 2
006
All
right
s re
serv
ed
2333
0722
_Cou
nter
s_an
d_A
ccum
ulat
ors.
doc
4 Modifying Your Application for Other Comparator Types
This example uses an Integer (Greater than or Equal to) Comparator. Six different comparator functions are available for your use. There six variations are as follows:
== IN1 is equal to IN2 <> IN1 is not equal to IN2 > IN1 is greater than IN2 < IN1 is less than IN2
>= IN1 is greater than or equal to IN2<= IN1 is less than or equal to IN2
Integers, double integers, and real numbers may be compared. IN1 and IN2 are compared according to the type of comparison you choose.
5 Modifying Your Application for Other Mathematical Instructions
This example uses an Addition box. Five different basic mathematics instructions are available for your use. There five variations are as follows:
The mathematical operation that you choose acts upon Input 1 (IN1) and Input 2 (IN2).
Addition Integer, Double Integer, and Real NumbersSubtraction Integer, Double Integer, and Real NumbersMultiplication Integer, Double Integer, and Real NumbersDivision Integer, Double Integer, and Real NumbersAbsolute Value Real Numbers