Method for controlling at least a part of a pump station comprising a number of speed controlled pumps, the method being arranged to minimize a specific energy consumption E spec of said at least a part of a pump station, wherein an individual pump is operated to have a plurality of on/off cycles during an operating period (t1, t2, t3) having a predetermined length and the speed of the pump (V1, V2, V3) is constant and is the same each time the pump is active during one and the same operating period (t1, t2, t3), wherein the method comprises a sub method (Find V3) that comprises the steps of: * obtaining input data in the form of a set of parameters associated with a fictitious or elapsed first operating period t1 and a fictitious or elapsed second operating period t2, * determining, based on said set of parameters, a mutual relative relationship between, on the one hand, a first value A1 of a quantity that is equivalent to a first pump speed V1 and that is derived based on said set of parameters, the first pump speed V1 being the speed of the pump when it is active during said first operating period t1, and a second value A2 of said quantity that is equivalent to a second pump speed V2 and that is derived from said set of parameters, the second pump speed V2 being the speed of the pump when it is active during said second operating period t2, and between, on the other hand, a first specific energy consumption E spec 1 that is derived from said set of parameters and from the energy consumed by the pump during said first operating period t1, and a second specific energy consumption E spec 2 that is derived from said set of parameters and from the energy consumed by the pump during said second operating period t2, * determining, based on said determined mutual relative relationships and on parameters B3, B4, B5, and B6 of said quantity, output data in the form of a third value A3 of said quantity that is equivalent to a third pump speed V3 of a third operating period t3, wherein A3 is set equal to A2-B3 if the conditions A2<A1 and E spec 2<E spec 1 are satisfied, A3 is set equal to A2+B4 if the conditions A2>A1 and E spec 2<E spec 1 are satisfied, A3 is set equal to A2+B5 if the conditions A2<A1 and E spec 2>E spec 1 are satisfied, and A3 is set equal to A2-B6 if the conditions A2>A1 and E spec 2>E spec 1 are satisfied. * obtaining input data in the form of a set of parameters associated with a fictitious or elapsed first operating period t1 and a fictitious or elapsed second operating period t2, * determining, based on said set of parameters, a mutual relative relationship between, on the one hand, a first value A1 of a quantity that is equivalent to a first pump speed V1 and that is derived based on said set of parameters, the first pump speed V1 being the speed of the pump when it is active during said first operating period t1, and a second value A2 of said quantity that is equivalent to a second pump speed V2 and that is derived from said set of parameters, the second pump speed V2 being the speed of the pump when it is active during said second operating period t2, and between, on the other hand, a first specific energy consumption E spec 1 that is derived from said set of parameters and from the energy consumed by the pump during said first operating period t1, and a second specific energy consumption E spec 2 that is derived from said set of parameters and from the energy consumed by the pump during said second operating period t2, * determining, based on said determined mutual relative relationships and on parameters B3, B4, B5, and B6 of said quantity, output data in the form of a third value A3 of said quantity that is equivalent to a third pump speed V3 of a third operating period t3, wherein A3 is set equal to A2-B3 if the conditions A2<A1 and E spec 2<E spec 1 are satisfied, A3 is set equal to A2+B4 if the conditions A2>A1 and E spec 2<E spec 1 are satisfied, A3 is set equal to A2+B5 if the conditions A2<A1 and E spec 2>E spec 1 are satisfied, and A3 is set equal to A2-B6 if the conditions A2>A1 and E spec 2>E spec 1 are satisfied.