Conventional weaning (control group). Patients in the control group will receive weaning from mechanical ventilation according to the usual procedure, by reducing level of pressure support ventilation. Then a spontaneous breathing trial will be performed through a T-tube (the same parameters as protocol study will collected) and subsequent extubation of the patient if there is a successful spontaneous breathing trial. The criteria for spontaneous breathing trial failure and for extubation failure are the same than in the study group. In case of extubation failure, non-invasive ventilation will be not considered, but it left to the discretion of the attending physician.