PLC programming so machine basic

Thread Starter

novaquie

Joined Jul 27, 2015
2
Hi Guys.

I hope you can help me out.

I have laser sensor that measures the distance as you move close or far from a fixed object.

This is an analogue output sensor.

I have several problems with this.

1) I am not sure if I did the wiring in the right way.

2) I am not quite sure how to do the code in ladder so the software can read the analogue input when simulating.
I have read that this is done by scaling the input but sadly most examples are in FBD and the software uses IL and Ladder. I am more proficient with ladder anyways.

I am using and M221 PLC with a analogue expansion module TM3AI2H and the sensor is XUK8TAE2MM12.

Thanks.
 

Attachments

panic mode

Joined Oct 10, 2011
2,715
have not seen this topic but....

1. I hope you did not get the idea of powering it up (unless you have endless supply of sensors or at least get them very cheap). read the datasheet for sensor:
brown = +24VDC
blue = 0VDC
black = digital out
white = analog out
btw. this is common since wire colors are standardized
to test sensor you need to power it and measure output (this can be done even without PLC, to see if sensor is ok)
next step is to identify output type for your analog. according to datasheet XUK8TAE2MM12 has 4..20mA output so you need analog input card with same range. TM3AI2H supports various ranges so again, reading documentation is your friend.

2. no idea what you mean here... either you read signal or simulate it, you cant have both. (unless there is something about Schneider, its been 20 years since I used their product..)
what example do you need? when reading analog signal you need to ensure proper scaling to get meaningful value in units you like.
simple linear scaling can be done using following equation:
Scaled_EU_Out=EU_min + (Raw_Input - Raw_min)*(EU_max - EU_min)/(Raw_max - RAW_min)
where EU is "Engineering Unit" values and "RAW" is 'count' values such as:
EU_min = minimum distance in millimeters
EU_max = maximum distance in millimeters
Raw_input is value PLC is reading from analog input
Raw_Max and Raw_min are range for the raw_input
since this is linear conversion, any two points will do but you get better results the further apart the values are (usually min and max).
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
A month old thread! but I would also expect to use a analogue input module?
I haven't used the Schnieder version but generally there is a digital register and value that can be scaled when the input is read?
Max.
 

Thread Starter

novaquie

Joined Jul 27, 2015
2
Hi guys.

It is old, I have been totally busy, but I managed to fix the issue, however another issue raised.

As we connect the components, we get the analogue values and we can scale them, which is great.

But we have another problem called "jittering", you see the values given literally jump too much too quickly and we cannot get an accurate reading but only assume some values.

I have some examples over the internet, however, nothing that applies to Schneider.

Please let me know if you have an idea on how to proceed.

Thank you.
 

panic mode

Joined Oct 10, 2011
2,715
always make sure that wiring is correct. for analog signals you need to use shielded cables, shield to be tied to GND in one place only (usually cabinet entry) etc. also make SURE that you don't have shared common of analog inputs and anything else - run separate wire so that current draw and switchin of other devices does not introduce fluctuations in potential of your common.

next step is to put some distance between analog inputs and everything else (don't run analog signal cable in same cable tray with utility power cables). if possible use transducers so that small signal to digital, or small signal to big signal occurs closer to sensor. if this is very dirty environment (EMI) then consider current signal instead of voltage. current signals are lower impedance circuits (only hundreds of ohms) and have significantly larger current (4-20mA for example) than that in voltage signals (0-10V) because voltage inputs are high impedance (usually 100kOhm or more). the higher impedance (and smaller current in the circuit), the easier is for external disturbance to affect the signal. you may also intentionally change circuit impedance to increase immunity to noise by adding resistor in parallel with analog input card but - make sure to not exceed current capabilities of analog sensor (most analog 0-10V can safely provide about 1mA current but read the data sheet). so if your sensor happen to say 0.8mA max output current and range is 0-10V, then use Ohms law to compute smallest allowed resistance. of course this has to be at the analog input, not at the sensor. nice thing about using resistor is that it does not distort the signal.

then comes filtering... you can also add capacitor. this will actually work as a low pass filter and smooth your signal but there are issues with this, signal is distorted (which is expected) and this may overload and even damage sensor output so using hardware options requires some thinking. this is why it is easier to recommend to new guys to do averaging in software (well, if your analog input card does not have such feature, this adds overhead to your PLC scan time).

it does not matter what PLC brand you use, you can implement something custom like

output = (x * last_output + present_reading) / (x+1)

you can try different value for X to get results that work for you. (again this is something that can be further optimized too).
 
Top