sampling

steve4499

Member
Join Date
Mar 2012
Location
belleville ontario
Posts
6
i want to take my scale input every second and the difference in the scale every second x 60 to display pound per minute coming on to the scale how do i do the logic in the plco_O
 
i want to take my scale input every second and the difference in the scale every second x 60 to display pound per minute coming on to the scale how do i do the logic in the plco_O

Pretty simple.

Move the scale "analog in" reading into a memory register every second. "Move" or whatever instruction your PLC uses.

Define a second memory register.

If the first is greater than the second,
subtract the second from the first, ADD the answer to a third location and then move the first to the second.


If the scale weight is increasing, the first memory register will be greater than the second.


Now there are several issues here to deal with.

The scale weight could go up or down.

The difference in each reading could be positive or negative.

It sounds like you want the total weight change per minute. Maybe you could read the scale once per minute and compare that weight to the previous weight as above, only once per minute. Then the math is simpler. Use the sample period that you want for your answer.

If the material is loaded onto the scale, then do a reading when it settles.

If you describe the process better , the answer will be better.

By the way, it doesn't matter what PLC you are using, the logic is the same, unless you are asking someone to write the actual code or your doing something specific to a particular PLC software, all that hardware detail is unnecessary.

INT1 is Analog scale reading
INT2 is previous scale reading
INT3 is difference from current and previous scale reading
INT4 is running total of difference
INT5 is Units per time


Analog in = INT1 I assume you have some scale function for analog in, scale in goes in INT1.

Sample time = true
If INT1 >INT2
THEN (INT1 -INT2 =INT3) //Now you have the deference in scale reading per sample period.

INT4=INT3+INT4 //SUM of the running total of samples
Move INT1 to INT2 //current becomes previous
Move 0 to INT3 // clear old difference
end if

Every time period (minute or hour or day) move INT4 to INT5 and clear INT4 //ready for new running total

INT5 is your units per time reading.

Reset INT5 when the machine starts or if you like when it stops, to get a new average.


This could be cleaned up some and it is just pseudo code, but you should get the idea.
 
i have an ab micrologix 1100.with analog card im just a basic programmer i just need a simple way to do this the sugar travels through a pipe about 100kg a minute and goes into a bin when it reaches 2000 kg it is dumped into a mixer all i care about is how fast that sugar is coming into the bin
 
maybe I can explain it better than I did before.

i have an ab micrologix 1100.with analog card im just a basic programmer i just need a simple way to do this the sugar travels through a pipe about 100kg a minute and goes into a bin when it reaches 2000 kg it is dumped into a mixer all i care about is how fast that sugar is coming into the bin

Think it through one step at a time.

The "analog in" is always moving and changing while in use. Sugar is flowing over a scale and the weight is changing?

Is this a continuous flow ?

What motivates the sugar? conveyor? airveyor? pump? is it dry or a slurry?

How does the scale read the weight of the sugar? is there a part of a conveyor sitting on a scale?

I have never been a fan of weighing things as they move, but if that's what is needed, we can sort of do it.

How fast is the sugar moving? this will suggest the sample rate.

Process details are usually more important than controls hardware details, unless you want an actual example program written.

So we have sugar moving over a scale and the "analog in" is moving around as the weight changes.

If you take a reading at some moment in time, you get an idea of what is on the scale at that moment.

I would take another reading after that material has moved off the scale. So if the sugar moves at a constant pace, how long is the sugar on the scale?

Imagine squirting food coloring on the sugar in a line across the conveyor as it moves. Now imagine how long that line is on the scale as it passes by.

That would be my sample rate.(I would tie the sample rate to the conveyor speed, but if the conveyor is constant you might skip that part and make the sample rate a constant. Imagine what will happen if the conveyor stops and you keep adding the scale reading to the total.

So every X seconds, take a sample.
Read the analog in and move that number somewhere.
Now do that again.
Now add those two numbers together.

(I would just add the total to to some location and just use one memory location. Like "sample weight" plus "total" equals "total".)

If you stop here you have an ever increasing number equal to the total sugar going by.

Now a separate timer is running to give you a units per time period reading.(I would use a bit from converting the real time clock from double integers to bits, but you can use a timer if you like.)

Alternately , you could add the samples up, like if you take a sample every 10 seconds, then every 6th sample take that reading as Weight per minute and clear the total and start over. That might be easier for you and only uses one timer.

When this second timer is done, move the current total to a new location, that is your units per time period. And then clear the total and the timer in the next rung.

This captures the total in that time frame or window.

Now you begin a new running total.

You can display the units per time period number as "weight of sugar / time".

The first time you run the machine, the total will display a blank number while you build some history, but if your reading the total every minute, no one will notice.

It doesn't get much simpler than that.

1 read the scale at some interval.
2 add reading to previous reading
3 at some time period, or after some number of samples, take the total as the weight per time period
4 clear the total and repeat.
 
Last edited:

Similar Topics

Dear, I need to take water sample for water quality measurement from a buried pipe, the pipe is buried in the sand, so the contractor will have...
Replies
3
Views
1,773
Hello guys, I have S7400 and network inside is Profibus DP and MPI with it is speed 187.5kbs. I am connecting with service lab to record data...
Replies
5
Views
2,268
Hi there, i am looking for a method to sample 600 points on a motor that is running at 800 rpm or sometimes at 1000rpm. Then, i would like to...
Replies
12
Views
3,361
Protocol: Modbus RTU PLC: AB/Rockwell Micro850 as master The PLC is able to read and write holding registers from 20 devices. I want to...
Replies
0
Views
2,974
I am using 15 history data display objects (event trigger) to display 15 different data then I used the backup object in order to save each one of...
Replies
4
Views
1,727
Back
Top Bottom