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
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