% Notes: The model uses a constant elasticity MC and demand curves for % gasoline and EtOH % Prices are retail prices, assuming same taxes for EtOH and gasoline % The simulation is set up to run all possible LCFS values >= the fuel % index of EtOH % Notation: RI - reference values (2005), S - supply, D - demand, E - % elasticities clear; % Clear memory % Set LCFS standard LCFS = 0.90; % Level of Low-Carbon Fuel Standard (Used for "one-off" calc's % Switch % toggle = 1 (LCFS only), toggle = 2 (LCFS Hist. Base. only), toggle = 3 % (Both) toggle = [3]; % Input Variables % Average Fuel Tax Fuel_Tax = .38466; % $ state weighted average + federal (2005) from Federal Highway Administration % Fuel Properties CFg = [97.28106238]; % Gasoline carbon factor MMTCO2e/Quad (1 Quad = 10^9 MMBtu) GREET 1.7 U.S. CFe = [72.55]; % Ethanol carbon factor MMTCO2e/Quad assumed (UB = 82.41, LB = 62.74, cellulosic = 19.14) BTUPGg = 116090; % BTU/gal. conventional gasoline CA GREET BTUPGe = 76330; % BTU/gal. EtOH CA GREET % Elasticities % Vary these for scenarios Egs = [0.5]; % Price elasticity of gasoline supply Ees = [1]; % Price elasticity of ethanol supply Egged = [-.1]; % Price elasticity of fuel btu demand (short-run) % Gasoline Market Initial Equilibrium % Gasoline is US total market EtOH is U.S. total market PgRI = [2.2660137]; % Baseline/Reference US gasoline price (2005) EIA PggeRI = PgRI; % Initialize gge price to initial (2005) gasoline price GGERI = [1.17E+11]; % Baseline/Reference US gasoline consumption (2005) EIA sale for resale ERI = [3.90E+09*(BTUPGe/BTUPGg)]; % Gallons for RFA converted to GGE GRI = GGERI-ERI; % Initial consumption of gasoline correcting for EtOH contribution % Fuel Carbon Intensities CIe = CFe/((CFg*GRI + CFe*ERI)/GGERI); % Normalized EtOH MW corn, normalized ethanol MMTCO2e/Quad CIg = CFg/((CFg*GRI + CFe*ERI)/GGERI); % Normalized gasoline carbon intensity MMTCO2e/Quad % Create and initialize internal variables AFCI = 0; % Initialize AFCI to 0 Sg = GRI; % Initialize gasoline supply Se = ERI; % Initialize ethanol supply Sgge = GGERI; % Initialize supply of BTU's Pgge_upper = 100; Pgge_lower = 0; % Set range for gge price search Pgge = 50; lambda_upper = 50; lambda_lower = -50; % Set initial range lambda search (will reset below) lambda = 0; count1 = 0; count2 = 0; % Several counter variables i = 1; j = 1000*CIe; j = round(j); % Set lower bound of loop to CI of atl. fuel. %____________________________________________________________________ % Standard LCFS Calculation %____________________________________________________________________ if toggle == 1 | toggle == 3 % while j <= 1000; % Comment this line and the next in order to run multiple LCFS loop % LCFS = j/1000; % Also need to comment out remainder of loop at bottom while count2 < 50; % Search for lambda that causes AFCI to exceed CIe (used to get % upper bound for lambda such that calculated AFCI does not exceed % the FI of the EtOH lambda_test = 1; AFCI_test = 0; while lambda_test <= 500 Sg = GRI*(((Pgge-lambda_test*(CIg-LCFS))/PggeRI)^(Egs)); if Sg < 100 Sg = 0; end Se = ERI*(((Pgge-lambda_test*(CIe-LCFS))/PggeRI)^(Ees)); AFCI_test (1,lambda_test) = (CIg*Sg + CIe*Se)/(Sg + Se); lambda_test = lambda_test + 1; end [C,I] = min(AFCI_test); lambda_upper = I; lambda_lower = -10; lambda = (lambda_upper + lambda_lower)/2; % Now that lambda range defined search for lambda and P such that % AFCI is met and fuel market clears while count1 < 50; % Calculate supply of gasoline and supply of ethanol (constant % elasticity curves) Sg = GRI*(((Pgge-lambda*(CIg-LCFS))/PggeRI)^(Egs)); if Sg < 10 Sg = 0; end Se = ERI*(((Pgge-lambda*(CIe-LCFS))/PggeRI)^(Ees)); % Check for compliance with LCFS standard AFCI = (CIg*Sg + CIe*Se)/(Sg + Se); % Set new bounds for lambda if AFCI > LCFS lambda_lower = lambda; end if AFCI < LCFS lambda_upper = lambda; end count1 = count1 + 1; lambda = (lambda_upper+lambda_lower)/2; end count1 = 0; % Calculate supply of gge's Sgge = Sg + Se; % Market clearing for gge's Dgge = GGERI*((Pgge/PggeRI)^Egged); if Dgge > Sgge Pgge_lower = Pgge; end if Dgge < Sgge Pgge_upper = Pgge; end Pgge = (Pgge_lower+Pgge_upper)/2; count2 = count2 + 1; end count2 = 0; Pgge_upper = 100; Pgge_lower = 0; % Social welfare calculations % Consumer Surplus % Set lower bound for integral (so that integral is finite int_limit = (1/10)*GGERI; % lower limit as a percentage of gge consumption in the unregulated market CS_no_lcfs = PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*GGERI^(1/Egged+1) - PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*int_limit^(1/Egged+1) - (PggeRI*(GGERI-int_limit)); % Consumer surplus without the LCFS CS_lcfs = PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*Dgge^(1/Egged+1) - PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*int_limit^(1/Egged+1) - (Pgge*(Dgge-int_limit));; % Consumer surplus with the LCFS chng_CS = CS_lcfs - CS_no_lcfs - int_limit*(Pgge-PggeRI); %change in consumer surplus as a result of LCFS % Alt CS Integration % Pgge_upper = 50; % CS2_no_lcfs = GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*Pgge_upper^(Egged+1) - GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*PggeRI^(Egged+1); % CS2_lcfs = GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*Pgge_upper^(Egged+1) - GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*Pgge^(Egged+1); % chng_CS2 = CS2_lcfs - CS2_no_lcfs; % Producer Surplus rev_no_lcfs = (PggeRI)*GGERI; % Producer revenue without LCFS rev_lcfs = (Pgge)*Sgge; % Producer revenue with LCFS C_EtOH_no_lcfs = PggeRI*(1/ERI)^(1/Ees)*(1/(1/Ees+1))*ERI^(1/Ees+1); % Total cost of EtOH production without LCFS C_EtOH_lcfs = PggeRI*(1/ERI)^(1/Ees)*(1/(1/Ees+1))*Se^(1/Ees+1); % Total cost of EtOH Production with LCFS C_gas_no_lcfs = PggeRI*(1/GRI)^(1/Egs)*(1/(1/Egs+1))*GRI^(1/Egs+1); % Total cost of gasoline production without LCFS C_gas_lcfs = PggeRI*(1/GRI)^(1/Egs)*(1/(1/Egs+1))*Sg^(1/Egs+1); % Total cost of gasoline production with LCFS PS_no_lcfs = rev_no_lcfs - (C_EtOH_no_lcfs + C_gas_no_lcfs); % Prod. surplus without LCFS PS_lcfs = rev_lcfs - (C_EtOH_lcfs + C_gas_lcfs); % Prod. surplus with LCFS chng_PS = PS_lcfs - PS_no_lcfs; % Change in prod. surplus as a result of LCFS % Individual Fuel PS % Gasoline PS_no_lcfs_G = rev_no_lcfs*(GRI/GGERI)-C_gas_no_lcfs; PS_lcfs_G = rev_lcfs*(Sg/Sgge)-C_gas_lcfs; chng_PS_G = PS_lcfs_G - PS_no_lcfs_G; % Fraction PS change attributed to gasoline % Ethanol PS_no_lcfs_E = rev_no_lcfs*(ERI/GGERI)-C_EtOH_no_lcfs; PS_lcfs_E = rev_lcfs*(Se/Sgge)-C_EtOH_lcfs; chng_PS_E = PS_lcfs_E - PS_no_lcfs_E; % Fraction PS change attributed to gasoline % Tax Revenue TR_no_lcfs = Fuel_Tax*GGERI; TR_lcfs = Fuel_Tax*Sgge; chng_TR = TR_lcfs - TR_no_lcfs; % Change in tax revenue as a result of LCFS % Carbon C_no_lcfs = (GRI*BTUPGg)/(10^15)*CFg + (ERI*BTUPGg)/(10^15)*CFe;% CO2 eq. without LCFS - Result here is MMTCO2e C_lcfs = (Sg*BTUPGg)/(10^15)*CFg + (Se*BTUPGg)/(10^15)*CFe; % CO2 eq. with LCFS - Result here is MMTCO@e Carbon_Cost = (chng_PS + chng_CS)/((C_no_lcfs - C_lcfs)*10^6); % Cost of abatment change in (CS + PS)/abatement Carbon_Energy_LCFS = C_lcfs; % Output to Excel File OUTPUT = [Pgge;Sgge;lambda;Sg;Se;C_lcfs;chng_CS;chng_PS;chng_PS_G;chng_PS_E;chng_TR;CIg;CIe;Carbon_Cost;((CFg*GRI + CFe*ERI)/GGERI);BTUPGg;LCFS]; xlswrite('C:\Documents and Settings\Jon Hughes\Desktop\Research\LCFS\LCFS CT compare\SimulationOutput\SimulationOutput.xls', OUTPUT, 'Output', 'B2'); % Comment from here to bottom in order to do "one-off calc" % Calculations and graphs for contiuously varying sigma (LCFS) standard % carbon_ratio (1,i) = (CFe*Se + CFg*Sg)/(CFg*GRI+CFe*ERI); % Quad-MMBtu conversion drops out % sigma (1,i) = LCFS; % SupplyEtOH (1,i) = Se; % SupplyGas (1,i) = Sg; % PriceGGE (1,i) = Pgge; % DemandGGE (1,i) = Dgge; % SupplyGGE (1,i) = Sgge; % MCGas (1,i) = Pgge-lambda*(CIg-LCFS); % MCEtOH (1,i) = Pgge-lambda*(CIe-LCFS); % afci (1,i) = AFCI; % lcfs (1,i) = LCFS; % compliance = AFCI-LCFS; % L (1,i) = lambda; % ps (1,i) = PS_lcfs; % cs (1,i) = CS_lcfs; % ps_g(1,i) = PS_lcfs_G; % ps_e(1,i) = PS_lcfs_E; % carbon_cost (1,i) = Carbon_Cost; % i = i+1; % j = j+1; % end % % subplot (2,2,1); plot(sigma,carbon_ratio) % title ('Carbon'); % subplot (2,2,2); plotyy(sigma,SupplyGGE,sigma,PriceGGE); % title ('Fuel & Price (green)'); % subplot (2,2,3); plot(sigma,SupplyGas); % hold; % subplot(2,2,3); plot(sigma,SupplyEtOH, 'g'); % title ('Gas & EtOH (green)'); % hold; % subplot (2,2,4); plotyy(sigma,L,sigma,compliance); % title ('Shadow Value'); end %____________________________________________________________________ % Historical Baseline LCFS Calculation %____________________________________________________________________ if toggle == 2 | toggle == 3 % Initialize internal variables AFCI = 0; % Initialize AFCI to 0 Sg = GRI; % Initialize gasoline supply Se = ERI; % Initialize ethanol supply Sgge = GGERI; % Initialize supply of BTU's Pgge_upper = 500; Pgge_lower = 0; % Set range for gge price search Pgge = (Pgge_upper+Pgge_lower)/2; lambda_upper = 500; lambda_lower = -50; % Set initial range lambda search (will reset below) lambda = 0; count1 = 0; count2 = 0; % Several counter variables i = 1; LB_CR = 0.55; j = 1000*LB_CR; j = round(j); % Set lower bound of loop to lower-bound of emissions reduction ratio % while j <= 1000; % Comment this line and the next in order to run multiple LCFS loop % Carbon_Energy_LCFS = ((GRI*BTUPGg)/(10^15)*CFg + (ERI*BTUPGg)/(10^15)*CFe)*(j/1000); % Also need to comment out remainder of loop at bottom while count2 < 50; % Search for lambda that causes gasoline supply to become < 0 % upper bound for lambda such that Sg is positive lambda_test = 1; k = 1; AFCI_test = 0; while k <= 500%200 lambda_test = k/1; Sg = GRI*(((Pgge-lambda_test*CIg)/PggeRI)^(Egs)); if Sg < 10 Sg = 0; end Se = ERI*(((Pgge-lambda_test*CIe)/PggeRI)^(Ees)); Gas_test (1,k) = Sg; %lambda_test = lambda_test + 1; k = k+1; end [C,I] = min(Gas_test); lambda_upper = I/1; lambda_lower = -10; lambda = (lambda_upper + lambda_lower)/2; % Now that lambda range defined search for lambda and P such that % carbon hist-baseline LCFS = carbon under energy-based LCFS while count1 < 50; % Calculate supply of gasoline and supply of ethanol (constant % elasticity curves) Sg = GRI*(((Pgge-lambda*CIg)/PggeRI)^(Egs)); if Sg < 10 Sg = 0; end Se = ERI*(((Pgge-lambda*CIe)/PggeRI)^(Ees)); % Check carbon emissions Carbon_Hist_LCFS = (Sg*BTUPGg)/(10^15)*CFg + (Se*BTUPGg)/(10^15)*CFe; % Set new bounds for lambda if Carbon_Hist_LCFS > Carbon_Energy_LCFS lambda_lower = lambda; end if Carbon_Hist_LCFS < Carbon_Energy_LCFS lambda_upper = lambda; end count1 = count1 + 1; lambda = (lambda_upper+lambda_lower)/2; end count1 = 0; % Calculate supply of gge's Sgge = Sg + Se; % Market clearing for gge's Dgge = GGERI*((Pgge/PggeRI)^Egged); if Dgge > Sgge Pgge_lower = Pgge; end if Dgge < Sgge Pgge_upper = Pgge; end Pgge = (Pgge_lower+Pgge_upper)/2; count2 = count2 + 1; end count2 = 0; Pgge_upper = 500; Pgge_lower = 0; % Social welfare calculations % Consumer Surplus % Set lower bound for integral (so that integral is finite int_limit = (1/10)*GGERI; % lower limit as a percentage of gge consumption in the unregulated market CS_no_lcfs = PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*GGERI^(1/Egged+1) - PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*int_limit^(1/Egged+1) - (PggeRI*(GGERI-int_limit)); % Consumer surplus without the LCFS CS_lcfs = PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*Dgge^(1/Egged+1) - PggeRI*(1/GGERI)^(1/Egged)*(1/(1/Egged+1))*int_limit^(1/Egged+1) - (Pgge*(Dgge-int_limit));; % Consumer surplus with the LCFS chng_CS = CS_lcfs - CS_no_lcfs - int_limit*(Pgge-PggeRI); %change in consumer surplus as a result of LCFS % Alt CS Integration % Pgge_ub = 50; % CS2_no_lcfs = GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*Pgge_ub^(Egged+1) - GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*PggeRI^(Egged+1); % CS2_lcfs = GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*Pgge_ub^(Egged+1) - GGERI*(1/PggeRI)^(Egged)*(1/(Egged+1))*Pgge^(Egged+1); % chng_CS2 = CS2_lcfs - CS2_no_lcfs; % Producer Surplus rev_no_lcfs = (PggeRI)*GGERI; % Producer revenue without LCFS rev_lcfs = (Pgge)*Sgge; % Producer revenue with LCFS C_EtOH_no_lcfs = PggeRI*(1/ERI)^(1/Ees)*(1/(1/Ees+1))*ERI^(1/Ees+1); % Total cost of EtOH production without LCFS C_EtOH_lcfs = PggeRI*(1/ERI)^(1/Ees)*(1/(1/Ees+1))*Se^(1/Ees+1); % Total cost of EtOH Production with LCFS C_gas_no_lcfs = PggeRI*(1/GRI)^(1/Egs)*(1/(1/Egs+1))*GRI^(1/Egs+1); % Total cost of gasoline production without LCFS C_gas_lcfs = PggeRI*(1/GRI)^(1/Egs)*(1/(1/Egs+1))*Sg^(1/Egs+1); % Total cost of gasoline production with LCFS PS_no_lcfs = rev_no_lcfs - (C_EtOH_no_lcfs + C_gas_no_lcfs); % Prod. surplus without LCFS PS_lcfs = rev_lcfs - (C_EtOH_lcfs + C_gas_lcfs); % Prod. surplus with LCFS chng_PS = PS_lcfs - PS_no_lcfs; % Change in prod. surplus as a result of LCFS % Individual Fuel PS % Gasoline PS_no_lcfs_G = rev_no_lcfs*(GRI/GGERI)-C_gas_no_lcfs; PS_lcfs_G = rev_lcfs*(Sg/Sgge)-C_gas_lcfs; chng_PS_G = PS_lcfs_G - PS_no_lcfs_G; % Fraction PS change attributed to gasoline % Ethanol PS_no_lcfs_E = rev_no_lcfs*(ERI/GGERI)-C_EtOH_no_lcfs; PS_lcfs_E = rev_lcfs*(Se/Sgge)-C_EtOH_lcfs; chng_PS_E = PS_lcfs_E - PS_no_lcfs_E; % Fraction PS change attributed to gasoline % Tax Revenue TR_no_lcfs = Fuel_Tax*GGERI; TR_lcfs = Fuel_Tax*Sgge; chng_TR = TR_lcfs - TR_no_lcfs; % Change in tax revenue as a result of LCFS % Carbon C_no_lcfs = (GRI*BTUPGg)/(10^15)*CFg + (ERI*BTUPGg)/(10^15)*CFe;% CO2 eq. without LCFS - Result here is MMTCO2e C_lcfs = (Sg*BTUPGg)/(10^15)*CFg + (Se*BTUPGg)/(10^15)*CFe; % CO2 eq. with LCFS - Result here is MMTCO@e Carbon_Cost = (chng_PS + chng_CS)/((C_no_lcfs - C_lcfs)*10^6); % Cost of abatment change in (CS + PS)/abatement % Output to Excel File OUTPUT = [Pgge;Sgge;lambda;Sg;Se;C_lcfs;chng_CS;chng_PS;chng_PS_G;chng_PS_E;chng_TR;CIg;CIe;Carbon_Cost;((CFg*GRI + CFe*ERI)/GGERI);BTUPGg;LCFS]; xlswrite('C:\Documents and Settings\Jon Hughes\Desktop\Research\LCFS\LCFS CT compare\SimulationOutput\SimulationOutput.xls', OUTPUT, 'Output', 'B22'); % Comment from here to bottom in order to do "one-off calc" % Calculations and graphs for contiuously varying sigma (LCFS) standard % carbon_ratio (1,i) = (CFe*Se + CFg*Sg)/(CFg*GRI+CFe*ERI); % Quad-MMBtu conversion drops out % CR (1,i) = j/1000; % SupplyEtOH (1,i) = Se; % SupplyGas (1,i) = Sg; % PriceGGE (1,i) = Pgge; % DemandGGE (1,i) = Dgge; % SupplyGGE (1,i) = Sgge; % MCGas (1,i) = Pgge-lambda*(CIg-LCFS); % MCEtOH (1,i) = Pgge-lambda*(CIe-LCFS); % afci (1,i) = AFCI; % lcfs (1,i) = LCFS; % compliance = AFCI-LCFS; % L (1,i) = lambda; % ps (1,i) = PS_lcfs; % cs (1,i) = CS_lcfs; % ps_g(1,i) = PS_lcfs_G; % ps_e(1,i) = PS_lcfs_E; % carbon_cost (1,i) = Carbon_Cost; % i = i+1; % j = j+1; % % end % % subplot (2,2,1); plot(CR,carbon_ratio) % title ('Carbon'); % subplot (2,2,2); plotyy(CR,SupplyGGE,CR,PriceGGE); % title ('Fuel & Price (green)'); % subplot (2,2,3); plot(CR,SupplyGas); % hold; % subplot(2,2,3); plot(CR,SupplyEtOH, 'g'); % title ('Gas & EtOH (green)'); % hold; % subplot (2,2,4); plotyy(CR,L,CR,compliance); % title ('Shadow Value'); end