(0)| 4/17/2011 11:15 PM | |
|
Posts: 10 Rating:
|
Hello to all and thank you for your very interesting website AttachmentDOC.zip (163 Downloads) |
| 4/18/2011 2:04 AM | |
|
Joined: 9/27/2006 Last visit: 12/26/2025 Posts: 12474 Rating:
|
Hello iboulay; The code you show scales the analog input value and outputs an engineering unit value that will be within the limits 100 and 1000. First the analog signal is read (as a 16-bit integer);inside the PLC, the numerical valuecorresponding to the analog input (no matter whether it is 4-20 mA, 0-10V, +/- 10V...)willbe between 0 and 27648, if the input is unipolar, or between -27648 and +27648 if the input is bipolar. Look at the attached document, it is extracted from the chapters on analog signal representation from the S7-300 Module Data manual: http://support.automation.siemens.com/WW/view/en/8859629 You will see that once it has passed the ADC in the analog module, the signal will be 0-27648 if it is in the expected (rated) range, more if it is overrange, less if it is underrange. Once the 16-bit integer in converted to a REAL (floating-point type),all further calculations must be done with REAL variables and constants.The converted valueis normalizedover the range 0.0-27648.0 (to locate it on that scale), then multiplied by the output range (1000.0 - 100.0=900.0) and the starting offset (100.0) is added. The resulting scaled value is output to MD10, which has been set as a REAL. So, let's say your initial 16-bit integer is 13824 (50% of the input signal range). Once it is convertwed to a REAL value, it becomes 13824.0. Then it is normalized: 13824.0/27648.0 = 0,5. Then you multiply by the engineering units range: 0.5*900.0 = 450.0 Then the offeset is added: 450.0 + 100,00 = 550.0 In MD10 you will now have the scaled engioneering units, whatever they may be (gpm, cubic meters per hour, rpm...) wwhich are 550,0 which reflects the signal you collected at the input channel of the analog module. Hope this helps, Daniel Chartier |
Last edited by: dchartier at: 4/18/2011 2:04 AM |
|
This contribution was helpful to
|
|
| 4/19/2011 12:54 AM | |
|
Posts: 10 Rating:
|
Oh thank you Mr Daniel this is very clear now, once again thank you very much Best regards |
Follow us on