Defining priority (X number of vents) S7-1200

NoName

Member
Join Date
Sep 2003
Location
Domžale
Posts
273
Hello all.
I am working on a project where there are 7 vents which have a cooling function with a S7-1200 station and a KTP Basic panel (1st.gen)

The vents turn on one after another based on the temperature in the sistem.
All the vents have the calculation of working hours. The client wishes that every 2 weeks the priority of the pumps changes so that the pump with the lowest operating hours starts first, the pump with the second lowest working hours starts second and so on to the last pump that has the highest working hours.

So far I have made a logic for 3 vents that can define the vent with the highest, lowest and the mid operating hours. I did this with the min and max functions in the PLC.

I can't seem to figure out a good way to define the priority of Xnumber of vents, or when the number of vents is bigger than 3. Has anyone ever had to make a similar logic and can point me in the right direction.

If anyone would like I can share the code that I have so far, but I would need to write coments in English so that you will easily understand my program.

Best regards
 
Without any pointers and jump commands this can do trick, but is long to write
You can also use this to search minimum hours, on that case make comparing to temp:=99999 and change every comparing to search lower values.
Yo can also use max and min functions. Key is to remove max and min values from comparing group and after that search max and minumum values again


pump_runtime_temp:=0

Pump1_runtime_temp:=Pump1_runtime
Pump2_runtime_temp:=Pump2_runtime
Pump3_runtime_temp:=Pump3_runtime
Pump4_runtime_temp:=Pump4_runtime
Pump5_runtime_temp:=Pump5_runtime
Pump6_runtime_temp:=Pump6_runtime
Pump7_runtime_temp:=Pump7_runtime


//Max runtime
if pump1_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=1; End_if;
if pump2_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=2; End_if;
if pump3_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=3; End_if;
if pump4_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=4; End_if;
if pump5_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=5; End_if;
if pump6_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=6; End_if;
if pump7_runtime_temp>=pump_runtime_temp then max_runtime_pump1:=7; End_if;


//remove max runtime out from comparing

if max_runtime_pump1:=1 then pump1_runtime_temp:=-1; END_if;
if max_runtime_pump2:=2 then pump2_runtime_temp:=-1; END_if;
if max_runtime_pump3:=3 then pump3_runtime_temp:=-1; END_if;
if max_runtime_pump4:=4 then pump4_runtime_temp:=-1; END_if;
if max_runtime_pump5:=5 then pump5_runtime_temp:=-1; END_if;
if max_runtime_pump6:=6 then pump6_runtime_temp:=-1; END_if;
if max_runtime_pump7:=7 then pump7_runtime_temp:=-1; END_if;



//2nd runtime
if pump1_runtime_temp>=pump_runtime_temp then runtime_pump2:=1; end_if;
if pump2_runtime_temp>=pump_runtime_temp then runtime_pump2:=2; end_if;
if pump3_runtime_temp>=pump_runtime_temp then runtime_pump2:=3; end_if;
if pump4_runtime_temp>=pump_runtime_temp then runtime_pump2:=4; end_if;
if pump5_runtime_temp>=pump_runtime_temp then runtime_pump2:=5; end_if;
if pump6_runtime_temp>=pump_runtime_temp then runtime_pump2:=6; end_if;
if pump7_runtime_temp>=pump_runtime_temp then runtime_pump2:=7; end_if;


//Remove 2nd max runtime out from comparing

if runtime_pump2:=1 then pump1_runtime_temp:=-1; END_if;
if runtime_pump2:=2 then pump2_runtime_temp:=-1; END_if;
if runtime_pump2:=3 then pump3_runtime_temp:=-1; END_if;
if runtime_pump2:=4 then pump4_runtime_temp:=-1; END_if;
if runtime_pump2:=5 then pump5_runtime_temp:=-1; END_if;
if runtime_pump2:=6 then pump6_runtime_temp:=-1; END_if;
if runtime_pump2:=7 then pump7_runtime_temp:=-1; END_if;

//3rd

//4th

//7th
 
Last edited:
Hello all.
The client wishes that every 2 weeks the priority of the pumps changes so that the pump with the lowest operating hours starts first, the pump with the second lowest working hours starts second and so on to the last pump that has the highest working hours.

Best regards

when the first motor will stop?
 
it interesting question but i don't know much on s7-1200,but logic and function may be similar with other brands,

i test on simulator and it's works after try dozen times,

what i understand on the question,

few challenge task you need to settle,

1.) there 7 pumps on site,for example if pump-2 and pump-5 fail/fault,or pump-1.pump-3 and pump-7 fail/fault and so on fail
how to skip the fail pump?

2.) i skip this fail/fault using function MIN, 49 unit function to be use.

but it works on ST as Bubba sytle.
 
As for motor fault, etc. pretty easy to handle. Here's what I'd do.

First, copy the pump run hours into an intermediate array. Any pumps that are currently faulted, etc. just multiply their run hours by an 1,000 or some number that will put them at the end of the list. Then just sort the array from lowest to highest...plenty of sort examples around. Finally, just turn the pumps on as needed from lowest to highest based on the array.
 
it interesting question but i don't know much on s7-1200,but logic and function may be similar with other brands,

i test on simulator and it's works after try dozen times,

what i understand on the question,

few challenge task you need to settle,

1.) there 7 pumps on site,for example if pump-2 and pump-5 fail/fault,or pump-1.pump-3 and pump-7 fail/fault and so on fail
how to skip the fail pump?

2.) i skip this fail/fault using function MIN, 49 unit function to be use.

but it works on ST as Bubba sytle.

You can skip pumps as Robertmee describes. Move -1 or biggest number to pump_runtime_temp variable.

Before any comparing you can move zeros to pump order numbers

Comparing don't take failed pumps to account after that and only working pumps have numbers.

Even bubba can then undestand code.
 

Similar Topics

Non-PLC guys asking me to explain all the interlocks of my system in a document. Problem is for this system its a little complicated (OR...
Replies
16
Views
5,447
Hi Everyone, I have a somewhat silly question. I've primarily programmed with Beckhoff PLCs in the past. In those, we can assign the string TRUE...
Replies
8
Views
2,413
Hi guys, I asked this question on the Codesys website and didn't have much success with it. I'm looking at a way of defining arrays for real...
Replies
8
Views
5,544
hi to everyone, we are using ISaGRAF for programming our PLC. The problem is that we want to change the IO boards of the computer that we use...
Replies
0
Views
1,884
Hi I'm trying to define a string array using Citects SCADA package and I've got an error that I can't shift. I've defined a variable of the...
Replies
10
Views
13,126
Back
Top Bottom