DEMAND Project: An algorithm for the assessment of the prosumers' flexibility