marke Posted October 24, 2021 Report Share Posted October 24, 2021 The Horner OCS units include a flexible inbuilt I/O configuration which is indicated by the last number of the model description. i.e. HE-XC 1Ex where the x indicates the I/O x = 0 : No analog x = 2 : 4 standard Analog Inputs x = 3 : 2 standard Analog Inputs The analog inputs are connected to the tags (memory) %AIx where x is the number of the analog input. %AI1 is analog input number one, %AI2 is analog input number 2 etc. The value read from the analog register is an integer of value 0 for minimum scale and 32000 for maximum scale. A value of approximately -8000 on a 4-20 mA input would indicate 0 mA. HARDWARE To use a standard Analog input on a Horner OCS, it is first essential to configure the input to comply with your requirements. The standard Analog inputs can be configured for 0-10Volt DC, 0-20mA, 4-20mA. - Universal inputs can be set up for alternative measurements such as temperature. These are standard on some models of OCS. To configure the input, you must : Ensure that the jumper on the I/O card is set correctly. By default, the jumper is set of current input and must be moved for a voltage input. - the jumper connects a 100 ohm resistor across the analog input. Configure CScape to read the input correctly. Open Controller | Hardware Configuration | Local I/O on the menu to show: Click on the Config Button associated with the I/O card to open the Analog Input Configuration : Adjust the input channels to suit your requirements. At the bottom of this screen, there is a filter option that is defaulted to 0. If you have major noise issues, the filter setting can be adjusted to slow the input response and mask the noise from the readings. SOFTWARE To read an analog input, you must first declare a variable of type INT at a tag (or memory) location that is correct for that input (i.e. %AI1) As the value is going to lie between 0 and 32000, you will want to scale the input to represent the actual value measured. First, determine if you are going to use an integer or a real to store the scaled value. Integer values do not include fractions so can lead to severe rounding errors unless the "units" are chosen with sufficiently small steps. e.g. a value of 0 to 10 Bar scaled and stored in Bar, will only work in steps of 1 Bar. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Bar which is a very course measurement. If you choose to work in Bar, you can scale your variable to store mB (milliBar) but display it with three decimal points and that way get the required accuracy. Real values do store fractions, but are twice the size (32 bits long instead of 16) but are very slow and heavy on processing resources. If the CPU is very fast (small scan time) and the program is small, then working with reals is an easy option. If the CPU is slow and/or the program is large, the additional time taken to process REAL values could become a problem with a very slow scan time. For small, low cost processors, consider avoiding REAL values for faster operation. There are two scaling blocks built into CScape. - You will find them under the "Advanced" option of the Project tools box. Integer Scaling. Real Scaling. Note to use Real Scaling, you must first convert the raw (measured) value to a type REAL. Structured Text Examples : declare : Pressure_Raw Type INT at memory %AI1 Integer Scaling : Pressure_MB scaled 0 - 10000 Real Scaling : Pressure_Real scaled 0 - 10.0 Mark Empson | administratorSkype Contact = markempson | phone +64 274 363 067LMPForum | Power Factor | L M Photonics Ltd | Empson family | Advanced Motor Control Ltd | Pressure Transducers | Smart Relay | GSM Control | Mark Empson Website | AuCom | Soft Starters Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now