Inclusion criteria:  Age˃18 years, scheduled for upper abdominal surgery under general anesthesia. Moderate to very severe COPD (GOLD II to IV). ASA functional status II or greater.  Exclusion criteria:  Contraindications to the application of NIV. Sleep apnea syndrome. Facial deformation. Inability to follow the study.