Matching of gas expanders and cogeneration engines for energy recovery