NOVELTY - The method comprises performing the composting process with biomass, determining the required amount of energy generation in real time, and controlling the composting process so that the required amount of energy is generated. The biomass comprises humid wood shreds. The determination of the required amount of energy generation involves the use of energy consumption expectations by the user and the use of weather forecasts. The control of the composting process involves manipulation of the composting process inputs comprising the oxygen content of the incoming air flow.    USE - The method is useful for generating heat energy from an aerobic composting process for heating the buildings, schools and offices.    ADVANTAGE - The method enables efficient operation of the aerobic composting process without losses due to transportation of energy, conversion of energy and/or storage of energy thus capable of effectively and rapidly generating the desired amount of energy without emission of nitrogen-dioxide and/or nitrous oxide.    DETAILED DESCRIPTION - The method comprises performing the composting process with biomass, determining the required amount of energy generation in real time, and controlling the composting process so that the required amount of energy is generated. The biomass comprises humid wood shreds. The determination of the required amount of energy generation involves the use of energy consumption expectations by the user and the use of weather forecasts. The control of the composting process involves manipulation of the composting process inputs comprising the oxygen content of the incoming air flow to generate the required amount of energy. The incoming air flow for the composting process is controlled by a unit for enabling pulse-wise control of the input of oxygen to the composting process. The generated energy is partly stored in the biomass of the composting process. The biomass is oxidated for more than 70 wt.% of the original biomass. INDEPENDENT CLAIMS are included for:    (1) a system for generating energy from an aerobic composting process; and    (2) a building provided with the energy generation system.    DESCRIPTION OF DRAWING(S) - The diagram shows a schematic view of a system for generating energy from an aerobic composting process.    Heat source (8)    Pipelines (10, 12)    Composting reactor (14)    Blower (16)    Biomass input (18)    Biomass source. (20)