I am using Step7 with a 313C.
I am in testing phase.
I need to read an oil level and calculate the drop in oil level per hour and display a running average.
I believe I have a block written that will do this, but I would not mind ideas on this.
The next and biggest issue is the testing.
I am using the simulator and I have a real 313C.
I have tried to write a small block to simulate an oil level dropping .
What I did:
I use the analog in and move it to a memory location every X seconds/minutes. Then set a bit and use that to allow the next cycle to write the new lower level data to a different memory location.
I do this several times, each pass allows the next to write into a new location.
After 4 samples spaced X minutes apart, I subtract each from the next and do an average.
This gives me the average consumption of oil over X period of time.
I think I did this OK.
Now the part that seems so easy but is not working due to scan time and my inexperience with Step7.
I want MD2002 to decriment X every Y seconds to simulate the oil level dropping in a tank over time.
Simple right?
I think so.
Then I would monitor this changing MD2002 with my other code and manipulate it around to see how it responds.
I started by just moving the value with the simulator. BUt I can't move the slide or enter the numbers in a steady timed fashion.
Plus I just think should be easy.
Maybe I am having a slow brain day / week.............
Any Ideas?
The worst part is not being able to subtract a NumberX from NumberY and put the result back in NumberX. This is down in some languages. If I could get that to work every X seconds then it would work.
Example: Every 10 seconds subtract 25 from MD2002 and put the answer in MD2002. If MD2002 is less than 100 move 27648 into Md2002. Repeat.
So the result would be a steady incrimental step down from 27648 to 100. Then reset MD2002 to 27648 and repeat.
I am in testing phase.
I need to read an oil level and calculate the drop in oil level per hour and display a running average.
I believe I have a block written that will do this, but I would not mind ideas on this.
The next and biggest issue is the testing.
I am using the simulator and I have a real 313C.
I have tried to write a small block to simulate an oil level dropping .
What I did:
I use the analog in and move it to a memory location every X seconds/minutes. Then set a bit and use that to allow the next cycle to write the new lower level data to a different memory location.
I do this several times, each pass allows the next to write into a new location.
After 4 samples spaced X minutes apart, I subtract each from the next and do an average.
This gives me the average consumption of oil over X period of time.
I think I did this OK.
Now the part that seems so easy but is not working due to scan time and my inexperience with Step7.
I want MD2002 to decriment X every Y seconds to simulate the oil level dropping in a tank over time.
Simple right?
I think so.
Then I would monitor this changing MD2002 with my other code and manipulate it around to see how it responds.
I started by just moving the value with the simulator. BUt I can't move the slide or enter the numbers in a steady timed fashion.
Plus I just think should be easy.
Maybe I am having a slow brain day / week.............
Any Ideas?
The worst part is not being able to subtract a NumberX from NumberY and put the result back in NumberX. This is down in some languages. If I could get that to work every X seconds then it would work.
Example: Every 10 seconds subtract 25 from MD2002 and put the answer in MD2002. If MD2002 is less than 100 move 27648 into Md2002. Repeat.
So the result would be a steady incrimental step down from 27648 to 100. Then reset MD2002 to 27648 and repeat.