A portion of solid biomass is daily crushed and mixed with liquid (e.g., manure, post-fermentation liquid) and pumped into fermentation tanks. Fermentation occurs in these tanks, during which biogas is generated and collected under a pressurized membrane maintaining a specific pressure. The biomass remains in the fermenter for approximately 30-60 days (retention time), depending on the type of biomass and the fermentation method. Biogas is purified and subjected to combustion in a cogeneration system, where it powers an engine to generate electrical energy. Heat from the process is recovered. The generated electrical energy is sold, and the heat can be used to heat fermentation tanks (25-50% of produced heat) or for other purposes. The post-fermentation liquid, collected daily, can be reused by mixing it with biomass or used as a nutrient-rich natural fertilizer.