CLX 1756-L61 high scan time

raul_vaze

Member
Join Date
Feb 2008
Location
mumbai
Posts
87
Hi All ,

I have around 27 units talking to CLX PLC over Modbus . From each unit i am getting temperature and pressure .

Based on the temperature and pressure i need to calculate the density , for which the client has given me a density table of around 6000 points , wherein for a specific temperature and pressure there is a specific density. We have also kept a band for each pressure and temperature reading.

To calculate the density i have used FOR loop . My ladder in ST is as follows

-------------------------------------------------------------------------
For x = 1 to 27 (*X is temp.variable in PLC and 27 is no of instrument *)
For x1 = 0 to 6000 ( x1 is temp variable in PLC and 6000 is counts in table*)
temp_array[x1] = Press_Array[x1]-Current_Press[x]
temp_array1[x1] = Temp_Array[x1]-Current_Temp[x]
if abs(temp_array[x1])< 0.1 and abs(temp_array1[x1])< 0.1 then
Density [x] = Density_Array[x1]
end if
end for
end for
--------------------------------------------------------------------------
Above example works fine but the scan time has increased to around 20 seconds .
All the logic has been kept in the continous task ...
Is there any way by which i can reduce the time
 
A few suggestions right off the bat:

First off, anything in the continuous task will scan a lot slower than something in a periodic or event task. The difference is dramatic enough that some programmers delete the continuous task.

Second, instead of sequencing through the whole array, check the middle first. If you are less than the middle value then check in the first half. If greater than the middle value then check in the second half. This is known as a half interval search. You can speed things up even more if you check the middle of each half, effectively dividing the array in quarters. If your programing skill are up to it you can take this search method even farther, finding the correct result in less than 13 comparisons. More info here.

Third, once you have found the matching result exit the loop. There is no need to keep searching.
 
Last edited:
I don't know what your table looks like but I have to believe that you have 6000 ordered pairs that are really a list of two lists that are likely better expressed as a two-dimensional array. For example, if your list contains either temperatures or pressures at fixed deltas you could index into your arrays at more logical locations.

Also, unless you are trying to maintain a history of your calculations to see if they work, there is no reason to use an array for your intermediate calculations (the temp_array values). You could just use a single tag of the correct data type. It would be recalculated and overwritten every loop cycle.

Keith
 

Similar Topics

After noticing that the L61 is now more expensive than the L71 and the obvious benefits I have been considering making it our new replacement...
Replies
2
Views
2,395
Hi Guys, I'm trying to connect remotely to a CLX-L61 rack on Ethernet using a 1756-ENBT-A On my router I have forwarded ports TCP/UDP 2222 &...
Replies
5
Views
2,510
Hi all, I'd like to ensure that a certain HMI software is indeed connected to one-and-only-this 1756-L61 CPU, i.e. if someone would exchange the...
Replies
9
Views
7,109
I am trying to send some datas from PLC-5 to control logix plc through 1756-DHRIO. When I go online to PLC-5, Message instruction gives error &...
Replies
15
Views
3,372
Can i terminate(put resistor in terminal of channel a)the blue hose of an existing plc5 dh+ network to a new 1756-dhrio in new clx rack without...
Replies
8
Views
2,732
Back
Top Bottom