Analog Input Sampling-Timed Interupt?

speedcat

Member
Join Date
Mar 2009
Location
cairo
Posts
27
Hello
In My Project I Have A Task To Read Sinusoidal Voltage Signal With Peridoic Time 20 msec,in order to read this signal i used a timed interupt with time 201 msec(200 msec=20 cycles which will read the same point in the wave + 1msec to shift to the next point)
by this method i become able to read the complete cycle in 20 points (every point shifted with the other by 1msec).....unfortunately 20 points isnt enough for accurate wave form...so am wondering if i can by any method read signal in resolution of 0.5 msec is it possible(200.5 msec)In Order To Read The Signal In 40 Points,Can The timed interupt set by Fractional msec...i know it's quite impossible...Any Ideas
note:am using s7-200 cpu 222
 
Last edited:
You have two problems to considder: 1) analogue conversion time 2) PLC cycle time.

Have you looked at using a VIPA Speed7 processor? The are S7 compatible and have a regular comms bus for regular I/O but they also have their own high speed bus for fast I/O cards. I believe they do an ultra fast analogue card that might suit your application.

Have a look at www.vipa.de


Nick
 
thanks nick i will consider that...but i think by using interupt i overcomed the problem of plc scan cycle and i think the converion time are in order 200 usec..would it make such an effect? i would also would to know is the conversion time depend on filtering i mean if the conversion time is variable i can set it to be near 0.5 msec and use the interupt with time 200 msec..so i get wut i want..wut do u think?
 
So what are you really trying to do?

You last post was about asin() functions and know you have a question that would normally be asked here
http://groups.google.com/group/comp.dsp/topics

My first thought is that you don't have the right tools for the application but we really don't know what the application is.

If you want to sample a wave form with a period every 20 milliseconds you should be sampling every 2 milliseconds not 201 milliseconds. What you are doing will only work if the PLC and wave form you are sampling stay in synch for 4.04 seconds and that will not happen.

PLC interrupt intervals are just a suggestion. If the PLC needs interrupts off during house keeping or communications then the interrupt will not be exactly 201 milliseconds as you desire.


20 milliseconds/50Hz. Does this have anything to do with sampling power lines?
 
Last edited:
If you want to sample a wave form with a period every 20 milliseconds you should be sampling every 2 milliseconds not 201 milliseconds. What you are doing will only work if the PLC and wave form you are sampling stay in synch for 4.04 seconds and that will not happen.

I Agree with Peter on the sampling times. The supply is unlikely to be "exactly" 50Hz and your timed interupt may not be "exactly" 201mS. These factors would lead to errors in your phase angle calculations.

Nick
 
The 201mS sampling technique described will produce an 'aliased' waveform, an image of a sine wave composed of points from many previous sine waves; the purpose of which I can't imagine.

Data Acquisition (DAQ) techniques focus on avoiding aliased waveforms because the result is only an composite image, not a snapshot of the signal.

Is the purpose of this a student exercise to show that aliasing can display a false image of a waveform?
 
i understand it's aliased image for the wave but it's the best i can do,,,and for sampling every 2 miliseconds that will draw the wave form in only 10 points and for sure it will be in accurate (Do I Misunderstand this point)...i understand my approach is not that accurate bas as u know i have certain equipment and certain task i know may be the task isnot applicable on that equipment but am tryin to reach best results.
and yeah am sampling voltage,current of induction machine suplied by 3 phase for the purpose of calculating the phase shift between the 2 waves,anyway i will try the 2 milisecond suggestion and show u the results
thanks for replies it realy helped
 
Last edited:
i understand it's aliased image for the wave but it's the best i can do
No, it is the best the s7-200 can do. I am sure you can do better with the right tools. You are going to waste time and money trying methods that will not provide good results in the long run.

,,,and for sampling every 2 miliseconds that will draw the wave form in only 10 points and for sure it will be in accurate (Do I Misunderstand this point)
If you use cubic of fifth order interpolation it will be accurate enough for many applications. I know it is accurate enough for most motion control applications. For cubic interpolation you can use cubic splines or simpler method where one interpolates between two points using 4 or 6 points.

I could have this done by now, 30 minutes is all that it would take, but I would be using a much more expensive piece of equipment but I would save on time and get much better results. I can even do the interpolation on the fly.
 
Last edited:
I do not really understand why you are attempting what you are doing (school, work, product for resale, etc), but if you are not scared of programming in "C" I would look at the NetBurner product. Very cost effective, very complete development tools, real time OS based on micro-C OS (you can get a couple of books written by the original developer). We have developed a couple of projects based on their off the shelf hardware. Works well and we have been impressed with the performance, especially after they moved their TCP/IP stack to SRAM on the processor.

www.netburner.com

Good luck,

Darren

Forgot to mention that I would look at the PK70 product since it has some interesting add-in boards.
 
Last edited:
i totally agree with u peter,but am a student in this is my graduation project & thats the equipments i have ,it's noty availabe at this time to get new equipments or use another technology .....but i beleive that engineering is using the available tools to reach the best results ofcourse not any tools but i think plc capable of doin such a task even with less accuracy and am tryin to take the best results from plc & i know it wont be that good .
thanks in advance
 
Oh, that is a different matter. Students have lots of time to waste.

I would still try to make the project reasonable. I know some oscilloscopes do what you are trying to do to be able to read higher frequencies but a S7-200 isn't an oscilloscope with an accurate time base.

If this is a student project then slow down the sine wave you are trying to sample to 5Hz and sample it at 20 ms. Call it 'frequency scaling' so you can do your project without violating the Nyquist sampling theorem.
 
how can i slow it?is there any method do change the frequency of the signal before feeding it to the plc(chip or any equimpent)???
 
Last edited:
Ah, the last piece of the puzzle drops into place. It's a student assignment.

I think you should seriously consider DanW's comment. One goal of the assignment may very well be to determine that this technique will not produce usable results with this equipment. It's not uncommon to be given "impossible" assignments, determining that it is impossible is part of the lesson. I know that I had a couple impossible assignments in college and the instructor was quite aware that they could not be accomplished with the equipment we had to work with.

That being said, you still have to execute the assignment. Just don't expect much better than random results. Determining the sources of error that are responsible for the poor results is important. Understanding why it doesn't work is in many ways more valuable educationally than producing a working system.

Also, as Peter pointed out, go ahead and change the parameters of the assignment to show that the task could be accompished with a slower signal and real-time sampling.

In the real world, you would not be trying to measure the phase shift between voltage and current by sampling both signals and comparing them inside a general purpose industrial control like a PLC. You would use a device designed for that purpose that would connect to the PLC either by a 4-20ma signal or serial communications. The PLC would take actions based on the signal. Google "power factor meter".

Good luck and let us know how it turns out.
 
If this was S7-300 you could use the in-built wait delay SFC to sample one whole cycle at a sample rate of 200 microseconds. (That is the plc will sample,store,wait,sample,store,wait etc. in one OB1 cycle) Anyone know if the S7-200 can do the same ?
 

Similar Topics

I'm having trouble calming down 2 Tempo Sonics. I'm using Studio 5000 CompactLogix my Raw value is jumping around from 8575.0 to 8755.0 at a...
Replies
30
Views
1,136
I cannot add SLC500 analog input tag (I: 8.3) to EZSeries Touch Panel Editor (V 5.3). I used all the listed tag datatype but it all says "Invalid...
Replies
10
Views
257
Hi, I have questions. I have Analog Input that need to put into Ignition Designer. But I don't know how to put?
Replies
1
Views
119
Omron AD081-V1 Analog Input Card Offset & Gain Adjustment Entering Adjustment Mode 1. Set the input card in adjustment mode (Turn ON Dip SW No-1)...
Replies
0
Views
87
Why AMIo800 Analog input module's I/O LED is Lighting up Red? Checked module connections, 4-20ma wires etc but this light is continuously Lighting...
Replies
1
Views
112
Back
Top Bottom