The burning of diesel fuel creates exhaust gases, and while there can be slight differences from engine to engine, those gases are created in known quantities. By knowing the rate at which a generator or other engine consumes fuel, a very accurate calculation of carbon dioxide (CO2) emissions can be obtained.
Know the brand, model number and specifications of the generator whose performance you want to measure.
Know how much fuel your generator consumes. The specification sheet should tell you how much fuel it burns per hour. You can also measure the fuel burn rate on your own. If you don't have a precise direct measuring device, you can measure the fuel burn rate by filling your generator tank up to the top. Then run the generator for 1 hour with a normal electrical load. At the end of the hour, refill the tank and measure how much fuel you needed to add to reach the top. That number is a very close approximation of your generator's hourly fuel consumption.
Now it's time to run the calculation.
Every gallon of diesel fuel contains 2,778 grams of pure carbon. Every gram of atomic carbon, when oxidized with oxygen, forms 3.666 grams of carbon dioxide. (This is another way of saying that each molecule of CO2 weighs 3.66 times more than an atom of carbon alone.)
In an average liquid hydrocarbon-burning engine, it can be assumed that about 99 percent of the fuel will oxidize. (It is assumed that somewhat less than 1 percent will fail to fully oxidize, and will be emitted as particulates or unburned hydrocarbons instead of CO2).
Therefore, we can multiply the amount of carbon per gallon of diesel by the ratio of carbon weight to CO2 weight by 99 percent.
2,778 g x 3.66 x 0.99 = 10,084 g.
Each gallon of diesel fuel produces, on average, 10,084 g of CO2, or about 22.2 lb.
So if your diesel generator uses, for example, 15 gallons of diesel fuel per hour, it'll be producing:
15 gallons/hour x 22.2 lb./gallon = 333 lb.
Just insert the fuel burn rate for your diesel generator, and you'll get the amount of CO2 that it produces.