Sign in to follow this  
Followers 0
nowayhi

How to get correct stable average value with fx3u and fx2n-2ad

27 posts in this topic

manual of FX2N-2AD said " when you can't read stable value " you should use this code : But i am realy confuse, while processing time is 2.5ms/ sampling value. That mean it need 50ms for 20 samplings. So in this code of manual they take 20 times for adding analog values But all of this code completing too quickly (us mili second etc....). wheares Module analog fx2n-2ad need 50ms/20 sampling. So This code in this manual has a Wrong guide ? How I can read a realy 20 times (samplings) exactly for stable value ( purpose of all jobs is eliminating voltage pulse noise or ripple in the voltage that make wrong result reading values) .

Share this post


Link to post
Share on other sites
Just increase the "K20" to get a slower but more stable value.

Share this post


Link to post
Share on other sites
oke sir ! but how many timers I should increase ? " manual said the range of 1 to 262144 ". why the higest value is 262144 ; some code in the picture I noted by red rectange maybe mistake ? Assume, Even if I chose the higest is 262144. So how many truth value can i get ? It takes too much time of cpu, should I use a ficker timer 3ms on /3ms off to read analog ; (2.5ms /a sampling of FX2N-2AD ; ~~ 400 sampling/ second). that meant we have ~ 333 samplings/ second T3ms Like this : ----| |-----(reading_analog in chanel 1) T3ms ------| |-------( DINCP counter_sample) T3ms ---------| |--------(DADDP Total_chanel1 Reading_analog Total_chanel1) T3ms -----| |----(DCMP counter_sample k333 M0) M1 ------| |----------(DDIVPP Total_chanel1 K333 stable_value) Tell me your idea please ! thanks

Share this post


Link to post
Share on other sites
Can I correct code example in manual fx2n-2ad like this ? Edited by nowayhi

Share this post


Link to post
Share on other sites
You can do this if you only need to read channel 1. The FX2N-2AD does not have two dedicated channels, instead you change which channel to read depending on the input to the BFM. Further on, the average sampling is a simply ladder program since the FX2N-2AD module does not have a built-in sampler/averager hence you must use external ladder instead. The "K20" value is simply: How many samplings from the module will you buffer up, and then make a SUM over using DCMP. In other words, I would worry too much about the time it takes, but set the "K20" value to a reasonable value depending on your specific application.

Share this post


Link to post
Share on other sites
Thanks for your help, My application does'nt need quick changing following value reading from sensor, I am only need the truth value to eliminate pulse noise that make my system misunderstand the PV (pesent value) >= SV setting value when the pulse noise maybe mix in the signal from senser. I can use the new stable value per every 1 second. So I assume all of this code about need 100uS to complete in 1 scan cycle with k=1 ("k1"). With K=10000 <=> "k10000", the time need 1 second that meant the module FX2n-2AD will has 400 sampling/1s (2.5ms/sampling) to reading to plc. so The average of 400sampling/1second is more stable ? Do you thinks so ? let me see your idea. thanks! Edited by nowayhi

Share this post


Link to post
Share on other sites
what is your input sensor? what type of input is it (voltage or current)? how much does input value change if sensor is at steady state? are you sure you need software filtering at all? averaging data is supposed to be last resort. if you have true problem with noise, you should try to resolve it using other avenues first, before resorting to software. there will always be some fluctuations but are they really significant? averaging does not improve signal, it distorts the reading. you get value that is fluctuating less but the penalty is delayed response. for example is the cable routing, wiring, shielding etc all ok? the code used in manual for input averaging is not executed in one scan, it runs continuously over many scans. D118 is not frequency, it is number of scans that will be averaged. the larger it is the slower and more distorted the signal. your program needs value once a second, so check the scan time and determine number of scans during that time (1sec). that may be a reasonable setting for your filter. you can also just connect capacitor as shown in the manual, it will do averaging for you and it will not need any memory or processing time.

Share this post


Link to post
Share on other sites
My sensor is pressure, suply voltage 24vdc+-5%, range input pressure (0-1000 kgf/cm2) output : (0 ---> 5vdc); I still have conected a DC capacitor (polarised) 0.1uF/50Vdc to chanel 1 of FX2n-2AD. Why did I think there were some noise from signal of sensor ? Yeah, I have used a battery and variable Resitor (to make a voltage 0 -->5vdc without noise ) oke because I use A battery. Then I replaced the sensor signal by this battery and the system work well. Should I need a inductor coil (L) to conect series signal wire of sensor ? Edited by nowayhi

Share this post


Link to post
Share on other sites
Any reason for using polarized capacitor of 0.1uF/50V? Ceramic cap is not polarized, costs less and most importantly it is better in every way. Should you use an inductor? Are you thinking of making an LC filter? I would not bother. Q: is the cable routing, wiring, shielding etc all ok? A: Q: what is your input sensor? what type of input is it (voltage or current)? A: My sensor is pressure, supply voltage 24vdc+-5%, range input pressure (0-1000 kgf/cm2) output : (0 ---> 5vdc) Q: are you sure you need software filtering at all? A: Yeah, I have used a battery and variable Resistor... I replaced the sensor signal by this battery and the system work well. Q: is that steady state or you also tested response? A: Q: how much input value fluctuates if sensor is at steady state? (numbers...) A: Q: there will always be some fluctuations but are they really significant? A:

Share this post


Link to post
Share on other sites
can you post your program?

Share this post


Link to post
Share on other sites
Q: Any reason for using polarized capacitor of 0.1uF/50V? A : Yeah, It's my misunderstanding about manual, Manual of FX2N-2AD not said you must use ceramic cap, It's just said use a DC capacitor 0.1uf/ 25 vdc so I chose 0.1uF/50vdc polarized capacitor to sooth signal from sensor/ Q: Should you use an inductor? Are you thinking of making an LC filter? I would not bother. A: As you known, the switching power have a special circuit that called filter input (expample a switching power input 220vac/ out put 24vdc /2a). It has a input filter circuit the function of one is eleminate noise from 220vac input, I have a switching power which burn power mosfets but the filter circuit was still good, So I think why I am not use this filter for signal of my sensor. Q: is that steady state or you also tested response? A: yeah, I am not sure when the pulse voltage noise appear. Q: there will always be some fluctuations but are they really significant? A:yeah, I think sometime there is a noise appear, that explain why sometime the system work well sometime it'bad. I don't think the my code wrong beacause it's always work well with battery when I replaced sensor signal by battery. => the problem here how I get the better value, And maby get more sampling is a good solution. This is the part of my programe : When (PV (peresent value of pressure >= SV ( setting value of pressure on Hmi)) the M20 bit (oke pressure) will on, M20 bit is ON ( that's the enough of condition to trickger a Piston (Y7 ouput) in my code. But if there is a pulse noise appearing that made the result was PV >= SV too. M20 bit will be still On too , so that... the system worked wrong. Edited by nowayhi

Share this post


Link to post
Share on other sites
Could you try to just use the program example from the manual before making your own logic to see if that helps? I see you've created additional logic around the reading program which really shoudn't be nescessary. Try the exmple first (which is the simplest program) and then post back your results.

Share this post


Link to post
Share on other sites
Another quicker option may be to upgrade to a newer analog unit. The FX2N-4AD has built-in averaging function.

Share this post


Link to post
Share on other sites
have a good day ! after all ! when I toke more samplings about 100 then the system worked well. Thanks for everybody help me. Sir but I still have a little problem with my project. It's speed of communication. I used NB Hmi Omron - Comport 2 (NB7W) to connect FX3U (FX232 port). But they were communication to each other oke when I set baudrate is 9600. When I want higher speed like 19200, I tried to setup a lot time following manual "NB -series communication guide - Omron" but It was fail, the error "not plc connection pop up". I did'nt find the cause of fail for it even if I set up like manual guide. This is the link of "NB series communication guide" https://www.google.com.vn/#q=nb+series+host+connection+manual+v108 Edited by nowayhi

Share this post


Link to post
Share on other sites
After setting 19200 in the PLC, did you power cycle the PLC? When changing comm parameters on cards you need to do a power cycle for them to be activated.

Share this post


Link to post
Share on other sites
"power cycle" ? what did you mean ? sir!

Share this post


Link to post
Share on other sites
Turn it off and power it back up.

Share this post


Link to post
Share on other sites
1. Power off the PLC (remove the supply voltage lines so that all LEDs go dark) 2. Power on the PLC (apply the supply voltage lines again so that LEDs are normal) EDIT: Just saw Crossbow's post. Edited by kaare_t

Share this post


Link to post
Share on other sites
I'll do it,and I will post result as soon as posible. thanks a lost for all guy help me! Sir how can I save the current value of counter C251 (high speed counter) before the bad case as if the power off, and when the power on again the value of C251 counter don't lost. Edited by nowayhi

Share this post


Link to post
Share on other sites
What does your Latch setting indicate under "Device" in PLC Parameter? Screenshot?

Share this post


Link to post
Share on other sites
is this it, sir ? C200 to C255 that mean C251 will be latched if power off ?

Share this post


Link to post
Share on other sites
Yes, that indicates that C251 should be battery backed. Do you have any program initializing this counter that are fired during startup or similar? Could you post all code regarding this counter??

Share this post


Link to post
Share on other sites
Try to set one FALSE instruction in front of the RST instruction as a test. Then power off/on the PLC and see if the value is cleared. I would guess that some of your logic resets the value during startup (initializing something maybe?), and not the PLC itself. Just put a FALSE instruction right in front of the RST and you'll see what the PLC does.

Share this post


Link to post
Share on other sites
To eliminate the electrical noise just put 0.47 microFarad Capacitor, it will make the input stable. If not use the twisted shielded cable. If the electrical noise is excessive then connect the ground terminal of the FG with the ground terminal of the analogue unit as explained in the manual.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0