MarisK Posted January 17, 2012 Report Posted January 17, 2012 Hello! Please help! I need to measure movement time. I have S7-CPU315-2DP with digital input module SM321. For detection of movement I have two photo sensors. So the problem is that I didn't know what STL instruction I must use for determine the movement time from first to second photo sensors. It seems that the traditional S5 timer instruction is not usable in this case. The problem is simple, but I dont now how to resolve them. Is anyone can help me? Maybe with some program example? Thanks in advance! Maris Quote
Joe E. Posted January 17, 2012 Report Posted January 17, 2012 Just brainstorming a bit here. What if you set up an S5 timer with a preset much longer than any elapsed time you would expect to see? You could then start the timer when the part passes the first prox and grab the current remaining time when the part passes the second prox. Then do some math with the remaining time and the preset to determine the elapsed time. Quote
Shiner Posted January 17, 2012 Report Posted January 17, 2012 Yes, I have seen an app where the timer was set to the max value. Input 1 turned on the timer. When input two was triggered, the accumulated value of the timer was captured using a mov instruction. The timer was reset by Input #1, so actually on the trailing edge of input 1 the timer would begin to count. The timer would just run till max if no parts tripped the sensor, but every time a part went by, leading edge and true would reset the timer, and trailing edge it would start and run till next trip or complete. It seemed fairly simple. If neccesary, with a little manipulation you could start the timer on leading edge using a one shot rising for the timer reset. Quote
muotioj Posted January 17, 2012 Report Posted January 17, 2012 How long can it take at maximum? Quote
ianbuckley Posted January 17, 2012 Report Posted January 17, 2012 What is the possible range that needs to be measured and to what resolution are you trying to measure? Is it 5-10 seconds to the nearest 0.1 second? Or is it more like 20-30 milliseconds to the nearest 5ms? The methods you can use vary by the requirements... Quote
MarisK Posted January 17, 2012 Author Report Posted January 17, 2012 Measuring range is about 1-5 seconds. Resolution is 10 ms (for S7-300). I found that: https://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=29598009&load=treecontent?=en&siteid=cseus&aktprim=0&objaction=csview&extranet=standard&viewreg=WW But the program example is for Step7 v5.5m. I use Step7 v5.4 so I can't open this file. Quote
MarisK Posted January 18, 2012 Author Report Posted January 18, 2012 It will be very helpful, if You write down your idea in STL format. It is first time when I working with timers. The parts will not trip regulary. This will be an experimental device for testing wear (sliding time) of random parts. Thanks in advance, Maris Quote
MarisK Posted January 18, 2012 Author Report Posted January 18, 2012 As I understand, then the program will be like this (see attach.): Where: I4.1 - first sensor I4.2 - second sensor I4.3 - reset button And I need to just calculate triping time? prog.bmp Quote
muotioj Posted January 18, 2012 Report Posted January 18, 2012 Do you need the time to be from positive edge of first sensor to negative edge of second sensor or in some other fashion? Quote
MarisK Posted January 18, 2012 Author Report Posted January 18, 2012 I need the time from positive edge of first sensor to positive edge of second sensor (time from point A to point B). Quote
muotioj Posted January 19, 2012 Report Posted January 19, 2012 Example, accuracy is ~time of one cycle. Quote
JesperMP Posted February 4, 2012 Report Posted February 4, 2012 Forget the S5 timers. Use the IEC timers in stead. It uses the time in TIME format, which increments in milliseconds. In order to for example add or subtract TIME values, you will hit a small problem because the mathematical functions expect the type to be DINTs so the typechecking will fail. The simple solution is to use STL, since there is no typechecking in STL. Just a small sample : L "my_IEC_timer".ET // load the expired time as TIME value. T "some_DINT_address" // transfer to a Merker or Datablock doubleword with DINT type. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.