Index: openacs-4/packages/accounts-finance/tcl/energy-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/accounts-finance/tcl/energy-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/accounts-finance/tcl/energy-procs.tcl 28 May 2010 06:35:03 -0000 1.1 @@ -0,0 +1,39 @@ +ad_library { + + energy based routines used for modeling cashflows etc + @creation-date 27 May 2010 + @cvs-id $Id: +} + +ad_proc -public acc_fin::energy_output { + base_system_performance + peak_power_output + annual_degredation + year + intervals_per_year +} { + returns the system energy output within an interval + Unit returned is in kWh if these units are used: + base_system_performance (hours of available peak energy / year or kWh/kW ) + peak_power_output ( kW ) + annual_degredation ( percent expressed as a decimal number ) 10% is 0.1 +} { + set energy_output [expr { $base_system_performance * $peak_power_output * ( 1. - (( $year - 1. ) * $annual_degredation ) ) / double($periods_per_year) } ] + return $energy_output +} + +ad_proc -public acc_fin::energy_ppa_revenue { + energy_output + ppa_rate + ppa_escalation + year +} { + returns the revenue amount from selling the energy on a purchase power agreement (PPA) during the year specified. + Unit returned is in currency of ppa_rate if these units are used: + energy_output (kWh) + ppa_rate (currency /kWh) + ppa_escalation ( percent expressed as a decimal number) 10% is 0.1 +} { + set revenue [expr { $energy_output * $ppa_rate * pow( 1. + $ppa_escalation , $year - 1. ) } ] + return $revenue +} Index: openacs-4/packages/accounts-finance/tcl/modeling-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/accounts-finance/tcl/modeling-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/accounts-finance/tcl/modeling-procs.tcl 27 May 2010 20:21:34 -0000 1.3 +++ openacs-4/packages/accounts-finance/tcl/modeling-procs.tcl 28 May 2010 06:35:03 -0000 1.4 @@ -35,6 +35,17 @@ return $sign } +ad_proc -public acc_fin::inflation_factor { + annual_inflation_rate + intervals_per_year + year +} { + Returns the factor to apply to a value to adjust for inflation. + Assumes inflationary factors occur once per year at end of year. +} { + set inflationary_factor [expr { pow ( 1. + $annual_inflation_rate / double($intervals_per_year) , $year - 1. ) } ] +} + ad_proc -private acc_fin::template_model { template_number } { @@ -621,6 +632,20 @@ } -# create proc gl_tx that accepts pairs of account debit/credit, where debits = credits -# create procs to mimmic AR/Transaction, AP/transaction, and other common transactions to reduce model complexity. + +# create procs for? +# AR/ +# AR/sale 1000 x, 1200 -x, 1200 x, 4000 x +# AP/vendor payment cash 1000 -x ,2100 x, 2100 -x, 5000 x +# ..let's wait until we know if this is necessary. gl_tx seems adequate for now. + +# system energy output +# revenue from energy output + +# create procs to maintain a debt via interation (add interest, add payment, adjust balance for each) +# monitor for payback period during iteration +# # create proce that shows balance sheet etc for any period or difference between two or more periods +# proc profitability_index (PV of future cashflows over project life / initial investment) + +