A system including a breathing apparatus and a processor is configured to raise a first positive end-expiratory pressure PEEP level to at least a second PEEP level above said first PEEP level and subsequently lowering said second PEEP level to said first PEEP level and to calculate a lung mechanics equation relating total lung volume above functional residual capacity (FRC) to transpulmonary pressure (PTP) of a lung connected to said breathing apparatus, based on a change in end-expiratory lung volume (DEELV) between said first PEEP level and said second PEEP level. T