- A method of multivariable control for optimizing the operation of a wastewater treatment plant, comprising: gathering from a monitoring and control system a set of optimization priorities established for the operation of the wastewater treatment plant; gathering and virtualizing process data and discharge quality data, electric tariff rate data, meteorological data and instant values of mass flow of the greenhouse gases emitted by the reactor; and optimizing from said process data and discharge quality data, electric tariff rate data, meteorological data and instant values of mass flow of the greenhouse gases at least one of the following operation variables of the wastewater treatment plant: control loop setpoint for effluent ammonium NH 4 + concentration; control loop setpoint for ferric chloride dosage FeCl 3 for physicochemical phosphorus removal at the end of the biological treatment; control loop setpoint for dissolved oxygen concentration of aerobic reactors; control loop setpoint for nitrate NO 3 - concentration in the anoxic reactor or internal recirculation flow rate; control loop setpoint of solids concentration in the mixed liquor suspended solids or solids retention time; hydraulic retention time; flow rate of the blowers; and operating pressure of the blowers; wherein said instant values of mass flow of the greenhouse gases emitted by the reactor are obtained over time as follows: at time instant t, obtaining (1001a, 1001b, 1001c) a first 2D image from a first thermographic camera, a first 2D image from a second thermographic camera and a first 2D image from a third thermographic camera, said first 2D images corresponding to views of the plume of the greenhouse gases emitted by said reactor at time instant t; obtaining a first 3D image of the plume of the emitted greenhouse gases from said first 2D images; at time instant t+1, obtaining (1001a, 1001b, 1001c) a second 2D image from the first thermographic camera, a second 2D image from the second thermographic camera and a second 2D image from the third thermographic camera, said second 2D images corresponding to views of the plume of the greenhouse gases emitted by said reactor at time instant t+1; obtaining a second 3D image of the plume of the emitted greenhouse gases from second 2D images; obtaining differences between said first and second 3D images; obtaining from said differences a mass flow of the greenhouse gases emitted by said reactor at time instant t+1. gathering from a monitoring and control system a set of optimization priorities established for the operation of the wastewater treatment plant; gathering and virtualizing process data and discharge quality data, electric tariff rate data, meteorological data and instant values of mass flow of the greenhouse gases emitted by the reactor; and optimizing from said process data and discharge quality data, electric tariff rate data, meteorological data and instant values of mass flow of the greenhouse gases at least one of the following operation variables of the wastewater treatment plant: control loop setpoint for effluent ammonium NH 4 + concentration; control loop setpoint for ferric chloride dosage FeCl 3 for physicochemical phosphorus removal at the end of the biological treatment; control loop setpoint for dissolved oxygen concentration of aerobic reactors; control loop setpoint for nitrate NO 3 - concentration in the anoxic reactor or internal recirculation flow rate; control loop setpoint of solids concentration in the mixed liquor suspended solids or solids retention time; hydraulic retention time; flow rate of the blowers; and operating pressure of the blowers; at time instant t, obtaining (1001a, 1001b, 1001c) a first 2D image from a first thermographic camera, a first 2D image from a second thermographic camera and a first 2D image from a third thermographic camera, said first 2D images corresponding to views of the plume of the greenhouse gases emitted by said reactor at time instant t; obtaining a first 3D image of the plume of the emitted greenhouse gases from said first 2D images; at time instant t+1, obtaining (1001a, 1001b, 1001c) a second 2D image from the first thermographic camera, a second 2D image from the second thermographic camera and a second 2D image from the third thermographic camera, said second 2D images corresponding to views of the plume of the greenhouse gases emitted by said reactor at time instant t+1; obtaining a second 3D image of the plume of the emitted greenhouse gases from second 2D images; obtaining differences between said first and second 3D images; obtaining from said differences a mass flow of the greenhouse gases emitted by said reactor at time instant t+1.