Home
An Integrated System Dynamics Model for
Contents
1. Yensim Glob art1980 new4 mdl Var Atmospheric CO Edt Model Tools Windows ls amp amp WB Rhan news base tax AGER Y BOE initial land fertility Doc and Animal Crop gt Land fertility Land fertility Impacted Agricultural 5 regeneration Area for SLR ha Food natio Taie Net Arable Land 4 land erosion rate ohstracle to convert m m fraction of inputs aak 28 allocated for land maintenance water stress to Land Yield factor i 23 Land Yield id land life multiplier a per oe from land yield amp Population gt A a b land life from land yield land life from land yield2 1 7 money wed Land yield tech change rate a for Agriculture per heck auultiplier LYMC land yield Land yield mlt nailtiplier capital land yield Desin Conversion table to agriculture Land yield smltipling initial yl tech technology development LYTD delay TDD 258 FAO food per capita Land yield technology LTD Land lt The wee Land yield mult change rate LYTDR 1 img a Industrial capital output ratio
2. 30 Population Population 45 Population 65 0 to 14 2 410450 to 64 10 sui ei to 65 phs 14 65 phs a ime total fertility 32 01014 3 15 to 44 an mortality 45 to 64 15 to 0 12 y mortality 65 mortality 0 to 14 GDP Population 1 GDP to life expctancy Fertility control multiplier effectiveness 45 the function Fini water stress life expect nom trol fertility nomal 33 fecundity 34 desired total y Pu jet mmiltiplier from lifetime mnltiplier from lifetime multiplier from health services 23 persistent pollution 29 need for fertility lt control 41 ciao lt Population Hide Times NewRoman v2 e i o INC US e Figure 3 11 View of the population sector tart1980 new4 mdl Var Atmospheric CO2 Concentration Edit View Model Tools Windows Help xl amp X BB A starti980_new4_base_tax QO BM i EW Historical Carbon Emissions Data from Marland et al 2008 Historical Cosl based E Emissions P Historical Oil based Historical
3. 12 2 2 6 Output WINdOWS RR 12 2 2 7 MOON E m 12 2 2 8 Structural Analysis 5 13 2 2 9 Dataset Analysis 14 2 2 10 14 2 3 Numerical Integration Technique 00000 nennen nnne naar nnne nsns nana 15 2 4 An Example 17 2 4 1 Problem Description and 5 17 5 55 14455044 24 3 1 Model Organization and Mathematical 24 3 2 ANEMI Model 32 3 3 Policy Development 2 2 4 4 nennen nna 33 3 3 1 Scenario 1 Increase Water Use 33 3 3 2 Scenario 2 Increase in Food 34 3 3 3 Scenario Carbon 35 4 OTHER SOFTWARE TOOLS wi 38 4 1 MATLAB Computer Packager 38 4 1 1 39 4 2 40 4 2 1 Studio Installat
4. This function 15 exported and called multiple times at Vensim startup with an index it returns 1 on success 0 to indicate the end of the function list For convenience the structure defined in section 3 is used but all the functions could also be declared with a switch statement on i EERE ERA EERE ES double dataStore 37 int flag 1 double readmat double x double read double double i a 0 0 FILE PTR clock_t endwait 1 do PTR fopen in txt r endwait clock 1 CLOCKS PER SEC while clock lt endwait while PTR NULL for i 1 0 i 237 0 i 1 0 fscanf PTR lf amp dataStore int i 1 0 fclose PTR 121 0 return dataStore int x 1 double counter 1 0 double writing double a1 double a2 double a3 double a4 double a5 double a6 double a7 double a8 double a9 double a10 double a11 double a12 double a13 double a14 double a15 double a16 double a17 double a18 double a19 double a20 double a21 double a22 double a23 double a24 double a25 double a26 double a27 double a28 double a29 double a30 double a31 double a32 double a33 double a34 double a35 double a36 double a37 double a38 double a39 double a40 double a41 FILE PTR clock t endwait if a41 counter counter
5. Edt Model Tools Windows OSH 1980 base tax LARRY BE m VCH MS BY TIME STEP 1 kr S FAO Cultivable Land Tum On Altered 05 Land Use Pattern FAO Agricultura land Initial Values Init Transfer Matrix ge om ea d ar Forest Area aif multiplier population Population Tusc les Cucsdetrtor Init Transfer gg _ for Bose case aif Population 1 Sauter Growth Drain Matrix ai 3 eth xc for landuse Rates Initial Transfer Matrix for 10 increase ai TIME STEP gt ime Init Biome Area Initial Transfer Maie E New Final Transfer aix Multiplier for fox 20 increase ai Matix aij se Change Final Transfer Influence of Temp L transfer matri entries ii Tum On Human Non diag Transit supporting Matrix Entries cal Matrix Intermediate Step Change from Each Change to Each Biome Area Biome Gain Biome Loss for Biome Newly converted arable land ntl Pavey forestarea p c TIME STEP Pasture land Anmal land animal gt 9981 Land Use Hide Times New Roman 112 s Figure 3 5 View of the land use sector
6. ZR start1980 4 base tax EX SE Y BK Y gt E EE Desired Surface Water Doc m Desired Industrial Water Withdrawal m 28 Technological Change for Withdrawals in Agricultural Sector Temperature 2 Base Specific Feedback Water Intake Technological Change for Consumption in amp Agricultural Sector dibus n Per nd Consumption Consumption B f Water Consumption Changing demand Water Consumption ME c 2 NR e Water Consumption Tim Year percent increase Final water stre irrigation water water stress on demand imigation pt Water Stress TIME STEP total irrigated area after increased agricultural land Historical Inigated Irrigated Area Expasionof Ama Production 4 SUC TN Init Transfer E gt Water Demand Hide New Roman t2 e i u s se Figure 3 8 View of the water demand sector 28 Vensim Global tart1980 new4 mdl Var Atmospheric CO2 Concentration File a Re 5 uk 4 tdt Model Tools Windows 2 amp RB 12481980 new4 base tax Zk YE G9 b gt
7. 1 12 221 par 1 13 822 1 14 23 1 15 alpha par 1 16 beta par 1 17 gamma par 1 18 rho par 1 19 theta par 1 20 At par 1 21 OMt par 1 22 L par 1 23 a4 par 1 24 a5 par 1 25 b4 par 1 26 1 27 mu2 1 28 kap3 1 29 1 30 eta 1 31 1 32 1 33 1 34 85 tau1 par 1 35 tau2 par 1 36 tau3 par 1 37 1 eng 1 1 2 1 2 1 3 share he1 1 4 share he2 1 5 share he3 1 6 nh weight 0 25 96 Energy economy 2 1 exp Y OMt At K alpha L beta exp E 1 alpha beta z 2 alpha L exp w beta K exp r 2 3 alpha exp E exp Pe 1 alpha beta K exp r 2 4 exp Y tau1 exp Fe1 exp Fh1 tau2 exp Fe2 exp Fh2 tau3 exp Fe3 exp Fh3 exp r K exp w L exp Pe exp E Production of energy services 2 5 gamma exp Eh theta 1 gamma exp El theta 1 theta 2 6 gamma exp Pel exp El 4 1 theta 1 gamma exp Ph exp Eh 1 theta 2 7 exp Pe exp E exp Ph exp Eh exp Pel exp El Electricity production 2 8 exp El Ael exp a1 exp Fe1 eta e exp a2 exp Fe2 eta exp a3 exp Fe3 eta nh weight exp e4 eta nh weight exp e5 eta e 1 eta
8. fiom except 2 Cort O92 ues except Cin cm Contant C02 Climate Sensitivity t p 2 S S RIT Fel Edt Levot Model Tools Windows lelxi 2 EZ start 980 base tax 3 Doc Preindustrial CO2 2 Rad Force Coeff CO2 in Atm 2 Time CO2 Rad Forcing TumOn 1 Climate Feedback Param Endogenous forcing E m EJ Radiative M Reference Temperature Feedback Cooling Other GHG Rad Forcing 7 Turn Nordhaus Climate Damage Scala Heat Cap Climate Secor Atmos Climate Damage Frac 28 UOcean Temp Che A UO Temp Heat Trans Coeff ciment Atmos Climate Damage Nonlinearity Ocean Temp Temp Di Heat Transfer temperature change from Initial Atm climate sector DO Heat Deep Ocean Temp Chg DO Temp Heat Capacity Ratio lt gt Climate new Hide Times NewRoman 12 b i u NN Figure 3 4 View of the climate Nordhause subsystem 26 lobal model start1980 new4 mdl Var Atmospheric CO2 Concentration
9. When you make changes to functions update this If Vensim opens vmf that references aexternal functions and there is a mismatch a message will be given indicating that the model should be reformed and cleaned if you return 0 no checking will occur If you have multiple external function libraries you can also use this to signal when a model is not matched to the library though it won t indicate which library should be used unsigned short VEFCC funcversion info return 1 int VEFCC set gv GLOB VARS vgv vgv if VENGV VENGV vgv magic start MAGIC START gt magic end VGV MAGIC END return 0 return 1 This function exported and called multiple times at Vensim startup with an index it returns 1 on success and 0 to indicate the end of the function list For convenience the structure defined in section 3 is used but all the functions could also be declared with a switch statement on i S IUS int VEFCC user definition int i an index for requesting information this is mapped to Flist 123 but could used another way vensim repeatedly calls user definition with i bigger by 1 until user definition returns 0 char sym the name of the function to be used in the Vensim model char argument desc description of arguments
10. 8 Matlab covery total Wat Gus reserve in GI production migas m vates consumption m fos in 919 percentage of electricity RENTE T d poros production by fossil C emission fom Smooth nat gus Lus due otal heat energy discovery e Kj pamal smoothing of whe gas discovery Total energy production lt gt Energy Economy Hide TimesNewRoman 11215114 Sym To eel Figure 3 13 View the energy economy sector e 3 Vensim Regional Model 2region 1980 test mdl Var New Final Transfer Matrix ajj Regions q E ji n o 7 H File Edit View Layout Model Tools Windows Help mu X828 EJ 2 region model 1980 landuse Regional Affected gt Population 5 Regional Migration 25 of affected Doc pa Regional Affected Regi ion 50 gional Migration 50 of affected Population number El 4 u Global Sea Level Rise Regional Migration 75 of the affected Regional Migration 100 of the affected Agricultural Land 3 2 pg Impacted Agricultural Area Impacted Agricultural Global Sea Level Rise Impacted Agricultura
11. ERA SR 7 Wastewater Rewe Breakdown by Wastewater Reuse TIME STEP gt Domestic Wastewater Desired Domestic Desired Domestic Desired Industrial Agricultural Water Water Withdrawal Desired Industrial Water Consumption Withdrawal Water Withdvawal lt Croundwater Retumable ati Global Desalinaied Waters Waters Water Industrial 4 Domestic Polbited Polluted Domestic Fraction Polbited Industrial Agricultural Polluted DN Fraction Water Water Fraction Agricultural 2 p d Water Domestic 3 1 Treatment lt gt 9 Treatment Percentage in Percent 7 Treated Industral Wastewater Treated Increase Rate Untreated Domestic Untreated aS Untreated Agricultural Water D d Treatment Wastewater Industrial water with N Stress 2 in Establishing 7 Delay im Extab ishing 2 Effdets gt Domestic Treatment aga effective untreated agricultural water with Ind Treat Dela Dom Treat Delay d effective untreated Treated Returnable domestic use retumuble water from Waters Industrial use Acceptable value for Domestic Acceptable vale for Domestic BODS liona
12. par 1 27 mu2 1 28 kap3 1 29 1 30 112 1 31 1 32 1 33 1 34 tau1 par 1 35 tau2 par 1 36 tau3 par 1 37 FC1 par 1 38 FC2 1 39 FC3 1 40 5 1 1 41 fstar2 par 1 42 fstar3 par 1 43 e1 eng 1 1 e2 eng 1 2 e3 eng 1 3 1 eng 1 4 h2 1 5 h3 1 6 1 eng 1 7 nx2 eng 1 8 nx3 eng 1 9 nh weight 0 25 96 Energy economy 2 1 exp Y OMt At K alpha L beta exp E 1 alpha beta z 2 alpha L exp w beta K exp r 2 3 alpha exp E exp Pe 1 alpha beta K exp r 2 4 exp Y exp r K exp w L exp Pe exp E 113 96 Production of energy services 2 5 exp E gamma exp Eh theta 1 gamma exp El theta 1 theta 2 6 gamma exp Pel exp El 4 1 theta 1 gamma exp Ph exp Eh 1 theta 2 7 exp Pe exp E exp Ph exp Eh exp Pel exp El Electricity production 2 8 exp El Ael exp a1 exp Fe1 eta e exp a2 exp Fe2 eta exp a3 exp Fe3 eta nh weight exp e4 eta nh weight exp e5 eta e 1 eta 2 9 exp Pel exp TCe1 exp TCe2 exp TCe3 exp r k4 exp r k5 exp El 2 10 FC1 exp short 1 exp TCe1 FC2 exp short_El exp a2p exp TCe2 2 11 FC2 exp short El exp
13. 1 11 W 1 12 1 13 1 14 Pel y 1 15 e4 y 1 16 5 1 17 1 1 18 89 FC2 1 19 FC3 y 1 20 1 1 21 2 1 22 TCe3 1 23 TCh1 1 24 TCh2 1 25 TCh3 1 26 1 1 27 2 1 28 a3 1 29 1 1 30 2 1 31 3 1 32 Fh4 y 1 33 1 34 TCh4 y 1 35 short El y 1 36 short H y 1 37 capital cap 1 1 1 1 2 2 1 3 1 4 k4 1 5 5 1 6 90 96parameters par 1 1 par 1 2 gam3 par 1 3 b1 par 1 4 62 1 5 1 6 21 1 7 Pfz2 par 1 8 Pfz3 par 1 9 1 par 1 10 2 1 11 1 12 221 par 1 13 822 1 14 23 1 15 alpha par 1 16 beta par 1 17 gamma par 1 18 rho par 1 19 theta par 1 20 At par 1 21 OMt par 1 22 L par 1 23 a4 par 1 24 a5 par 1 25 b4 par 1 26 par 1 27 mu2 1 28 91 kap3 1 29 eta e 1 30 eta 1 31 om 1 32 1 33 1 34 tau1 par 1 35 tau2 par 1 36 tau3 par 1 37 weight 0 25 fe2 par par 1 1 a2 par par 1 2 a2p par par ff 1 3 96 Energy
14. Aa 7 Values D Foreastarea New Transfer gt 1 Decreased Forest Y area Manix Multiplier for LandUse Change Sis Total final 1 Increased M Agncultaral area L El 23 7 Land N suppertng multiplying year Non diag Transfer _ E calculation Matrix Entries Total Non diag New Reman 112111 I I Figure 5 7 Parameters to implement with Scenario 2 8 Select equation button first and then click on the Matrix Multiplier for Land Use Change 9 Matrix multiplier for land use change change the value of 41417 to 0 15 Figure 5 8 60 Editing equation for Matrix Multiplier for Landuse Change Matrix Multiplier for Landuse Change j q 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Choose Variable Inputs Normal 3 Supplementary 9 Variables Subscripts Functions Constant Si Help ion Mc global Range Go Prev Next ilitd 3el New Check Syntax Check Model Delete Variable Cancel Figur
15. Constant g Choose Variable Inputs Normal Supplementary Units Con ment Group 1 1 mode Range Go To Prev Next Hilite 5 1 1 Errors Equation Check Syntax Check Model Delete Variable Cancel Editing equation for Implementation Year Implementation Year Undo Variables Subscripts Functions More Constant Choose Variable Inputs Normal Supplementary Units Con ment Group model Range Go To Prev Next Hilite 1 1 Errors Equation Modified Check Syntax Check Model Delete Variable Cancel 3 3 2 Scenario 2 Increase in Food Production Key Questions What are the impacts from increased conversion rate of forest land into agricultural land This scenario is closely related to the previous one The scenario 2 tests the impact of changing the land use by converting one land form into another forest into agricultural land In this scenario 1596 increase in land conversion from forest to agricultural is implemented from the year 2015 34 In the ANEMI model the Scenario 2 is created by assigning the following values to different input variables Land transformation multiplying year stands for the increased land transformation start year and Matrix Multiplier for Land Use Change denotes increase p
16. Parandvash D W Peterson Snover and S R Willard 1999 Impacts of Climate Variability and Change Pacific Northwest 110 pp Available from http www usgcrp gov usgcrp Library nationalassessment pnw pdf last accessed Aug 10 2011 Neilsen D S Smith W Koch G Frank J Hall and P Parchomchuk 2001 Impact of Climate Change on Crop Water Demand and Crop Suitability in the Okanagan Valley BC Technical Bulletin 01 15 Pacific Agri Food Research Centre Summerland British Columbia Canada Available from adaptation nrcan gc ca projdb pdf 4 e pdf last accessed Aug 15 2011 Protopapas L S Katchamart and A Platonova 2000 Weather effects on daily water use in New York City J Hydrol Eng 5 332 338 Schmidhuber J Tubiello F N 2007 Global food security under climate change Proceedings of the National Academy of Sciences USA 104 19703 19708 Sterman J D 2000 Business dynamics Systems thinking and modeling for a complex world The McGraw Hill Companies Ltd Boston Massachusetts U S A Ventana Systems 2010 Vensim DSS Software on line Ventana Systems Inc Harvard Massachusetts U S A Available from http www vensim com documentation html last accessed April 20 2011 MathWorks 2007 MATLAB getting started with MATLAB 7 on line The MathWorks Inc MA Available from http www mathworks com help releases R2007a pdf doc matlab getstart pdf last accessed D
17. naar nnn 43 Figure 4 9 General options under solution 44 Figure 4 10 View 2 4222 242224222415 4222422242221112221111 1412141 1412141 141214151412141 141544155415542518 44 Figure 4 11 Definition file extraction window 9 4 45 Figure 4 12 Output windOw 45 Figure 4 13 Option view of Vensim 1 eenei nennen nsns nhan nnne sisi 46 Figure 4 14 Option view of External function library 00 46 Figure 4 15 Flow diagram of the file exchange process between Vensim and 47 Figure 4 16 View of the File Menu in 47 Figure 4 17 Place to define current directory path 48 Figure 4 18 MATLAB Editor 48 Figure 4 19 View of the MATLAB Command 200 0 0 4 1000600 49 Figure 4 20 View of amp 1 49 4 21 RT 50 Figure 4 22 Model setting option of Vensim 50 Figure 4 23 View of the Time bound option under model setup option in 50 Figure 4 24 Option view to define the name of
18. BIB Figure 5 2 View of the energy economy sector focusing on fossil fuel price In the same way export new industrial carbon emission and GDP1 value from the Carbon sector and Energy Economy sector of the global model respectively Transfer extracted values as the Total Industrial Carbon emission and Global in trillion in the regional version of the ANEMI model Select the Water Demand sector view of the regional model to implement the Scenario 1 using Page Up or Page Down key Error Reference source not found Vow Took We JE kb RWG A Riitan news base discovery at begini Y d DM 3 4 1 Per MWh Consumption m nion 5 increase in 2 _ 4 4 Blustrial z Desired Industrial Water Consumption EN __ Desired Surface Water Consumption P Changing demand 4 Implementation lt sisi Si Wee Dern ree Teese Ronen 12 6 0 MN EST Figure 5 3 Parameters to implement Scenario 1 policy 56 7 Select equation button first and then click on the percent increase in water demand to insert 15 8 Choose the starting year for this policy implementation the Imple
19. U Test Visual 8400 File Edit View Project Build Debug Tools Test WindowoHelp 1 200 1 559 v Win32 08 imslemath ims aiid 5 9 430 2 VENEXT C Start Page E Figure 4 12 Output window 8 After successfully creating the DLL file link that file VENSIM DLL with Vensim To do so open Vensim model and press Option under the Tools menu Figure 4 13 The global option setting window will pop up and user needs to select startup option before proceeding further Figure 4 14 Lastly user should locate the DLL file VENSIM DLL using the Browse button located beside the External function Library 45 VensimRegional Model 2region 1980 testmdl Var Edit View Layout Model Windows Help tLe E gt be B di Sketch Toolset cx ing trend I need to check and 9 justify it 8 8908 T ate 1 Q lt Time gt transfer Land Transfer Multiplier Rates Language Doc Convert Charset Figure 4 13 Option view of Vensim File Edit View Layout Model Tools Windows Help Global Option Settings Sketch Sketch Defaults Toolbars Settings Advanced Fonts Fonts2 Colors amp Markings Graphics Units e Startup options will take effect when you restart Vensim Startup using last model worked on Close Excel when exiting Vensim if opened Use Vensim in of
20. exp Fe2 k2 2 2 31 exp a3 1 om exp gam3 exp Fe3 k3 2 2 32 exp Fe1 1 eta e exp a1p exp a1 eta e 2 om exp Fe1 k1 2 2 33 exp Fe2 1 eta e exp a2p exp a2 eta 2 om exp Fe2 k2 2 z 34 exp Fe3 1 eta e exp a3p exp a3 eta e 2 om exp Fe3 k3 2 Alternative Heat Energy Fuel Price 2 35 exp FC4 mu1 exp Fh4 mu2 96 Short Hand Expressions 2 36 exp short eta e exp a1 exp Fe1 eta exp a2 exp Fe2 eta e exp a3 exp Fe3 eta e nh weight exp e4 eta nh weight exp e5 eta 2 37 exp short exp b1 exp Fh1 eta exp b2 exp Fh2 eta exp b3 exp Fh3 eta h b4 exp Fh4 eta 115 Matching Trend in Fossil Fuels 2 38 1 e1 2 39 exp Fe2 e2 2 40 exp Fe3 2 41 exp Fh1 h1 2 42 exp Fh2 h2 2 43 exp Fh3 h3 96 Balanced Trade Condition 2 44 imports FC1 Exp1 FC2 Exp2 FC3 Exp3 116 Vedge Function File The vedge function is a simple MATLAB function that is used to calibrate the extraction of fossil fuels in the regional model Because the fossil fuel prices are taken as given in the regional model we need an adjustment factor to match the level of fossil fuels to be extracted The function solves for the appropriate vedge for each fossil fuel type over the period from 1980 2005 the calibration period Fr
21. Import Dataset from dat Format Terrestrial Export Dataset Advection Marine Atm Export Gaming Snow Temperature Feedback 6 Melting oct Ice Evapo Trans Figure 4 22 Model setting option of Vensim Model Settings use Sketch to set initial causes Time Bounds Info Pswd Sketch Units Equiv XLS Files Ref Modes Time Bounds for Model Date Display INITIALTIME 1880 Label Date FINALTIME 20000 Format YYYY MM DD TIME STEP 0 007812 Base date Time 0 Save results every TIME STEP Year 2000 or use SAVEPER 1 Month 1 Units for Time Day 1 Integration Units Monh v NOTE To change later use Settings or edit the equations for the above parameters Figure 4 23 View of the bound option under model setup option Vensim 10 Check any specific parameter value or the model equation by using the equation button H Select any parameter variable stock that maybe modified 50 11 Before experimenting with the scenarios run a to replicate the past present observations without the implementation of any new policy 12 Enter the name for the base model run for example Base Figure 4 24 Vensim Global model start1980 new4 m
22. stDII1 Show output from Build gt gt 48 3 Ga Project De Unload Project i Linking 2 Project Fil gt hD Model 1 VENEXT DEF 2 warning LNK4017 DESCRIPTION statement not supported for the target platform ignore Root 1 VENEXT DEF 3 warning LNK4017 statement not supported for the target platform ignored 1 VENEXT DEF 4 warning LNK4017 DATA statement not supported for the target platform ignored 1 VENEXT DEF 6 warning LNK4017 SEGMENTS statement not supported for the target platform ignored Figure 4 9 General options under solution explorer From TestDLL1 Property Page define the destination path of the DLL file name could be VENSIM DLL under General option Figure 4 10 TestDII1 Property Pages Configuration Active Debug Platform Activecwin32 gt Configuration Manager Common Properties Output File IAPhDNModelNDLLNTestDINTestDITNVENSIM DLL 4 Configuration Propertie Show Progress Not Set General Version Debugging Enable Incremental Linking Yes INCREMENTAL Suppress Startup Banner Yes NOLOGO 4 Linker Ignore Import Library No General Register Output No Input Per user Redirection No Additional Library Directories Debugging Link Library Dependencies Yes olas Use Library Dependency Inputs No Embedded IDL Use UNICODE Response Files Yes Advanced Command Line Manifest Too
23. 2 13 exp Ph exp TCh1 exp TCh2 exp TCh3 exp TCh4 exp Eh z 14 exp FC1 exp FC1 tau1 exp Fh1 rho PR1 exp Fe1 exp Fh1 exp short H b1 exp Fh1 eta h 1 exp TCh1 exp FC2 exp FC2 tau2 exp Fh2 rho PR2 fe2 par exp Fh2 exp short H b2 exp Fh2 eta h 1 2 2 15 exp FC2 exp FC2 tau2 exp Fh2 rho PR2 fe2 par exp Fh2 exp short H b2 exp Fh2 eta h 1 exp TCh2 exp FC3 exp FC3 tau3 exp Fh3 rho PR3 exp Fe3 exp Fh3 exp short H b3 exp Fh3 eta h 1 exp TCh3 2 16 exp FC3 exp FC3 tau3 exp Fh3 rho PR3 exp Fe3 exp Fh3 exp short H b3 exp Fh3 eta h 1 exp TCh3 1 mu2 exp FC4 exp short_H b4 exp Fh4 4 eta_h 1 exp TCh4 96 Nuclear and hydro electricity production 2 17 exp e4 a4 2 18 exp e5 a5 Fuel prices 2 19 exp FC1 tau1 Pfz1 PR1 exp Fe1 exp Fh1 Rz1 rho z 20 exp FC2 tau2 Pfz2 PR2 fe2 par exp Fh2 Rz2 rho 2 21 exp FC3 tau3 Pfz3 PR3 exp Fe3 exp Fh3 Rz3 rho Total cost functions for electricity 2 22 1 exp r k1 exp Fe1 exp FC1 93 2 23 exp TCe2 exp r k2 fe2 par exp FC2 2 24 exp TCe3 exp r k3 exp Fe3 exp FC3 96 Total cost functions for heat energy 2 25 exp TCh1 exp Fh1 exp FC1 z 26 exp TCh2 exp Fh2 exp FC2 2 27 exp TCh3
24. 2 9 exp Pel exp TCe1 exp TCe2 exp TCe3 exp r k4 exp r k5 exp El 2 10 1 exp FC1 tau1 exp Fe1 rho PR1 exp Fe1 exp Fh1 exp short El exp a1p exp TCe1 exp FC2 exp FC2 tau2 exp Fe2 rho PR2 exp Fe2 exp Fh2 exp short El exp a2p 2 2 11 exp FC2 exp FC2 tau2 exp Fe2 rho PR2 exp Fe2 exp Fh2 exp short El exp a2p exp TCe2 86 exp FC3 exp FC3 tau3 exp Fe3 rho PR3 exp Fe3 exp Fh3 exp short El exp a3p 2 12 exp Eh Ah exp b1 exp Fh1 eta exp b2 exp Fh2 eta exp b3 exp Fh3 eta b4 exp Fh4 eta h 1 eta h 2 13 exp Ph exp TCh1 exp TCh2 exp TCh3 exp TCh4 exp Eh z 14 exp FC1 exp FC1 tau1 exp Fh1 rho PR1 exp Fe1 exp Fh1 exp short H exp b1 exp Fh1 eta h 1 exp TCh1 exp FC2 exp FC2 tau2 exp Fh2 rho PR2 exp Fe2 exp Fh2 exp short H exp b2 exp Fh2 eta h 1 2 2 15 exp FC2 exp FC2 tau2 exp Fh2 rho PR2 exp Fe2 exp Fh2 exp short H exp b2 exp Fh2 eta h 1 exp TCh2 exp FC3 exp FC3 tau3 exp Fh3 rho PR3 exp Fe3 exp Fh3 exp short H exp b3 exp Fh3 eta h 1 exp TCh3 2 16 exp FC3 exp FC3 tau3 exp Fh3 rho PR3 exp Fe3 exp Fh3 exp short H
25. exp a1 exp Fe1 eta exp a2 exp Fe2 eta e exp a3 exp Fe3 eta e nh weight exp e4 eta nh weight exp e5 eta 2 37 exp short exp b1 exp Fh1 eta exp b2 exp Fh2 eta exp b3 exp Fh3 eta b4 exp Fh4 eta h Matching Trend in Fossil Fuels 2 38 1 e1 2 39 exp Fe2 e2 2 40 exp Fe3 z 41 exp Fh1 exp Fe1 share 1 2 42 exp Fh2 exp Fe2 share he2 2 43 exp Fh3 exp Fe3 share he3 88 Zero Oil Condition Function File The zero oil function file for MATLAB solves the one period problem for the global model when a cut off condition is satisfied In response to price changes for a fossil fuel type production of electricity can fall much faster than the depreciation of the capital stock used in production of electricity from that fuel type As a result the average total cost may increase very rapidly and the non linear equation solver can break down This event almost always happens to electricity production from oil and the zero oil MATLAB function is a fix for that specific problem When a threshold condition is reached the value of electricity produced from oil remains fixed at a level close to zero function z glb zo y par variables y 1 1 1 2 Eh y 1 3 El y 1 4 y 1 5 Fh2 y 1 6 Fh3 y 1 7 Fel 1 8 Fe2 y 1 9 Fe3 y 1 10
26. the Status Bar changes to reflect text editing operations 2 2 6 Output Windows Output Windows are generated by clicking on the Analysis Tool The analysis tool gathers information from the model and displays the information in a window as a diagram graph or text depending on the particular tool Dozens of these windows can be open simultaneously and a particular window can be closed individually by clicking the Close button in the top left or top right corner or all windows can be closed at once using the menu item Windows gt Close All Output 2 2 7 Analysis Tool The analysis tool is used to show information about the Workbench variable either its place or value in the model or its behaviour from the simulation datasets Analysis tools are grouped into toolsets To configure a tool user needs to click on the tool with the right mouse button and change its options Tools can also be added to a toolset As with Sketch toolsets if the user makes changes he she will be 12 prompted to save the toolset when exiting Vensim Several different analysis toolsets are supplied with Vensim and be opened from the menu Tools gt Analysis Toolset gt Open The following toolsets Figure 2 4 are built in PLE Reader Plus DSS Pro Std bc Q Doc Doc Doc 2 25 4 poss Figure 2 4 Vensim built in toolsets A description of the functions of toolsets
27. An integrated system dynamics model is developed to assess the impacts of climate change on society biosphere climate economy energy system Akhtar et al 2011 This manual is prepared for ANEMI model users The ANEMI system dynamics model consists of nine sectors components Carbon Climate Land Use Food Production Population Energy Economy Hydrologic Cycle Water Demand and Y Water Quality The conceptual links between these nine sectors shown in Figure 1 1 The carbon sector computes the atmospheric carbon dioxide concentration by considering the carbon exchange among ocean air vegetation humus and industrial emissions The atmospheric temperature is produced by climate sector taking into consideration the radiative forcing from different sources The land use sector deals with the change of land use by converting forest area to agricultural land and agricultural land to urban land to meet the needs of growing population Food production is driven by the availability of agricultural land allocated capital water availability and land fertility The requirements for the increase in food production are driven by the population growth and per capita food demand The population sector computes the total population in each year for four different age groups 0 14 15 44 45 65 65 and above based on the desired number of children per family birth control effectiveness availability of resources and oth
28. Source Files 3 VENEXT DEF i VENSIMDP LIB Figure 4 8 Solution explorer window 4 Select the TestDLL1 folder from the Solution Explorer window and then right click to select the properties Figure 4 9 43 5 6 Edit View Project Build Debug Tools Test Window Help gt 5 Debug Win32 711 imsicmath 9 F 228111 2 0 59 C3 aa Qe VENEXT C X Soionbplrer TetDIL Global Scope Solution TestDII 1 project else initial time 0 0 if VENGV final time gt initial time dmat ntime long VENGV gt final_time initial time time step 1 50 Clean dmat ntime 100 Project Only b VENGV alloc simmem dmat 0 0 a for time initial_time j 0 j lt dmat gt ntime j time time_step ve Profile Guidad Optimization dmat timevals j time Custom Rules for i 0 i dmat nvar i for j 0 j lt dmat gt ntime j dmat vals i j REAL i 100 0 j References Tool Build Order return dmat gt vals 0 0 Add Wet Reference d View Class Diagram 9 Solution Set as StartUp Project Properties Debug Teston Cut a Misc
29. exp b3 exp Fh3 eta h 1 exp TCh3 1 mu2 exp FC4 exp short_H b4 exp Fh4 4 eta_h 1 exp TCh4 96 Nuclear and hydro electricity production 2 17 exp e4 a4 2 18 exp e5 a5 Fuel prices 2 19 exp FC1 tau1 Pfz1 PR1 exp Fe1 exp Fh1 Rz1 rho z 20 exp FC2 tau2 Pfz2 PR2 exp Fe2 exp Fh2 Rz2 rho 2 21 exp FC3 tau3 Pfz3 PR3 exp Fe3 exp Fh3 Rz3 rho Total cost functions for electricity 2 22 exp TCe1 exp r k1 exp Fe1 exp FC1 2 23 exp TCe2 exp r k2 exp Fe2 exp FC2 2 24 exp TCe3 exp r k3 exp Fe3 exp FC3 87 96 Total cost functions for heat energy 2 25 exp TCh1 exp Fh1 exp FC1 2 26 exp TCh2 exp Fh2 exp FC2 2 27 exp TCh3 exp Fh3 exp FC3 2 28 exp TCh4 exp Fh4 exp FC4 CES weights for electricity production z 29 exp a1 1 om exp gam1 exp Fe1 k1 2 2 30 exp a2 1 om exp gam2 exp Fe2 k2 2 2 31 exp a3 1 om exp gam3 exp Fe3 k3 2 2 32 1 1 e exp a1p exp a1 eta 2 om exp Fe1 k1 2 2 33 exp Fe2 1 eta e exp a2p exp a2 eta 2 om exp Fe2 k2 2 z 34 exp Fe3 1 eta e exp a3p exp a3 eta e 2 om exp Fe3 k3 2 Alternative Heat Energy Price Function 2 35 exp FC4 mul exp Fh4 mu2 96 Short Hand Expressions 2 36 exp short eta e
30. exp x 6 rho exp x 20 PR1 exp x 9 exp x 201 exp x 21 exp x 18 2 1 b2 exp x 21 exp x 6 rho exp x 21 PR2 exp x 10 exp x 21 1141 exp x 21 exp x 18 2 1 b2 exp x 21 exp x 6 rho exp x 21 PR2 exp x 10 exp x 211 exp x 22 exp x 19 2 1 b3 exp x 22 exp x 6 rho exp x 22 PR3 exp x 11 exp x 22 Nuclear and hydro electricity production f 15 exp x 12 a4 pow k4 mu4 f 16 exp x 13 a5 pow k5 mu5 Fuel price functions 117 Rz1 pow exp x 17 Pfz1 1 rho PR1 exp x 9 exp x 20 118 Rz2 pow exp x 18 Pfz2 1 rho PR2 exp x 10 exp x 21 119 Rz3 pow exp x 19 Pfz3 1 rho PR3 exp x 11 exp x 22 Total cost functions for electricity 201 exp x 14 exp x 3 k1 exp x 9 exp x 17 f 21 exp x 15 exp x 3 k2 exp x 10 exp x 18 f 22 exp x 16 exp x 3 exp x 11 exp x 19 Total cost functions for heat energy f 23 exp x 23 20 17 f 24 exp x 24 exp x 21 exp x 18 f 25 exp x 25 exp x 22 exp x 19 double COSINE double x double INRANGE double norm double minval double maxval if norm gt maxval return maxval if norm minval return minval 129 return norm double PSUM VECTOR vec double num arg int maxarg double rval inti n if num arg gt maxar
31. 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 OMt par1 At par2 K par3 alpha par4 L par5 beta par6 gamma par7 theta par8 gam1 par9 gam2 par10 gam3 p 11 a4 par12 a5 par13 mu4 par14 mu5 par15 k1 par16 k2 par17 k3 par18 k4 par19 k5 par20 b1 par21 b2 par22 b3 par23 PR1 par24 PR2 par25 PR3 par26 Pfz1 par27 Pfz2 par28 Pfz3 par29 rho par30 Rz1 par31 Rz2 par32 Rz3 par33 128 f zeros sys N IMSL ERR REL err rel MSL maxitn IMSL_XGUESS xguess IMSL FNORM amp fnorm 0 return x index void fcn int n float x float f 00 exp x 0 OMt At pow K alpha pow L beta pow exp x 1 1 alpha beta f 1 alpha L exp x 2 beta K exp x 3 f 2 alpha exp x 1 exp x 4 1 alpha beta K exp x 3 f 3 exp x 0 exp x 3 K exp x 2 L exp x 4 exp x 1 Production of energy services f 4 pow exp x 1 theta gamma pow exp x 5 theta 1 gamma pow exp x 6 theta f 5 gamma exp x 7 pow exp x 6 1 theta 1 gamma exp x 8 pow exp x 5 1 theta f 6 exp x 4 exp x 1 exp x 8 exp x 5 exp x 7 exp x 6 Electricity production Heat energy production f 11 exp x 5 b1 exp x 20 b2 exp x 21 b3 exp x 22 f 12 exp x 5 exp x 8 b1 exp x 20 exp x 5 exp x 23 b2 exp x 21 exp x 5 exp x 24 b3 exp x 22 exp x 5 exp x 25 813 exp x 20 exp x 17 2 1 b1 exp x 20
32. 1 par 1 2 105 gam3 1 3 61 1 4 62 1 5 b3 1 6 21 1 7 Pfz2 par 1 8 Pfz3 1 9 1 1 10 PR2 1 11 1 12 821 par 1 13 822 1 14 23 1 15 alpha par 1 16 beta par 1 17 gamma par 1 18 rho par 1 19 theta par 1 20 At par 1 21 OMt par 1 22 L par 1 23 a4 par 1 24 a5 par 1 25 b4 par 1 26 mu1 1 27 mu2 1 28 kap3 1 29 1 30 1 31 106 om 1 32 1 33 1 34 tau1 par 1 35 tau2 par 1 36 tau3 par 1 37 par 1 38 FC2 par 1 39 FC3 1 40 5 1 1 41 fstar2 par 1 42 fstar3 par 1 43 nh weight 0 25 96 Energy economy 2 1 exp Y OMt At K alpha L beta exp E 1 alpha beta z 2 alpha L exp w beta K exp r z 3 alpha exp E exp Pe 1 alpha beta K exp r 2 4 exp Y imports tau1 exp Fe1 exp Fh1 tau2 exp Fe2 exp Fh2 tau3 exp Fe3 exp Fh3 exp r K exp w L exp Pe exp E Production of energy services 2 5 exp E gamma exp Eh theta 1 gamma exp El theta 1 theta 2 6 gamma exp Pel exp El 4 1 theta 1 gamma exp Ph exp Eh 4 1 theta 2 7 exp Pe exp E exp Ph exp Eh exp Pel exp E
33. 1 for an optimization it the middle two calls are repeated for every simulation the setup routine should return 0 on failure the return value is only used when iniflag 1 If the function returns 0 simulation will not proceed UE N OR I CFUNCTION int VEFCC simulation setup int iniflag 1 CFUNCTION int VEFCC simulation shutdown int finalflag vext clearmem return 1 this is a safety function to validate vector ranges when passing vectors to Vensim you don t need to use it but it will help to prevent nasty memory errors static void validate vector arg VECTOR v int firstind int lastind int itemp if firstind lastind itemp firstind firstind lastind lastind itemp if v gt vals firstind lt v firstval v gt vals lastind gt v gt firstval v dim info tot 1 vensim error argument out of bounds 126 v vals 0 COMPREAL O O v vals 0 COMPREAL 1 0 v vals 0 generate a floating point exception 6 vensim external the actual external function call note that all the functions doing flo
34. 1 0 fopen out txt w fprintf PTR 1 fprintf PTR 2 fprintf PTR E n a3 fprintf PTR E n a4 fprintf PTR 5 fprintf PTR E n a6 fprintf PTR 7 fprintf PTR 8 fprintf PTR 9 fprintf PTR 10 fprintf PTR 11 fprintf PTR 12 fprintf PTR 13 fprintf PTR 14 fprintf PTR 15 fprintf PTR 16 fprintf PTR 17 18 fprintf PTR 19 fprintf PTR 20 fprintf PTR 21 fprintf PTR 22 fprintf PTR 23 fprintf PTR 24 fprintf PTR 25 fprintf PTR 26 fprintf PTR 27 fprintf PTR E n a28 fprintf PTR 29 fprintf PTR E n a30 fprintf PTR 31 fprintf PTR 32 fprintf PTR E n a33 fprintf PTR 34 fprintf PTR 35 fprintf PTR E n a36 fprintf PTR 37 122 fprintf PTR E n a38 fprintf PTR E n a39 fprintf PTR 40 fclose PTR endwait clock 1 CLOCKS PER SEC while clock endwait remove in txt flag 1 else counter counter 1 0 return a1 1 int VEFCC version info return EXTERNAL VERSION
35. Atthis stage the setup wizard transfers needed files into a temporary folder Figure 4 4 Microsoft Visual Studio 2008 Setup is copying required resources to your temp directory Copying file 19 of 71 Copying setup greenRule gif Figure 4 4 View of copying setup file 4 Follow the Welcome Setup Wizard and wait for the wizard to load the installation components Figure 4 5 Visual Studio Welcome to the Microsoft Visual Studio 2006 installation wizard This 4 guides you through installing this program and all required components Melp Improve Setup You submit anonymous information about rour Visual Studio setup experiences t Microsoft participate check the box below gere abou setup lo Merosot Corporation For more information chc Cata Visual Studio Figure 4 5 Option view to share Visual Studio setup experience 41 5 Notice that VS 2008 version 8 x needs Framework version 3 5 where user needs to provide the product key information and accept the license terms 6 Proceed with the selection of installation choice between Default Full or Custom 7 Select the Install button and follow the step by step auto installation process Figure 4 6 Figure 4 6 View of the installation process 4 3 Integration of External Functions With Vensim Software A dynamic link library DLL is a coll
36. Figure 2 2 The installation starts by clicking on Install a Registered Vensim Application and entering the registration code Vensim amp 5 Installation Choices 1 Registered applications include PLE PLE Plus Standard Professional 055 Runtime and Application Runtime ou will need to supply registration cade Install the Vensim Model Reader Install the V ensim Demonstration Program Install Vensim PLE for Academic or Evaluation Use pen the Vensim Documentation from the The User s Guide is available as an adobe Open the User s Guide in Acrobat acrobat If you do not Acrobat Reader installed you can install it from here Install Adobe Acrobat Reader this dialag Figure 2 2 Installation choice dialog box From Downloaded Files Double click on the first file for example vendss32 exe for Vensim DSS This will be in the directory selected by the user during the download procedure 2 1 6 Registration Code Vensim DSS Professional Standard PLE Plus and PLE for commercial use require a registration code Vensim PLE for educational or evaluation use do not require a registration code Use of the ANEMI model requires a licensed version of Vensim software which allows work with the external functionalities 2 2 Main Features of Vensim Software Vensim uses an interface workbench and a set of tools The main Vensim window is the workbench which always in
37. Format YY Y Y MM DD 5 1 Base date at Time 0 v Save results every TIME STEP Year 2000 oruse Month 1 Units for Time 1 Integration Euer Units Month v NOTE change later use Settings or edit the equations for the above parameters Cancel Figure 2 6 Vensim model setting window 4 Select the Box Variable button before drawing the variables in the workspace User also needs to select the Rate button to make connection with the stock variable through flow rate Vensim Unnamed VarFINAL File Edit View Layout Model Tools E amp xum Box Variable Level 19 Vensim Unnamed Var FINAL File Edit View Layout Model OR bc 7 gt Yu 5 After the completion of all the required connections the stock and flow diagram of the model should be like the diagram in Figure 2 7 where Potential Customer and Actual Customer are stocks representing number of customers Land conversion is working as a flow by transforming Potential Customer to Actual Customer Potential Actual customer customer Land conversion Figure 2 7 Stock and flow diagram c 1 Toincorporate the mathematical equations the user needs to select the equation button before c
38. MYLOOKUP lookup x 2 0 MYLOOKUP_FUNC 0 0 0 1 MYALLTYPES literal lookup vector x 4 1 MYALLTYPES_FUNC 1 0 1 1 MYCONSTDEF 1 0 MYCONSTDEF FUNC CONSTDEF MARKER 0 1 0 MYDATADEF literal 1 0 MYDATADEF FUNC DATADEF MARKER 0 1 0 SOLVE_NONLINEAR_SYSTEM 34 parameters 34 0 MY_FUNC 0 0 0 0 WRITE 40 parameters 41 0 MY 0 0 0 0 READMAT ReadTheMatrix 1 0 ARRAY READ 0 0 0 0 00 009 4 required functions LibMain WEP Obsolete 16 bit windows only 120 GE 5 External function definitions This function is a version check it is required to be sure the external functions are compatible with the current Vensim version Note that for 5 8c this number has changed but you can simply update this version number the set gv function and the funcversion info function these 2 return different value types make no other changes to your external functions and they will work To simplify use with different configurations ie the Model Reader and DLLs we recommend that you not link with vensim lib or vensimdp lib and replace vensim error message with VENGV error message vensim alloc simmem with VENGV alloc simmem vensim execute curloop with VENGV execute curloop
39. Manual Chapter 2 introduces the user to the Vensim User Interface and provides instructions for the installation of Vensim software This chapter provides an overview of Vensim s functionalities along with information on the Sketch tools Analysis tools and Control windows Chapter 3 provides a brief description of the ANEMI model model experimentation policy description Chapter 4 introduces other software packages required for the ANEMI model simulation and their installation procedures detailed description of the integration procedure of MATLAB and Vensim modeling tools through Visual Studio are also presented Chapter 5 describes three simulations which are related to different policy scenarios presented in the main report Akhtar et al 2011 This chapter also contains step by step procedure for the implementation of three policy scenarios in both global and regional versions of the ANEMI model Appendix A contains the MATLAB optimization code MATLAB for the energy economy sector This appendix contains programming code for both global and regional model where fsolve functionality is used to find a root zero of a system of nonlinear equations Appendix B includes all the necessary programming code in Visual Studio to generate a Dynamic Link Library DLL files which are utilized by Vensim and Appendix D presents the parameter estimation codes in R programming language developed for the disaggregation model 2 VENSI
40. Max_mem_used 100 0 100 sizeof HANDLE else Mem used HANDLE calloc Max mem used sizeof HANDLE if IMem used 0 Ihndl HANDLE malloc nbytes if Ihndl return 0 if hndl hndl Ihndl Mem used Num mem Ihndl return Ihnadl static void vext_reallocate unsigned nbytes HANDLE hndl inti if hndl return vext_allocate nbytes hndl if Mem_used find old otherwise live with the memory leak for i 0 icNum_mem_used i if Mem_used i hndl break hndl realloc hndl nbytes lt Num mem used Mem used i hndl return hndl static void vext_clearmem 125 inti if Mem_used for i 0 i lt Num_mem_used i if Mem used i free Mem used i free Mem used Mem used 40 Num mem used Max mem used 0 Matrix invert maxn 0 Internal fror 40 a 6 startup and shutdown routines these two functions if they exist and are exported are called before the simulation starts and after it ends in a normal simulation the order is simulation setup 1 simulation simulation shutdown 0 simulation shutdown
41. Oil and NaturalGas Figure 5 6 Vensim Regional Model Zregion 1980 22May mdl Yar Coal pric th Model Windows RE region model 1900 22 withtax Et Sev TTA 5 of P 2 c ratio sumR21t023 wnte me id sumpto 10 ratio of R21 and EN BAS and 8 RS NY 75238 2 Y 1 Ei Xo w Coal price a 24 gt si m pics modified Coal ac reserve in GJ 1 REL 4 j modified Chal hice with _ m GJ Figure 5 6 Fossil fuel price to be imported in the regional version of the ANEMI model 59 5 Export New industrial Carbon Emission and value from the Carbon Sector and Energy Economy sector of the global model respectively 6 Transfer exported values to Total Industrial Carbon Emission and Global in trillion of the regional version of the ANEMI model 7 Open Land Use view Figure 5 7 to implement the Scenario 2 Vemsim Regional Model 7region 1980 22May mdl Var Matrix Multiplier LandUse Change j q Edt vew Model Took Windows 8 amp BB region model 1980 22 May withtax TTA
42. a2p exp TCe2 FC3 exp short_El exp a3p exp TCe3 Heat energy production 2 12 exp Eh Ah exp b1 exp Fh1 eta exp b2 exp Fh2 eta exp b3 exp Fh3 eta b4 exp Fh4 eta h 1 eta 2 13 exp Ph exp TCh1 exp TCh2 exp TCh3 exp TCh4 exp Eh z 14 FC1 exp short H exp b1 exp Fh1 eta h 1 exp TCh1 FC2 exp short H exp b2 exp Fh2 eta h 1 exp TCh2 2 15 FC2 exp short H exp b2 exp Fh2 eta h 1 exp TCh2 FC3 exp short H exp b3 exp Fh3 eta h 1 exp TCh3 2 16 FC3 exp short H exp b3 exp Fh3 eta h 1 exp TCh3 1 mu2 exp FC4 exp short_H b4 exp Fh4 4 eta_h 1 exp TCh4 Nuclear and hydro electricity production 2 17 4 a4 2 18 5 5 96Fuel prices 2 19 fstar1 exp Fe1 exp Fh1 Exp1 2 20 fstar2 exp Fe2 exp Fh2 Exp2 2 21 fstar3 exp Fe3 exp Fh3 Exp3 114 96 Total cost functions for electricity 2 22 exp TCe1 exp r k1 exp Fe1 FC1 2 23 exp TCe2 exp r k2 exp Fe2 FC2 2 24 exp TCe3 exp r k3 exp Fe3 FC3 Total cost functions for heat energy 2 25 exp TCh1 exp Fh1 FC1 2 26 exp TCh2 exp Fh2 FC2 2 27 exp TCh3 exp Fh3 FC3 2 28 exp TCh4 exp Fh4 exp FC4 CES Function weights z 29 exp a1 1 om exp gam1 exp Fe1 k1 2 2 30 exp a2 1 om exp gam2
43. economy 2 1 exp Y OMt At K alpha L beta exp E 1 alpha beta z 2 alpha L exp w beta K exp r z 3 alpha exp E exp Pe 1 alpha beta K exp r 2 4 exp Y tau1 exp Fe1 rexp Fh1 tau2 fe2_par exp Fh2 tau3 exp Fe3 exp Fh3 exp r K exp w L exp Pe exp E Production of energy services 2 5 exp E gamma exp Eh theta 1 gamma exp El theta 1 theta 2 6 gamma exp Pel exp El 4 1 theta 1 gamma exp Ph exp Eh 1 theta 2 7 exp Pe exp E exp Ph exp Eh exp Pel exp El 96 Electricity production 2 8 Ael exp a1 exp Fe1 eta 42 par fe2 par eta exp a3 exp Fe3 eta e nh weight exp e4 eta e nh weight exp e5 eta e 1 eta 2 9 exp Pel exp TCe1 exp TCe2 exp TCe3 exp r k4 exp r k5 exp El 92 2 10 exp FC1 exp FC1 tau1 exp Fe1 rho PR1 exp Fe1 exp Fh1 exp short El exp a1p exp TCe1 exp FC2 exp FC2 tau2 fe2 par rho PR2 fe2 2 5 El a2p par exp TCe2 2 11 exp FC2 exp FC2 tau2 fe2 par rho PR2 fe2 par exp Fh2 exp short 2 par exp TCe2 exp FC3 exp FC3 tau3 exp Fe3 rho PR3 exp Fe3 exp Fh3 exp short_El exp a3p exp TCe3 96 Heat energy production 2 12 exp Eh Ah b1 exp Fh1 eta h b2 exp Fh2 eta b3 exp Fh3 eta b4 exp Fh4 eta h 1 eta
44. flag vect 1 i mean abs fval fval_mat i fval y outmat 1 37 i filename z in txt mmfile fopen filename if mmfile 1 disp filename error File not found end aa fprintf mmfile y fclose mmfile filename z b in txt mmfile fopen filename if mmfile 1 disp filename error File not found 75 fprintf mmfile fclose mmfile end toc 76 Main Function File The main function file for MATLAB solves the one period problem for the global model It is a non linear system of 37 equations and variables function z energysect glb y par cap 96variables Y 1 1 1 2 1 3 El 1 4 1 5 Fh2 1 6 Fh3 y 1 7 Fe1 y 1 8 Fe2 y 1 9 Fe3 y 1 10 r y 1 11 w 1 12 Pe y 1 13 Ph 1 14 Pel y 1 15 4 y 1 16 5 1 17 1 1 18 2 1 19 1 20 1 1 21 2 1 22 77 TCe3 y 1 23 TCh1 y 1 24 TCh2 y 1 25 TCh3 y 1 26 al 1 27 a2 1 28 1 29 1 1 30 2 y 1 31 3 1 32 Fh4 1 33 FC4 1 34 TCh4 1 35 short El 1 36 short 1 37 capital cap 1 1 1 1 2 2 1 3 1 4 k4 cap 1 5 k5 cap 1 6 parameters gam
45. float 5 float par6 float par7 float par8 float par9 float par10 float par11 float par12 float par13 float par14 float par15 float 16 float par17 float par18 float par19 float par20 float par21 float par22 float par23 float par24 float par25 float par26 float par27 float par28 float par29 float par30 float par31 float par32 float par33 float par34 float par35 float par36 float par37 float par38 float par39 float par40 float OMt At K alpha L beta gamma theta gam1 gam2 gam3 a4 a5 mu4 mu5 k1 k2 k3 k4 k5 b1 b2 b3 PR1 PR2 PR3 Pfz1 Pfz2 Pfz3 rho Rz1 Rz2 Rz3 0m double 1 2 3 PETAR RORIS LEE LEA RAE RARER RAE RED RAE RE 3 Grouping of functions in a structure see venext h TRL LALA static FUNC_DESC Flist COSINE 1 0 COS_FUNC 0 0 0 0 READ x 1 0 COS_FUNC 0 0 0 0 INRANGE minval maxval 3 0 INRANGE_FUNC 0 0 0 0 PSUM vector nelmlimit 3 1 PSUM_FUNC 0 0 0 0 MATRIX_INVERT matrix 1 1 INVERT_FUNC 2 0 0 0 MATRIX_INPLACE_INVERT matrix 1 1 INPLACE_INVERT_FUNC O 1 0 0 INTERNAL_ROR x time minror streamid compute 6 0 INTERNAL_ROR_FUNC 0O 0 0 0 IMYMESSAGE time 2 0 MYMESSAGE_FUNC 0 0 1 0 MYFINDZERO vector_to_zero nelement 2 1 MYFINDZERO_FUNC 1 2 0 0
46. i mean abs fval flag vect 1 i flag 102 filename z in txt mmfile fopen filename w if mmfile 1 disp filename error File not found end aa fprintf mmfile y fclose mmfile filename b_in txt mmfile fopen filename w if mmfile 1 disp filename error File not found end aa fprintf mmfile y fclose mmfile end toc 103 Main Function File The main function file for MATLAB solves the one period problem for the regional model It is a non linear system of 38 equations and variables function z energysect variables 1 1 1 2 1 3 1 4 1 5 Fh2 y 1 6 Fh3 y 1 7 1 y 1 8 Fe2 y 1 9 Fe3 y 1 10 r y 1 11 w 1 12 Pe y 1 13 Ph 1 14 Pel y 1 15 4 y 1 16 5 1 17 1 1 18 2 1 19 Exp3 1 20 1 1 21 104 2 1 22 TCe3 y 1 23 TCh1 y 1 24 TCh2 y 1 25 TCh3 y 1 26 1 1 27 2 1 28 3 1 29 1 1 30 2 1 31 3 1 32 Fh4 1 33 1 34 TCh4 y 1 35 short El y 1 36 short H y 1 37 imports y 1 38 capital 1 1 1 1 2 2 1 3 1 4 k4 cap 1 5 k5 cap 1 6 parameters gam1 par 1
47. in the right direction In the case of positive causality the arrow head should be marked with sign Vensim Unnamed TI File Edit View Layout Mode bc Q Arow After successfully connecting all the variables the causal loop diagram as in Figure 2 5 should be obtained Polarity of causal relationships determines the sign of the feedback loop Sterman 2000 Potential Land conversion coustomer Actual customers Figure 2 5 Causal loop diagram the negative feedback loop 18 b 1 Model development in Vensim Before going further the user should be able to distinguish between stock and flow variables detailed description is available in Ventana Systems 2010 and Sterman 2000 2 Forthe development of simulation model stock and flow diagram it s better to start with a new model as casual loop diagram is not a simulation model It only helps to formulate the model structure If the casual loop diagram is mixed with the model simulation file the error message could appear 3 Select the model setting window to define the computational time step and simulation time horizon Figure 2 6 Model Settings use Sketch to set initial causes Time Bounds Info Pswd Sketch Units XLS Files Ref Modes Time Bounds for Model Date Display INITIAL TIME 0 Label Date FINAL TIME 100
48. is very high 53 5 SIMULATIONS OF POLICY SCENARIOS 5 1 Scenario 1 Increase in Water Use The introduction of Scenario 1 is presented in Section 3 3 1 of this Manual Here we present the procedure for implementing Scenario 1 in ANEMI simulations 5 1 1 Scenario 1 Analysis With Global ANEMI Model 1 Open the ANEMI model Global model mdl using Vensim software 2 Select the Water Demand sector view Figure 5 1 to implement the scenario by pressing page up or Page Down key of the key board bal_model_start1980_all discovery at the begining_taxpolicy mdl Var Carbon Tax ON 2 4 Bue 27757 1 iu Bwe Indutrial Industrial Sm Consumption Withivent 1 lt Ware Figure 5 1 View the water demand sector 3 Select equation button first and then click the percent increase water demand parameter to insert 15 Experimentation can be done by selecting other values too 4 Select the starting year for this policy scenario in Implementation Year option For the purpose of this demonstration select 2015 as the Implementation Year 54 5 1 2 Save the model with a suitable name and close the Vensim program and Follow steps presented in Section 4 3 2 for running ANEMI global model to complete the simulation of Scenario 1 Scenario 1 Analysis With ANEMI Regional
49. lt Time gt from land yield tech COYM lt 4981 Food production Hide Times New Roman _ 12 914 Figure 3 6 View of the food production sector 27 A 1980 base tax LARRY BE i 9 EW 2 Turn On Climate Climate Sector 5 Terrestrial Atm Effects on Water um 4 Ek CQ init Terrestrial Atm Temperature Precipitation lt emperature Feedback Multiplier Terrestrial Current Ocean Temperat Advection Marine Atm Snow 27 Total Precip m Temperature Base Precipitation un Feedback Multiplier Rain over oceans fo 1 Temperature 27 Feedback DN Evaporation from Reservoirs Stream Flow Init Oceans Reservoir Expansion T Stable and Useable seston E Runoff Percentage init Groundwater Available Surface Water Time Total Renewable Percolation Discharge lt gt 4981 Water Quantity Hide Times New 12 b i u s 914 Figure 3 7 View of the hydrologic cycle sector ncentration Model Tools Windows
50. per tonne of CO over next 30years In the ANEMI model the Scenario 3 is created by assigning the following values to different input variables Figures 3 to 3 Carbon Tax 1 1 tax Starts from the year 2012 with an increment rate of 0 02218 until it reaches to 0 6654 in the year 2041 and then continues with the same fixed value which is 100 per tonne of Tau 2 tax Starts from the year 2012 with an increment rate of 0 01742 until it reaches to 0 5226 in the year 2041 and then continues Tau3 tax Starts from the year 2012 with an increment rate of 0 01246 until it reaches to 0 3739 in the year 2041 and then continues Select values for Tau1 tax Tau2 tax and Tau3 tax as they represent the carbon tax for Coal Oil and NaturalGas respectively In this demonstration equivalent amount of tax is implemented based on the emission intensity from each unit of fossil fuel However user can implement any type of tax policy 36 Graph Lookup Tau1 tax Import Vals X min 1880 x 2061 y 0 02632 OK Clear Points Clear All Points Clear Reference Look up table for coal based carbon tax rate input Graph Lookup Tau2 tax 4523 4703 Import 1980 gt x 1977 0 1053 21 00 Scaling Points Clear Points Cur gt R
51. to be used by the function int num arg the number of arguments in Vensim the function takes note that for user loop functions this will be one less than the number of arguments the function actually takes on int num vector the number of arguments that are passed as real number vectors int func index a number between 0 and 254 that identifies the function vensim external is called with this number int dim act reserved for doing dimensional analysis but not implemented int modify a flag to indicate that the function will modify value that are passed to it O is a normal function that does not modify its argument 1is a function that does modify arguments 2 is a function that modifies arguments and serves as a solver of a simultaneous set of conditions as FIND ZERO int num loop the number of loops that are managed by the function this is nonzero normally 1 or 2 for a function that needs to return a vector or matrix of values if this is nonzero Vensim will put a pointer to the vector or array to be filled in and pass it as the first argument to the function NOTE use 1 for a constdef function and 2 for a datadef function int num literal the number of literals that are passed to the function arguments are always passed in the order literals lookups vectors numbers if num loop is set the first argument is a vector even if num literal is positive int num lookup the number of
52. 1 par 1 1 gam2 par 1 2 gam3 par 1 3 b1 par 1 4 78 62 1 5 b3 par 1 6 Pfz1 par 1 7 Pfz2 par 1 8 Pfz3 par 1 9 PR1 par 1 10 PR2 par 1 11 PR3 par 1 12 Rz1 par 1 13 Rz2 par 1 14 Rz3 par 1 15 alpha par 1 16 beta par 1 17 gamma par 1 18 rho par 1 19 theta par 1 20 At par 1 21 OMt par 1 22 L par 1 23 a4 par 1 24 a5 par 1 25 b4 par 1 26 1 par 1 27 mu2 par 1 28 kap3 par 1 29 eta_e par 1 30 eta_h par 1 31 om par 1 32 Ael par 1 33 79 1 34 tau1 par 1 35 tau2 par 1 36 tau3 par 1 37 nh weight 0 25 96 Energy economy 2 1 exp Y OMt At K alpha L beta exp E 1 alpha beta z 2 alpha L exp w beta K exp r z 3 alpha exp E exp Pe 1 alpha beta K exp r 2 4 exp Y tau1 exp Fe1 exp Fh1 tau2 exp Fe2 exp Fh2 tau3 exp Fe3 exp Fh3 exp r K exp w L exp Pe exp E Aggregation of energy services 2 5 exp E gamma exp Eh theta 1 gamma exp El theta 1 theta 2 6 gamma exp Pel exp El 4 1 theta 1 gamma exp Ph exp Eh 1 theta 2 7 exp Pe exp E exp Ph exp Eh exp Pel exp El Electricity production 2 8 exp El Ael exp a1 exp Fe1 eta e exp a2 exp Fe2 eta exp a3 exp Fe3 eta nh weight exp e4 eta nh weight exp e5 eta e 1
53. 1 k lu_decomposition tempmat n indx amp d scratch if d 0 0 for j 0 j lt n j for i 0 i lt n i 1 COMPREAL O O col j COMPREAL 1 0 lu back substitution tempmat n indx col for i 0 i lt n i invmat i n j col i if d 0 0 return matrix for i 0 k 0 i lt n i for j 0 j lt n j k COMPREAL O O invmat 0 return first element return rval void lu decomposition COMPREAL n int indx COMPREAL d COMPREAL vv int i j k imax COMPREAL big dum sum 4 COMPREAL 1 0 for i 0 k 0 i lt n i big 0 for j 0 j lt n j k 131 if a k gt big big a k else if a k O amp amp a k gt big big alk if big 0 0 COMPREAL O O return COMPREAL 1 0 big for j 0 j lt n j for i 0 i lt j i sum 1 for k 0 k lt i k sum a i n k a k n j a i n j sum big 0 for i j i lt n i sum 1 for k 0 k lt j k sum a i n k a k n j ali n j sum dum w i sum if dum lt 0 0 dum dum if dum gt big big imax for k 0 k lt n k dum a imax n k a j n k dum d vv imax indx j if a j n j 0 0 a j n j TIN
54. 1 mu2 exp FC4 exp short_H b4 exp Fh4 4 eta_h 1 exp TCh4 96 Nuclear and hydro electricity production 2 17 exp e4 a4 2 18 exp e5 a5 Fuel prices 2 19 exp FC1 tau1 Pfz1 PR1 exp Fe1 exp Fh1 Rz1 rho z 20 exp FC2 tau2 Pfz2 PR2 exp Fe2 exp Fh2 Rz2 rho 2 21 exp FC3 tau3 Pfz3 PR3 exp Fe3 exp Fh3 Rz3 rho 96 Total cost functions for electricity 2 22 exp TCe1 exp r k1 exp Fe1 exp FC1 2 23 exp TCe2 exp r k2 exp Fe2 exp FC2 2 24 exp TCe3 exp r k3 exp Fe3 exp FC3 96 Total cost functions for heat energy 2 25 exp TCh1 exp Fh1 exp FC1 2 26 exp TCh2 exp Fh2 exp FC2 2 27 exp TCh3 exp Fh3 exp FC3 2 28 exp TCh4 exp Fh4 exp FC4 81 96 CES weights for electricity production 2 29 1 1 om gam1 exp Fe1 k1 2 2 30 exp a2 1 om gam2 exp Fe2 k2 2 2 31 exp a3 1 om gam3 exp Fe3 k3 2 2 32 exp Fe1 1 eta e exp a1p exp a1 eta e 2 om exp Fe1 k1 2 2 33 exp Fe2 1 eta e exp a2p exp a2 eta e 2 om exp Fe2 k2 2 2 34 exp Fe3 1 eta e exp a3p exp a3 eta e 2 om exp Fe3 k3 2 Alternative Heat Energy Price Function 2 35 exp FC4 mul exp Fh4 mu2 Short hand expressions 2 36 exp short eta 1 1 exp a2 exp Fe2 eta e exp
55. 1166542617 2 86752553959320 4 11858835525487 1 73956526748421 0 338954447781766 2 23409190763535 2 28985770205577 3 60298287203739 3 40364624800653 2 68549220816011 4 43877201412756 4 66470 844434739 4 25209931331017 2 31939186808372 6 57149118139387 2 05665554767744 0 341023310827887 5 50885453934179 6 82192669034317 6 62260568833010 1 58600226800754 0 987779581613031 1 83169529110752 cap 35 0 655 0 188 0 080 0 352 0 823 eng eng mat 1 par mat 1 cal fval flag fsolve energysect cal 0 cal options1 par cap eng if flag 1 cal fval flag2 fsolve energysect cal xout cal options2 par cap eng end y exp xout cal 72 x0 xout cal 1 1 37 XO xout cal outmat 1 y par check 1 par 20 30 cal 1 1 37 par ff 1 9 1 28 1 31 1 1 6 cal 1 38 43 fval flag fsolve energysect glb zo zo options1 par ff cap if flag 1 zo fval flag fsolve energysect zo options2 par ff cap end zo xt 20 for i 1 n filename z out txt mmfile 1 while mmfile 1 pause 5 mmfile fopen filename r end par fscanf mmfile e 1 341 cap fscanf mmfile e 1 61 fclose mmfile delete out txt eng eng_mat i par 1 35 37 par 1 1 3 if i lt 26 xout cal fval flag fsolve energysect gl
56. 3 vip and so on When downloading users must save all the files in the same directory and it is very important that user should not change the name of any file 2 1 5 Vensim Installation Installation of the software can be done from the provided CD or downloaded files Insert the CD into the computer and follow the installation dialog If there is any other previous version of Vensim installed then the user may see the screen as shown in Figure 2 1 If this dialog does not open user needs to double click on the program file setup exe on the installation CD r 3 Vensim DSS Version 5 10 Installation CN Welcome to Vensim DSS DblPrec Setup This program will install Yensim DSS DblPrec on your computer along with supporting files The installation of Vensim DSS DblPrec will not make any changes ta existing programs To uninstall Vensime DSS run uninstall from the control panel Installation and use ofthe Vensim DSS DblPrec Software subjectto the terms of a license agreement which will appear after you click on Next gt Copyright 1986 2002 Ventana Systems Inc Vensim is covered by US Patents 5 428 740 and 5 446 652 Vensim and Ventana are registered trademarks of Ventana Systems Inc 0 4 Figure 2 1 Initial Vensim installation screen From the Installation Choices dialog select the program that needs to be installed
57. 5 which represents the additional land conversion from forest to agricultural land by 1596 Figure 5 5 Editing equation for Matrix Multiplier for Landuse Change Matrix Multiplier for Landuse Change j q 0 0 0 0 0 0 0 0 0 0 0 0 Undo 7 8 9 Variables Subscripts Functions onstant 25 iod 415161 Choose Variable Inputs Normal 52 Supplementary Group global node Range Go To Prev Next Hilitd Sel New Errors Equation Modified Check Syntax Check Model Delete Variable Cancel Figure 5 5 Option view to choose land transformation rate 58 5 2 2 Modify Land transformation multiplying year For the purpose of this demonstration year 2015 in Land transformation multiplying year is selected as the policy implementation year Save the model with a suitable name and close the Vensim program Carry out the simulation following the procedure presented in Section 4 3 2 for simulating the global version of ANEMI model Scenario 2 Analysis With Regional ANEMI Model Open the Global version of ANEMI model which runs Scenario 2 to copy the simulated results of Price of fossil fuel from the Energy Economy sector Export the values of Price of fossil fuel variable to Microsoft Excel Open the Energy Economy view of the regional version of the ANEMI model Import the fossil fuel price from the Excel file with global fuel price for Coal
58. ACKNOWLEDGEMENTS We are grateful for the support of NSERC Natural Sciences and Engineering Research Council of Canada through its Strategic Research Grant to Professor Slobodan P Simonovic and his collaborators which funded development of the ANEMI model We are also grateful for the input provided by the representatives of the federal Departments of Environment Finance Natural Resources Fisheries and Oceans and Agriculture who were research partners in this work 5 ACKNOWLEDGEM 5 7 UST 91441618 is 1 ABOUT 1 11 INTRODUCTION 1 1 2 Organization of the 3 2 em 5 2 1 5 2 1 1 bli 5 2 12 9 SOUS e M S 5 2 1 3 Tab Dialog 5 2 1 4 E 6 2 1 5 Vensim Installation 6 2 1 6 Registration 8 2 2 Main Features of ee 8 2 2 1 Mum 9 2 2 2 MOOI 9 2 2 3 10 2 2 4 80 TOONS sees sich vs vase 10 2 2 5 Status
59. FUNC 7 define MYLOOKUP_FUNC 8 define MYALLTYPES_FUNC 9 define MYCONSTDEF_FUNC 10 define MYDATADEF_FUNC 11 define MY_FUNC 12 define ARRAY_READ 13 define N 32 before it was 26 CETERA SE RELA EROR IE 2 function prototypes each external function is prototyped here arguments can reasonably be doubles for normal number manipulation COMPREAL for vector manipulation or int for indexing Recasting of values takes place in Note that if you use more than 1 file for the external function definitions you should probably put these prototypes into a include file Also for working with compiled simulation include file is helpfule and should be nested into vensim h Note that all the external functions are all upper case This is required if you want to use compile simulations since the calls in mdl c will be upper case Our apologies to those this offends double writing double a1 double a2 double a3 double a4 double a5 double a6 double a7 double a8 double a9 double 10 double a11 double a12 double a13 double a14 double a15 double a16 double a17 double a18 double a19 double a20 119 double a21 double 22 double 23 double a24 double 25 double 26 double a27 double 28 double a29 double a30 double a31 double a32 double
60. Fossil fuel 4 oe Emissions Historical Natural Gas based Emissions Historical Cement and Gas Flaring Emissions Historical Total Emissions 4 Carbon Emissions from Cement Production and Natural Gas Flaring Gt C yr Emissions from Non energy Cement Production Emissions value Ti we Emissions n Total Land Gas Flaring Conversion a 4 lt gt Emissions Hide New Roman 1215 Figure 3 12 View of the emission subsystem 30 Vensim Global model start1980 new4 mdl Var Atmospheric CO2 Concentration View Layout Model Tools Windows Help amp 1 1880 tax Ps ke BASSO ih B gt 2 for fossil 2 e Doc r ahead time initia capital for electricity producti Parameter 2 m Turn On Future discovery C coal consumption Discovery fr coal emission fiom electricity produced Po coal discovery climate from Nuclear a change in output 0 36200 Oil reserve in GI oil consumption emission Surface Temperature reserve from
61. L col intn COMPREAL invmat mat1 validate the last two dimensions are same on both and also the same if not issue an error message and cause a floating point exception to give more info about the error 1 0 if v_invmat gt dim_info gt tot_dim lt 2 gt dim lt 2 1 else n v_invmat gt dim_info gt dim v_invmat gt dim_info gt tot_dim 1 130 if n int v_invmat gt dim_info gt dim v_invmat gt dim_info gt tot_dim 2 n int v_mat1 gt dim_info gt dim v_mat1 gt dim_info gt tot_dim 1 n int v_mat1 gt dim_info gt dim v_mat1 gt dim_info gt tot_dim 2 i 1 invmat v_invmat gt vals v mat1 vals if i vensim error message VERROR Matrix inversion can only be preformed on square arrays in last two dimensions v_invmat gt vals 0 COMPREAL O O return 1 0 invmat 0 cause a floating point exception gt Matrix invert maxn if Matrix_invert_maxn tempmat COMPREAL vext_allocate n n sizeof COMPREAL n 2 sizeof COMPREAL sizeof int amp scr_hndl else tempmat COMPREAL vext_reallocate n n sizeof COMPREAL n 2 sizeof COMPREAL sizeof int amp scr_hndl Matrix_invert_maxn n scratch tempmat n n col scratch n indx int col n first copy the matrix to its inverse then work on inverse for i 0 k 0 i lt n i for j 0 j lt n j k mat
62. M Vensim Ventana 2010 is visual system dynamics simulation modeling tool which allows user to conceptualize document simulate analyze and optimize models of dynamic systems Vensim provides a simple and flexible environment for building simulation model from the causal loop diagram as well as presenting it using stock and flow diagram By connecting words with arrows relationships among system variables are entered and recorded as causal connections The model can be analyzed throughout the building process looking at the causes and uses of a variable and also looking at the loops involving a variable After completion of the model development the model can be simulated and user can thoroughly explore the behaviour of the model 2 1 Vensim Basic Information 2 1 1 Directories The typical installation path for Vensim is C Program Files Vensim models However the user can install Vensim software at any location When working with the model it is strongly recommended that the Vensim subdirectory be avoided in this case C Program Files Vensim 2 1 22 Screen Shots There is difference in the appearance of Vensim PLE PLE Plus Standard Professional and DSS software versions All the pictures screen views in this manual are extracted from the Vensim DSS and default Toolsets Ventana Systems 2010 2 1 3 Tab Dialog Boxes Tab Dialogs are special dialog boxes common for Windows 95 and later versions of Windows These dial
63. Model Regional version of ANEMI is focused on Canada and the detailed description is in Akhtar et al 2011 Regional version of the ANEMI model has a close links with the rest of the world through climate water and energy economy sectors Therefore some of the simulation results obtained from the implementation of global model are necessary for the simulation of the regional model Open the Global version of ANEMI model Scenario 1 to copy the Price of fossil fuel from the Energy Economy sector Select the price of fossil fuel variable and then press on Table button Export the content from the tabular view and paste it in Microsoft Excel Open the Energy Economy view of the regional version of the ANEMI model Regional Model mdl Import the respective fossil fuel price from the Excel file containing global fuel price for Coal Oil and NaturalGas Figure 5 2 55 bd do region model 1909 22 May withtax Et Bev wee of wntetime ratio sumR21t023 and sumRSto 10 Coal price M Oipice a fo 2 A 1 Natgas price m M dified oal t reserve GJ AMI 1 1 4 Chal 4 modified pace th tax 27 GJ
64. ON carbon tax for the regional version of ANEMI model 64 Figure 5 14 Look up table for Carbon Tax rate input in the regional version of ANEMI model 65 1 ABOUT THIS MANUAL The User s Manual is planned to assist the user in i understanding the ANEMI model structure and ii learning how to use the model for policy simulation ANEMI model is a research product and is not developed as a commercial software This manual contains a brief description of the main features of the Vensim system dynamics simulation software Ventana 2010 as well as integrated simulation optimization procedure developed by incorporating MATLAB MathWorks 2007 functionalities with Vensim system dynamics simulation With the help of Vensim and MATLAB software packages the user can use modify and or run the ANEMI models provided with the manual The step by step instructions are provided for using ANEMI model for policy simulation Advanced features of the ANEMI model such as subscripting arrays linking external functionality to implement optimization within simulation are presented using ANEMI simulation models as an example to accelerate the learning process This manual also contains a detailed description of DLL Dynamic Link Library file generation procedure by Visual Studio software package Microsoft 2008 The full description of the ANEMI model is provided in Akhtar et al 2011 available on the CD ROM 1 1 INTRODUCTION
65. REVIOUS REPORTS IN THE 5 5 138 LIST OF FIGURES Figure 1 1 Major intersectoral links of ANEMI 2 Figure 2 1 Initial Vensim installation screen 7 Figure 2 2 Installation choice dialog box 7 Figure 2 3 View of the workbench window nennen nnn nnn ness ananas 8 Fig re 2 4 Vensim eade net 13 Figure 2 5 Causal loop diagram the negative feedback loop 18 Figure 2 6 Vensim model setting window 19 Figure 2 7 Stock and flow 20 Figure 2 8 Equation editor 21 Figure 2 9 Time series plot of the number of actual customers 1 nennen 23 Figure 3 1 View of the carbon sector 25 Figure 3 2 View of the other gasses subsystem 25 Figure 3 3 View of the climate 26 Figure 3 4 View of the climate Nordhause subsystem 26 Figure 3 5 View of the land use 27 Figur
66. Y VAL if j Iz n 1 dum COMPREAL 1 0 a j n j for i j 1 i lt n i a i n j dum lu decomposition void lu back substitution COMPREAL n int indx COMPREAL b int COMPREAL sum 1 for i 0 i lt n i 132 ip sum b ip blip bli if ii 1 for j ii j lt i j sum a i n j b j else if sum sum for i n i gt 0 sum b i for j i 1 j lt n j sum a i n j b j sum a i n i lu back substitution double INTERNAL ROR double inval double time double minval double maxval int streamid double compute flag RORSTR double result npv range int granular inti for ror Internal ror fror ror ror ror gt next if ror gt streamid streamid break if ror RORSTR vext_allocate sizeof RORSTR 0 ror gt streamid streamid ror gt maxtimes 101 ror gt times COMPREAL vext allocate ror maxtimes sizeof COMPREAL amp ror times hndal ror gt vals COMPREAL vext allocate ror maxtimes sizeof COMPREAL amp ror vals hndl ror gt next Internal ror fror ror ntimes 0 Internal ror fror if compute flag lt 0 0 ror gt ntimes 0 if compute flag 0 0 return 0 0 while ror gt ntimes gt 0 amp amp ror gt times ror gt ntimes 1 gt time ror ntimes back up if necessary if ror gt n
67. a3 exp Fe3 eta nh weight exp e4 eta nh weight exp e5 eta 2 37 exp short b1 exp Fh1 eta b2 exp Fh2 eta h b3 exp Fh3 eta h b4 exp Fh4 eta 82 Calibration Function File The calibration function file for MATLAB solves the one period problem for the global model and matches the historical trend for fossil fuel consumption in heat energy and electricity production function z energysect glb cal y par cap eng variables 1 1 1 2 1 3 El y 1 4 1 1 5 Fh2 y 1 6 Fh3 y 1 7 1 1 8 2 1 9 Fe3 y 1 10 y 1 11 w 1 12 y 1 13 1 14 Pel y 1 15 e4 1 16 5 1 17 1 1 18 2 1 19 1 20 1 y 1 21 2 1 22 TCe3 y 1 23 TCh1 y 1 24 TCh2 y 1 25 TCh3 y 1 26 al 1 27 a2 1 28 1 29 1 1 30 2 y 1 31 3 1 32 Fh4 1 33 FC4 1 34 TCh4 1 35 short El 1 36 short H y 1 37 y 1 38 gam2 y 1 39 y 1 40 b1 1 41 62 1 42 63 1 43 capital 1 1 1 1 2 2 1 3 1 4 k4 1 5 5 1 6 84 96parameters Pfz1 par 1 7 Pfz2 par 1 8 Pfz3 par 1 9 1 par 1 10 PR2 1 11
68. a33 double a34 double a35 double a36 double a37 double writing double a1 double a2 double a3 double a4 double a5 double a6 double a7 double a8 double a9 double 10 double 11 double a12 double a13 double a14 double a15 double a16 double a17 double a18 double a19 double 20 double a21 double a22 double a23 double a24 double a25 double a26 double a27 double a28 double a29 double a30 double a31 double a32 double a33 double a34 double a35 double a36 double a37 double a38 double a39 double a40 double 41 double COSINE double x double read double x double readmat double x double INRANGE double norm double minval double maxval double PSUM VECTOR ARG vec double num arg int maxarg double MATRIX INVERT VECTOR invmat VECTOR mat1 double MATRIX INPLACE INVERT VECTOR mat1 double INTERNAL ROR double inval double time double minval double maxval int streamid double do compute double MYMESSAGE const char message double time double MYFINDZERO VECTOR ARG x VECTOR ARG y int narg double MYLOOKUP TAB TYPE tab double x double MYALLTYPES VECTOR Ihs const char literal TAB TYPE tab VECTOR vecarg double x double MYCONSTDEF CONSTANT MATRIX cmat const char literal double MYDATADEF DATA MATRIX dmat const char literal void fcn int float float float Solve Sys of Nonlinear Equations int index float float par2 float par3 float
69. acility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 51 pages ISBN print 978 0 7714 2667 4 online 978 0 7714 2668 1 22 Evan G R Davies and Slobodan P Simonovic 2008 An integrated system dynamics model for analyzing behaviour of the social economic climatic system Model description and model use guide Water Resources Research Report no 059 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 233 pages ISBN print 978 0 7714 2679 7 online 978 0 7714 2680 3 23 Vasan Arunachalam 2008 Optimization Using Differential Evolution Water Resources Research Report no 060 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 42 pages ISBN print 978 0 7714 2689 6 online 978 0 7714 2690 2 140 24 Rajesh Shrestha Slobodan P 5 2009 A Fuzzy Set Theory Based Methodology for Analysis of Uncertainties in Stage Discharge Measurements and Rating Curve Water Resources Research Report no 061 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 104 pages ISBN print 978 0 7714 2707 7 online 978 0 7714 2708 4 25 Eum Vasan Arunachalam and Slobodan P Simonovic 2009 Integrated Reservoir Management System for Adap
70. adds an existing model variable and the causes of that variable to the sketch view e Shadow Variable adds an existing model variable to the sketch view as a shadow variable without adding its causes e Merge merges two variables into a single variable merges Levels onto existing clouds merges Arrows onto a variable to split an Arrow and performs other operations e Input Output Object adds input sliders and output graphs and tables to the sketch e Sketch Comment adds comments and pictures to the sketch Unhide Wand unhide makes visible variables a sketch view e Wand hides variables in a sketch view e Delete deletes structure variables in the model and comments in a sketch e Equations create and edit model equations using the Equation Editor 11 2 2 5 Status The status bar shows the state of the sketch and objects in the sketch The status bar contains buttons for changing the state of selected objects and moving to another view View 1 Hide Times New Roman 1216 ilu lt 2 2 8 E A number of sketch attributes can be controlled from the status bar including e Change characteristics on selected variables font type size bold italic underline strikethrough e Set the hide level e Variable colors box color surround shape text position arrow color arrow width arrow polarity and etc e When using the Text Editor Vensim Professional and DSS
71. ag vect zeros 1 n x0 ones 1 3 par 1 10 12 1 10 12 99 vdg fsolve vedge 0 options2 par eng 1 41 43 par 1 10 12 vdg par 1 13 15 par 1 38 40 par 1 7 9 1 par 1 19 cal flag fsolve energysect cal options1 par cap eng if flag 1 cal fval flag2 fsolve energysect cal cal options2 cap eng end for j 1 3 if par 1 40 j 0 1 404 0 y exp xout cal y 1 18 20 log y 1 18 20 1 38 log y 1 38 x0 xout cal 1 1 38 cal xout cal outmat 1 y XO cal int xO cal for iz1 n filename out txt mmfile 1 while mmfile 1 pause 5 mmfile fopen filename r end par 1 1 34 fscanf mmfile e 1 341 1 35 40 1 1 6 cap fscanf mmfile e 1 6 fclose mmfile delete out txt if i 1 100 eng eng mat 1 res mat 1 1 10 12 vdg fsolve vedge 0 v options2 par eng par 1 41 43 res mat 1 vdg par 1 13 15 par 1 38 40 par 1 7 9 1 par 1 19 elseif i lt 26 eng eng_mat i par 1 10 12 res_mat i vdg fsolve vedge 0 v options2 par eng 1 41 43 res_mat i vdg par 1 13 15 par 1 38 40 par 1 7 9 1 par 1 19 else vdg 1 1 vdg_mat i 1 1 1 1 00 vdg_mat i 1 1 vdg_mat i 2 1 vdg_mat i 2 1 v
72. ainty Water Resources Research Report no 073 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 143 pages ISBN print 978 0 7714 2894 4 online 978 0 7714 2901 9 37 Angela Peck Elisabeth Bowering and Slobodan P Simonovic 2010 City of London Vulnerability of Infrastructure to Climate Change Final Report Risk Assessment Water Resources Research Report no 074 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 66 pages ISBN print 978 0 7714 2895 1 online 978 0 7714 2902 6 38 Akhtar M K S P Simonovic J Wibe J MacGee and J Davies 2011 An integrated system dynamics model for analyzing behaviour of the social energy economic climatic system 142 model description Water Resources Research Report 075 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 211 pages ISBN print 978 0 7714 2896 8 online 978 0 7714 2903 3 143
73. artment of Civil and Environmental Engineering London Ontario Canada 91 pages ISBN print 978 0 7714 2606 3 online 978 0 7714 2607 0 2 Predrag Prodanovic 2001 Fuzzy Set Ranking Methods and Multiple Expert Decision Making Water Resources Research Report no 039 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 68 pages ISBN print 978 0 7714 2608 7 online 978 0 7714 2609 4 3 Nirupama and Slobodan P Simonovic 2002 Role of Remote Sensing in Disaster Management Water Resources Research Report no 040 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 107 pages ISBN print 978 0 7714 2610 0 online 978 0 7714 2611 7 4 Taslima Akter and Slobodan P Simonovic 2002 A General Overview of Multiobjective Multiple Participant Decision Making for Flood Management Water Resources Research Report no 041 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 65 pages ISBN print 978 0 7714 2612 4 online 978 0 7714 2613 1 5 Nirupama and Slobodan P Simonovic 2002 A Spatial Fuzzy Compromise Approach for Flood Disaster Management Water Resources Research Report no 042 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 138 pages ISBN prin
74. ate Price of aggregate energy services Price of heat energy services Price of electricity services electricity produced from nuclear power electricity produced from hydro power Price of coal Price of oil Price of natural gas Total cost of electricity produced from coal Total cost of electricity produced from oil 95 1 TCh2 TCh3 al a2 a3 alp a2p a3p Fh4 FC4 TCh4 short El short H imports Total cost of electricity produced from natural gas Total cost of heat energy produced from coal Total cost of heat energy produced from oil Total cost of heat energy produced from natural gas CES weight for coal CES weight for oil CES weigth for natural gas Short hand term for CES weight calculation for coal Short hand term for CES weight calculation for oil Short hand term for CES weight calculation for natural gas Alternative heat energy GJ Price of alternatie heat energy Total cost of heat energy produced from alternative energy Short hand term for electricity calculations Short hand term for heat energy calculations Net Imports of the generic consumption good 96 List of Parameters gam1 gam2 gam3 61 62 63 64 Pfz1 Pfz2 Pfz3 1 2 Rz1 Rz2 Rz3 alpha beta gamma rho theta At OMt Parameter for CES weight function for coal Parameter for CES weight function for oil Parameter for CES weight function for natural gas CES weight for coal CES weight for oi
75. ating point are passed and return doubles to prevent any compiler specific problems from arising CFUNCTION int VEFCC vensim external VV val int nval int funcid double rval int n n2 switch funcid case COS FUNC simple function call with double return double read val 0 val break case MY FUNC rval writing val 0 val val 1 val val 2 val val 3 val val 4 val val 5 6 7 8 9 val val 101 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 val 31 32 33 34 35 36 37 38 39 40 case INRANGE FUNC simple function rval INRANGE val 0 val val 1 val val 2 val break case PSUM FUNC n int val 1 val 5 n and n2 are rounded to integers n2 int val 2 val 5 first argument is a vector note the importance of telling Vensim how many arguments should be passed by address if you attempt to use a floating point numb
76. ation the improvement in the results is obtained by cutting the integration period in half and evaluationg if the result changes Ventana Systems 2010 for example change the time step from 0 03125 to 0 015625 If the model behaviour matches between the two simulations the original time step is acceptable however if there is any change in behaviour then the integration step should be cut further in half 0 0078128 and so on If after using a small time step simulation results mismatch then the user is advised to switch to 16 2 4 This section will illustrate how system dynamics based simulation model can be developed with Vensim software 2 4 1 Problem Description and Solution Problem Consider a small subdivision of London that is growing in population Land available for housing development is obtained by converting the agricultural land into urban The total available agricultural land is limited and can support the growth up to a certain level With more potential home customers in the subdivision land conversion from the available agricultural land will increase With more land converted the more actual home customers there will be However the higher land conversion brings awareness that the available agricultural land is limited and that inversely affects potential home customers The more land converted reduces the available agricultural land and makes less urban land available for new ho
77. b cal cal options1 par cap eng if flag 1 cal fval flag2 fsolve energysect cal xout cal options2 par cap eng end y exp xout cal x0_cal xout_cal 0 cal 1 1 37 outmat i y end if i lt 26 par 1 1 6 outmat 38 43 i else par 1 1 6 outmat 38 43 i 1 1 0 95 outmat 38 43 i 1 outmat 38 43 i 2 outmat 38 43 i 2 end par check i par check i cap if count2 gt 1 exp x0 1 9 lt 0 015 par ff 1 1 0 015 par ff 1 2 outmat 28 i 1 ff 1 3 outmat 31 i 1 xt fval flag fsolve energysect glb zo x0 options1 par ff if flag 1 xt flag fsolve energysect 10 0 options2 par ff cap end y exp xt outmat 1 37 i y outmat 38 43 i par 1 1 6 count2 2 1 else x0_mat i xout fval flag fsolve energysect 0 options1 par if flag 1 xout fval flag fsolve energysect glb options2 par end 74 yzexp xout xO xout x0 x0 1 ff y 1 9 y 1 28 y 1 31 xt flag fsolve energysect glb 20 0 options1 par ff cap if flag 1 xt flag fsolve energysect zo options2 par ff end yt exp xt outmat 1 37 i yt outmat 38 43 i par 1 1 6 end flag vect 1 i
78. ch Variable and its causes or uses 2 2 10 Other Tools Units Check provides an alternative way to access the units check feature 14 Equation Editor provides an alternative way to access the equation for the Workbench Variable Venapp Editor supports the visual editing of Venapps fico Text Editor a general purpose text editor Further details about model views are available in the Vensim User s Guide version10 Ventana Systems 2010 which is distributed with the software 2 3 Numerical Integration Technique The integration technique is the method that Vensim uses to advance a model in time In software package like Vensim DSS actual computation of simulation requires numerical integration Several different types of numerical integration are available Euler Diff Runge Kutta4 auto Runge Kutta4 fixed Runge Kutta2 auto and Runge Kutta2 fixed techniques Ventana Systems 2010 Euler integration is the simplest and fastest numerical method but is less accurate than the Runge Kutta method Diff performs Euler integration but stores the values for Auxiliaries computed at the previous save time Regular Euler integration stores the values of Auxiliaries computed at the current save time Diff as its name suggests is intended primarily for difference equations where this reporting convention is often used Runge Kutta is modification of Euler integration that improves accuracy substan
79. cludes the Title Bar the Menu the Toolbar and the Analysis tools When Vensim model is open Figure 2 3 the Sketch Tools and the Status Bar also appear Title Bar Menu Main Toolbar Sketch Tools Vensim pop mdl Var Pop ation loj x File Edit view Layout Model Tools Winda s Help E alx 84 AR uent m m Doc deaths 918 Analysis Tools Status Sketch Drawing Area Figure 2 3 View of the workbench window The workbench variable is any variable in the model selected by the user The workbench variable is selected by clicking on a variable or by using the variable selection control in the control panel 2 2 1 Vensim Menu Many operations in Vensim can be performed from the menu File Edit View Layout Model Tools Windows Help gt gt The File menu contains common functions such as Open Save Print etc The Edit menu allows the user to copy and paste selected portions of the model The View menu has options for manipulating the sketch of the model and for viewing a model as text only available only in Vensim Professional and DSS The Layout menu allows user to manipulate the position and size of elements in the sketch The Model menu provides access to the simulation control and the time bounds dialogs the model checking features and im
80. ct Open from the File menu Figure 4 16 4 MATLAB 750 Edit Debug Distributed Desktop Window Help New Current Directory Open 811549 Close Command Window Import Data Save Workspace As Set Path Preferences Page Setup Print t Sel 1 bVenergysect 4 2 I obVenergysect 3 ob calibration 80 30 m 4 obVcalibration 80 05 m Exit MATLAB 9 Figure 4 16 View the File Menu in MATLAB 47 3 Navigate through newly created folder where all files supplied on the DVD are kept and select ensect solve file 4 Define the path to the working folder where all files from the DVD are stored in MATLAB environment Figure 4 17 4 MATLAB 7 Edit Debug Distributed Desktop Window Help 4 amp 8 9 d Y Current Directory I PhD Model DLL TestDIl TestDIl1 Shortcuts How to Add 7l What s New Figure 4 17 Place to define current directory path 5 Activate the Editor window where solve glb m is loaded To start the optimization initial time step works then MATLAB will create an in txt file for the Vensim model gt press the Run button from the Editor window Figure 4 18 If the optimization for the File Edit Text Go Cell Tools Debug Desktop Window Help 88 8 98 10 x I PhD M
81. ction and produces the solution to the one period energy economy model clear all tic options1 optimset FunValCheck on TolX 1 0e 9 TolFun 1 0e 9 MaxFunEvals 1 0e 9 Maxlter 0 051e 3 Display iter NonlEqnAlgorithm dogleg options2 optimset FunValCheck on TolX 1 0e 12 TolFun 1 0e 12 MaxFunEvals 1 0e 9 1 011 3 Display iter NonlEqnAlgorithm Im cal 4 08882001940707 0 477802471321497 1 38426580086723 2 43003911005965 0 230743656881343 1 06679573151687 0 279711343878389 1 45433621280950 3 38146807797842 4 12182604247513 0 347451630119205 1 14350553864074 1 97635532528274 2 32422647439778 1 78015055840188 1 83328793692455 0 0684980216000813 2 59497758980671 0 0611390618024763 2 22719517990958 1 56773148361856 3 13516025436419 4 20981366794375 1 20727187582513 0 533398961718562 1 38311945574640 0 698809043866189 2 07385907461717 1 53313088975904 0 635842215996799 3 05030256250949 2 867 66011154329 3 14436512203694 1 95809178328180 1 18627333875515 0 521872374469884 0 692132900433612 1 07418779215341 3 94053013691443 5 29795162282076 4 76014608768349 2 68363371516625 1 90339098334132 2 85895371745158 mat xlsread par values 2 xls cap xlsread cap values can 3 xls eng mat xlsread eng values can xls cap mat 1 eng eng mat 1 par par mat 1 n 121 time linspace 1 n 121 fl
82. d replace 0 by Type Constant Variables Subscripts Choose Variable Functions More Inputs Normal Supplementary 8 5 2 E Go To Prev Next global model Range tior Check Syntax Check Model Hilite 3e1 New Delete Variable Cancel Figure 5 10 Option view to turn ON carbon tax policy Select values for Tau1 tax Tau2 tax and Tau3 Coal Oil and NaturalGas respectively Figure tax as they represent the carbon tax for 5 11 In this demonstration equivalent amount of tax is implemented based on the emission intensity from each unit of fossil fuel However user can implement any type of tax policy 62 5 3 2 Graph Lookup tax Input Output 2009 0 0 0 02667 0 05333 v Import Vals 980 xl x 2092 y 0 06579 X max 21 00 Reset Scaling OK Clear Points Clear All Points Cur gt Ret Clear Reference Ref gt Cur Cancel Figure 5 11 Look up table for carbon tax rate input Save the model with a suitable name and close the Vensim program and Complete the simulation using the procedure presented in Section 4 3 2 for global ANEMI model Scenario 3 Analysis With Regional ANEMI Model Open the Global version of ANEMI model which runs Scenario 3 and c
83. dg 1 2 vdg_mat i 1 2 1 1 00 vdg_mat i 1 2 vdg_mat i 2 2 vdg_mat i 2 2 vdg 1 3 vdg_mat i 1 3 1 1 05 vdg_mat i 1 3 vdg_mat i 2 3 vdg_mat i 2 3 if vdg lt 0 01 vdg 0 01 end par 1 10 12 res_mat i 1 41 43 res mat i vdg par 1 13 15 par 1 38 40 par 1 7 9 1 par 1 19 end vdg_mat i vdg par_check i par for j 1 3 if par 1 40 j 0 par 1 40 j 0 end end if i lt 121 res mat i 1 res mat i 1 41 43 end if i lt 26 cal fval flag fsolve energysect cal can cal options1 par cap eng 101 if flag 1 xout cal fval flag2 fsolve energysect xout_cal options2 par cap eng end exp xout cal 1 18 20 log y 1 18 20 1 38 log y 1 38 XO cal xout cal x0 0 cal 1 1 38 outmat i y cal 1 fval end if i lt 26 par 1 1 6 outmat 39 44 i else par 1 1 6 outmat 39 44 i 1 1 0 95 outmat 39 44 i 1 outmat 39 44 i 2 outmat 39 44 i 2 end xout fval flag fsolve energysect x0 options1 par if flag 1 xout flag fsolve energysect xout options2 par end y exp xout y 1 18 20 log y 1 18 20 1 38 log y 1 38 x0 xout outmat 1 38 i y outmat 39 44 i par 1 1 6 par check 1 43 i par 1 1 43 fval_mat i fval vect 1
84. dl Var 0 14 age group File Edit View Model Tools Windows Help amp DAE ROW BE pe 8 0 ws BRA Ww the Sinuation tobe Mace Figure 4 24 Option view to define the name of simulation output file 13 Press the Run a Simulation button to start the computation Figure 4 25 and Vensim Global model 5 1980 new4 mdl Var 0 14 File Edi View Model Tools Windows Help amp amp ow BF be Wb Figure 4 25 View of the Run a Simulation option 14 After successful completion of a model simulation the results can be reviewed by selecting a particulate variable from the Dataset Analysis Tools menu bar Figure 4 26 If the user wants to see the graphical view of a variable then the Graph button should be selected In the same way the numerical values can be obtained by selecting the Table button 5 EP 5 Graph E Table a Figure 4 26 View the dataset analysis tools 51 Regional Version of the Model 1 10 For the regional model access Regional folder before carrying out the start of simulation process Open out back txt file and save it as out txt Start MATLAB program first and then select Open from the File menu Navigate through the newly created folde
85. e 3 6 View of the food production 00 1 iiia inan 27 Figure 3 7 View of the hydrologic cycle sector nennen nennen nnn nnn 28 Figure 3 8 View of the water demand 28 Figure 3 9 View of the water quality 29 Figure 3 10 View of the water stress 5 2 29 Figure 3 11 View of the population sector 30 Figure 3 12 View of the emission subsystem sssseessesssssessseeen nennen nennen nennen nsns naar nnn ness n an 30 Figure 3 13 View of the energy economy sector 2 2 11 aaa a aaa 31 Figure 3 14 View of the sea level 5 nensi sna 31 Figure 4 1 MATLAB installation option 39 Figure 4 2 MATLAB setup completion message 40 Figure 4 3 Installation option view of the Visual 5 41 Figure 4 4 View Of COPYING setup 41 Figure 4 5 Option view to share Visual Studio setup experience 41 Figure 4 6 View of the installation 42 Figure 4 7 Option view to import a file in Visual nnne 43 Figure 4 8 Solution explorer windOw
86. e 5 8 Option view to choose land use transformation rate regional ANEMI model 10 Change the Land transformation multiplying year 11 Save the model with a suitable name and close the Vensim program 12 Simulate Scenario 2 using procedure from the Section 4 3 2 for regional ANEMI model 5 3 Scenario 3 Carbon The introduction of the carbon tax scenario is presented in Section 3 3 3 of this Manual Here are the instructions for the implementation of the carbon tax scenario with the ANEMI model 5 3 1 Scenario Analysis With Global ANEMI Model 1 Select the Energy Economy view Figure 5 9 to implement the scenario 61 Vensien Global_ model slart1980_all discovery at the begining taxpolicy mdl Var Carbon Tax Fie Von Model Help d 900 new discovery at begini Fk PHF amp 9 M gt 3 gt T E E amp 559 of R21 and Ker fel i Im 22 Economy E Figure 5 9 View of the Energy Economy sector 2 Select the equation button first and then clic 1 to activate the carbon tax policy Figure 5 10 Editing equation for Carbon Tax Carbon ON the Carbon Tax an
87. ec 12 2010 67 APPENDIX ANEMI MODEL CODE MATLAB Global ANEMI Model List of Variables Y Eh El 1 Fh2 Fh3 1 2 4 5 2 1 Total output Aggregate energy services Heat energy services Electric energy services Coal used in heat energy production GJ Cil used in heat energy production GJ Natural gas used in heat energy production GJ Coal used in electricity production GJ Cil used in electricity production GJ Natural gas used in electricity production GJ Gross interest rate Wage rate Price of aggregate energy services Price of heat energy services Price of electricity services electricity produced from nuclear power electricity produced from hydro power Price of coal Price of oil Price of natural gas Total cost of electricity produced from coal 68 2 1 TCh2 TCh3 al a2 a3 alp a2p a3p Fh4 FC4 TCh4 short El short H Total cost of electricity produced from oil Total cost of electricity produced from natural gas Total cost of heat energy produced from coal Total cost of heat energy produced from oil Total cost of heat energy produced from natural gas CES weight for coal CES weight for oil CES weigth for natural gas Short hand term for CES weight calculation for coal Short hand term for CES weight calculation for oil Short hand term for CES weigh
88. ection of small programs which can be called upon when needed by the executable program EXE that is running The DLL lets the executable use a particular functions Introduction of the optimization with the ANEMI model requires a few specialized functions such as reading from an external file writing to an external file and so on Vensim DSS allows use of external functions by Vensim software through a Dynamic Link Library DLL Such external functions can later be used in Vensim same as a built in Vensim function 4 3 1 Steps for DLL file compilation 1 Copy TestDIl folder from the supplied DVD supplied with ANEMI model and paste it in the desired location 42 2 Open Visual Studio program and select File menu to open TestDLL sIn file using navigation buttons Figure 4 7 90 TestDIl Microsoft Visual Studio File Edit View Project Build Debug Tools Test Window Help New Debug Win32 Open 2 Project Solution Ctrl Shift O gt 25 Web Site Shift Alt O Close Close Solution Save VENEXT C 5 5 Save bs Ventana Systems Inc Figure 4 7 Option view to import a file in Visual Studio 3 Find the Solution Explorer window and double click on VENEXT C file Figure 4 8 2 amp Solution TestDII 1 project S 2 Header Files Resource Files amp
89. edure 4 1 1 MATLAB Installation Obtain the Personal License Password PLP that is required for the installation of MATLAB package Use the installation DVD and follow the MathWorks Installer dialogue Error Reference source not found Sotect Instat Weicome to the Mathifvorks installer Thes program will wstal the MATLAB Family of products R2007b LINKS Enter new Personai License Password PLP to update your cente without Al NN are protected US patents www matiworks comipatents Software unaufhiormed ute regeeduchen CISION may resutt n and the ana cae Click Next Figure 4 1 MATLAB installation option view Enter the user name organization name and Personal License Password PLP in the license information dialog box and select Next to continue In the Installation Type dialog box select between Typical or Custom installation and then click Next to continue When the MathWorks Installer finishes the whole installation process it displays the Setup Complete dialog box Figure 4 2 39 41 Chick Finish Figure 4 2 MATLAB setup completion message view 4 2 Visual Studio The ANEMI model requires a number of functions that are not available in Vens
90. ef Clear Reference 37 Graph Lookup Tau3 tax Output 0 2866 0 2991 0 3116 0 324 0 3365 0 349 2040 0 3614 0 3739 0 3739 0 3739 0 3739 2035 N G3 Go Go Cn 2043 2044 02866 E EE Vals 1980 1978 y 0 1535 2100 Reset Scaling DK Clear Points Clear All Points Clear Reference 4 OTHER SOFTWARE TOOLS The ANEMI version 2 model is developed in Vensim system dynamics simulation environment Vensim has a limited capability in handling optimization In order to accommodate the structure of the economy energy sector of the model optimization capability had to be introduced with thin the simulation model The MATLAB computer package MathWorks 2007 is integrated with Vensim to provide the optimization capability to the ANEMI model However other computer tools like Visual Studio Microsoft 2008 and Microsoft Excel are also used to facilitate the dynamic data exchange procedure between Vensim and MATLAB 4 1 MATLAB Computer Package 38 For the optimization of the sector the model needs the interaction between Vensim and MATLAB software in every simulation time step This section presents the MATLAB installation proc
91. eme type B5 component Vensim Global model start1980 mdi Var Mmospheric CO2 Concentration d news base tax gt 3 24 5 FP fuel 2 RF Radiative Forcing ee Rm CH4 stm come _ a c Qo come We path chem path ton par Mion sot per mol 3 CHA N20 wn 5 4 2 P amp CHA molar CH N20 M interaction EI L T Oxide 20 MN CO2 at A 20 2 P i Cl s and 00 y o CHA N20 inter m d CHE when cone initial N20 Tine cont fos N20 sath E Figure 3 2 View of the other gasses subsystem 25 model 1980 new4 mdl Var Atmospheric 02 Concentration Edt Model Tools Windows Hep 8 amp BB tang base tax Aare KA gt CV HOON CO2 Concentration Use a Constant COD from various
92. er as an address the function will not work rval PSUM val 0 vec n n2 break case FUNC note that this function is self looping and therefore Vensim has added in another argument to this function and this argument is passed by address Vensim passes all arrays as vectors the last subscripts varies the fastest in some cases you may also need to pass the size of the containing array if you are not operating on all elements rval MATRIX INVERT val 0 vec val 1 vec break case INPLACE INVERT FUNC the outgoing and returning matrix are the same but the same underlying C function is called n int val 1 val4 5 rval MATRIX INPLACE INVERT val 0 vec break 127 case INTERNAL FUNC n int val 4 val rval INTERNAL ROR val 0 val val 1 val val 2 val val 3 val n val 5 val break case MYMESSAGE FUNC rval MYMESSAGE val 0 literal val 1 val break case MYFINDZERO FUNC n int val 2 val 5 rval MYFINDZERO val 0 vec val 1 vec n break case MYLOOKUP MYLOOKUP val 0 tab val 1 val break case MYALLTYPES FUNC rval MYALLTYPES val 0 vec val 1 literal val 2 tab val 3 vec val A val break case MYCONSTDEF FUNC rval MYCONSTDEF val 0 constmat val 1 literal break case MYDATADEF FUNC rval MYDATADEF val 0 datamat val 1 literal break default return 0 indicate an error condition
93. er factors The energy economy sector is formulated on the basis of market clearance optimization The energy economy sector produces GDP energy production and fossil fuel based emissions Hydrologic cycle is represented as surface water sector in the ANEMI model which computes precipitation runoff groundwater flow and other components of the hydrologic cycle Water demand sector calculates the demand for agricultural domestic and industrial water uses Water quality sector deals with the physical and chemical characteristics of water based on the use and average pollution load that is coming from each type of water use domestic industry and agriculture Land Use Emissions Emission Arable Lang x Atmospheric Agricultural allocation Energy Economy Industrial emission Temperature Clearing and Burning Consumption and Labour 3 Temperature Water use efficiency GDP per capita Fertility Water use Intensity Water Wastewater Stress Wastewater Water Quality Treatment 2 3 Population j Was Denn m 7 Temperatur Figure 1 1 Major intersectoral links of ANEMI model A detailed description of the inter sectoral as well as intra sectoral feedback relationships is available in the main report Akhtar et al 2011 The ANEMI model is cal
94. ercent of deforestation for agricultural use Therefore the following modifications are required to implement the scenario 2 Figures 3 and Land transformation multiplying year 2015 Matrix Multiplier for Land Use Change 0 15 in place of j1q1 here 141 is the increased transfer rate of forest out of 1 value in percent 100 and the sign determines whether it s in losing side or gaining side In this case as the forest area is decreasing so 141 should be negative Editing equation Matrix Multiplier for Landuse Change Matrix Multiplier for Landuse Change j q 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Undo Variables Subscripts Functions More Constant 21401 Choose Variable Inputs Normal s Supplementary Help global node Range Prev Next Hilite New Check Syntax Check Model Delete Variable Cancel Figure 3 15 Option view to choose land transformation rate 3 3 3 Scenario 3 Carbon Tax Key Questions What are the impacts from implementing the carbon tax policy 35 In the energy economy sector the carbon tax is implemented tax per unit of emissions effectively raising the price of fossil fuel Under this experimentation the carbon tax policy is implemented in 2012 and then slowly ramped up to 100
95. ess The ANEMI version 2 model is tested following the three basic steps i Validation Checking the model behaviour by functional analysis and iii Checking the impact of feedback structure The ANEMI model is fully tested and above mentioned steps may be repeated only if the modifications are made to the model structure The main mode of model use by the user is through the implementation of various policy options what scenarios that can be created by changing choosing model input parameters Implementation of the carbon tax scenario could be a good example for the illustration of this process The user could easily modify the parameter of carbon tax policy in this model and track the consequences within few minutes after a successful model run User needs not to be restricted to simulation results within the energy economy sector but can analyze the behaviour of any variable within the model structure including all model sectors 32 3 3 Policy Development The ANEMI model can be used to analyze the consequences of different policy scenarios The policy could be related to energy price energy consumption water use water quality irrigation practice population dynamics land use change and much more issues which can be addressed by the analyses of nine model sectors ANEMI model structure allows for single or combined policy scenarios The following is description of policy development process and the implementatio
96. eta 29 exp Pel exp TCe1 exp TCe2 exp TCe3 exp r k4 exp r k5 exp El 2 10 1 exp FC1 tau1 exp Fe1 rho PR1 exp Fe1 exp Fh1 exp short 1 1 exp TCe1 exp FC2 exp FC2 tau2 exp Fe2 rho PR2 exp Fe2 exp Fh2 exp short El exp a2p exp TCe2 2 11 exp FC2 exp FC2 tau2 exp Fe2 rho PR2 exp Fe2 exp Fh2 exp short El exp a2p exp TCe2 exp FC3 exp FC3 tau3 exp Fe3 rho PR3 exp Fe3 exp Fh3 exp short exp TCe3 96 Heat energy production 2 12 exp Eh Ah b1 exp Fh1 eta b2 exp Fh2 eta b3 exp Fh3 eta b4 exp Fh4 eta h 1 eta 1 2 13 exp Ph exp TCh1 exp TCh2 exp TCh3 exp TCh4 exp Eh 80 2 14 exp FC1 exp FC1 tau1 exp Fh1 rho PR1 exp Fe1 exp Fh1 exp short H b1 exp Fh1 eta h 1 exp TCh1 exp FC2 exp FC2 tau2 exp Fh2 rho PR2 exp Fe2 exp Fh2 exp short H b2 exp Fh2 eta h 1 2 2 15 exp FC2 exp FC2 tau2 exp Fh2 rho PR2 exp Fe2 exp Fh2 exp short H b2 exp Fh2 eta h 1 exp TCh2 exp FC3 exp FC3 tau3 exp Fh3 rho PR3 exp Fe3 exp Fh3 exp short H b3 exp Fh3 eta h 1 exp TCh3 2 16 exp FC3 exp FC3 tau3 exp Fh3 rho PR3 exp Fe3 exp Fh3 exp short H b3 exp Fh3 eta h 1 exp TCh3
97. exp Fh3 exp FC3 2 28 exp TCh4 exp Fh4 exp FC4 CES weights for electricity production 2 29 exp a1 1 om gam1 exp Fe1 k1 2 2 30 par exp a2 2 31 exp a3 1 om gam3 exp Fe3 k3 2 z 32 exp Fe1 1 eta e exp a1p exp a1 eta e 2 om exp Fe1 k1 2 2 33 2 par 2 2 34 exp Fe3 1 eta e exp a3p exp a3 eta e 2 om exp Fe3 k3 2 96 Alternative Heat Energy Price Function 2 35 1 exp Fh4 mu2 96 Short Hand Expressions 2 36 exp short eta e exp a1 exp Fe1 eta a2 par fe2 par eta e exp a3 exp Fe3 eta e nh weight exp e4 eta nh weight exp e5 eta 2 37 exp short b1 exp Fh1 eta b2 exp Fh2 eta h b3 exp Fh3 eta b4 exp Fh4 eta 2 38 exp Fe2 fe2 par 94 Regional ANEMI Model List of Variables Y Eh 1 Fh2 Fh3 1 2 4 5 2 1 2 Total output Aggregate energy services Heat energy services Electric energy services Coal used in heat energy production GJ Oil used in heat energy production GJ Natural gas used in heat energy production GJ Coal used in electricity production GJ used in electricity production GJ Natural gas used in electricity production GJ Gross interest rate Wage r
98. f actual customers 23 3 MODEL 31 Model Organization and Mathematical Basis The ANEMI version 2 model captures interconnections between main elements of the complex society biosphere climate economy energy system like global surface temperature global CO concentration average annual surface flow population growth economic output energy consumption wastewater volume and others Akhtar et al 2011 The system dynamics models include two levels of model representation i diagrammatic representation of the causal connections that constitute the system under study and ii the mathematical basis of those connections in the form of equations Vensim allows the user to separate the model in many ways at the diagrammatic level This unique facility supports the ANEMI model structure nine model sectors are developed using multiple system dynamics diagrams Conceptually the sectoral view helps the user to focus on any specific sector by drawing boundaries around the processes of importance in that part of the model While looking at the integrated modelling structure it is not uncommon that the majority of variables in one sector are not relevant to the rest of the model and their number within an individual sector is generally significantly higher than the number of equations that connect different sectors Finally model division into subsystems separates the relevant from the irrelevant variables so that only key var
99. fline mode not recommended Backup file path no drive Tab Width for Text Editor Compiled simulation path Browse External function library ModeNDLLNTesiDINTestDIIWENSIM DLL B e Molecule library path Figure 4 14 Option view of External function library 9 Press OK to complete the process 4 3 2 Running Vensim and MATLAB Together The whole Model folder should be copied from the DVD supplied with the ANEMI model As Vensim and MATLAB are shearing some common files it is suggested to carry out the simulation and optimization work from the same folder In the model folder supplied with the ANEMI model the user will find all the required files text files Microsoft Excel files Vensim files and MATLAB files Modification of these files is not allowed The ANEMI model developers used a very specific way to set up the simulation optimization process which requires exact procedure to be followed Figure 4 15 46 9 out txt in txt S MATLAB S gt out txt 7 initial file Figure 4 15 Flow diagram of the file exchange process between Vensim and MATLAB Global Version of the ANEMI Model 1 Open out_back txt file and save it as out txt This step needs to be carried out always at the beginning of each simulation as all the initial values for the optimization scheme are kept in the out back txt file 2 Start MATLAB program first and then sele
100. follows below 2 2 8 Structural Analysis Tools bc Causes Tree creates a tree type graphical representation showing the causes of the Workbench Variable Uses Tree creates a tree type graphical representation showing the uses of the Workbench Variable Loops displays a list of all feedback loops passing through the Workbench Variable Document reviews equations definitions units of measure and selected values for the Workbench Variable 13 2 2 9 Dataset Analysis Tools Causes Strip Graph displays simple graphs in a strip allowing the user to trace causality by showing the direct causes as shown of the Workbench Variable Graph displays behaviour larger graph than the Strip Graph and contains different options for output than the Strip Graph E Sensitivity Graph creates a sensitivity graph of one variable and its range of uncertainty generated from sensitivity testing Bar Graph creates a bar graph of a variable at a specific time or displays a histogram of variables over all times or across sensitivity simulations at a time ES generates a table of values for the Workbench Variable Table Running Down table with time running down Runs A Runs Compare compares all Lookups and Constants in the first loaded dataset to those in the second loaded dataset AU Statistics provides summary statistics on the Workben
101. g num arg maxarg n int num_arg 5 validate vector 0 for i 0 rval 0 0 i lt n i rval vec gt vals i return rval 7 2 MATRIX INVERSION This is done using an LU Lower triangular Upper triangular decomposition Information on the algorithm is available in Numerical Recipes in C as referenced in the Reference Manual Note that the C functions take COMPREAL and a dimension while the function call passes just the matrix the dispatch routine checks squareness and adds in dimension A define TINY VAL 1 0 20 void lu decomposition COMPREAL a int n int indx COMPREAL d COMPREAL vv void lu back substitution COMPREAL n int indx COMPREAL b double MATRIX INPLACE INVERT VECTOR ARG mat return MATRIX INVERT mat mat double MATRIX invmat VECTOR ARG _ 1 inti j k COMPREAL d double rval COMPREAL scratch static HANDLE scr hndl static COMPREAL tempmat int indx COMPREA
102. gt ncol j cmat vals i j REAL i 100 0 return cmat vals 0 0 double MYDATADEF DATA MATRIX dmat const char literal int ij REAL time time_step initial_time get the data over the simulation range this may not work if any of TIME_STEP INITIAL TIME or FINAL TIME are not constants if dmat gt keyval DATA_MATRIX_KEY VENGV error message STOP Bad call to MYDATADEF return O if VENGV time step gt 0 time step VENGV time step else time step 1 if VENGV initial time NA initial time VENGV initial time else initial time 0 0 if VENGV final time initial time dmat gt ntime long VENGV final time initial time time step 1 5 else dmat gt ntime 100 VENGV gt alloc_simmem dmat 0 0 for time initial_time j 0 j lt dmat gt ntime j time time_step dmat gt timevals j time for i 0 i lt dmat gt nvar i for j 0 j lt dmat gt ntime j dmat gt vals i j REAL i 100 0 return dmat vals 0 0 136 APPENDIX DISAGGREGATION MODEL CODE 137 APPENDIX D PREVIOUS REPORTS IN THE SERIES ISSN print 1913 3200 online 1913 3219 1 Slobodan P Simonovic 2001 Assessment of the Impact of Climate Variability and Change on the Reliability Resiliency and Vulnerability of Complex Flood Protection Systems Water Resources Research Report no 038 Facility for Intelligent Decision Support Dep
103. haviour of the social energy economic climatic system model description Water Resources Research Report no 075 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 209 pages Brink A B and H D Eva 2009 Monitoring 25 years of land cover change dynamics in Africa a sample based remote sensing approach Applied Geography 29 501 512 Davies E G R and S P Simonovic 2008 An Integrated System Dynamics Model for Analyzing Behaviour of the Social Economic Climatic System Model Description and Model Use Guide Facility for Intelligent Decision Support Department of Civil and Environmental Engineering the University of Western Ontario London Ontario Canada D ll P 2002 Impact of climate change and variability on irrigation requirements a global perspective Climatic Change 54 269 293 D ll P M Fl rke M M rker and S Vassolo 2003 Impact of climate change on water resources and irrigation water requirements a global analysis using new climate change scenarios Klima Wasser Flussgebietsmanagement im Lichte der Flut H B Kleeberg Ed Proc Tag der Hydrologie 2003 in Freiburg Germany Forum f r Hydrologie und Wasserbewirtschaftung 11 14 Downing Butterfield R E Edmonds Knox J W Moss S Piper B S and Weatherhead and the CCDeW project team 2003 Climate Change and the Demand for Water Research Rep
104. iables those involved in intersectoral feedbacks are visible to the rest of the model The global version of ANEMI model is divided into fourteen subsystem views which in most cases correspond to model sectors Those subsystems which are not treated as sectors are mainly introduced to make the visual representation more tidy and convenient for the model user These fourteen views of nine ANEMI sectors are introduced in the Vensim DSS model version through the view selector located at the bottom of the main screen or by pressing the page up and page down key m Climate 2 Hide Times New Roman 12 6 24 The model views presented below the following order from Figure 3 1 through Figure 3 14 carbon other gasses climate climate Nordhaus land use food production hydrologic cycle water quantity water demand water quality water stress population emission energy economy and sea level rise Vensim Global model 1980 new4 mdl Var Atmospheric Concentration OK 8 1880 new4 base tax Fa Sey F P 92 gra to and clt taser mut 02 contribution wj M
105. ibrated and verified against available observations from 1980 to 2008 and information available in published literature The model performance is presented in the report to demonstrate the robustness of the ANEMI model as a climate change policy analysis tool The intension of this modeling effort is not the prediction of the future system behaviour but increased understanding of the complex interactions of society biosphere climate economy energy system and response of different system sectors to various climate change mitigation and adaptation policy options This manual should guide the users in operation of this system dynamics model for a range of land use conditions water use policies carbon tax implementation options and other policy alternatives Two versions of the ANEMI model are available global and regional The instructions in the manual apply to both of them The manual should help the users get familiar with e Vensim MATLAB e VisualStudio and e Microsoft Excel 1 2 Organization of the Manual This Manual is broadly divided in three parts The first two chapters Chapter 1 and Chapter 2 provide basic information on the use of Vensim software Ventana 2010 Chapters 3 and 4 cover the mechanics of building ANEMI model by integrating Vensim with other supporting software and Chapter 5 demonstrates some advanced features of ANEMI model for policy implementation and analysis Chapter 1 provides an overview of this
106. im software They can be programmed externally using any programming language usually C and then compiled into dynamic link library DLL which can be loaded by Vensim There are number of options for communication with Vensim starting with the clipboard Vensim can also easily import or export data and constants from other sources For dynamic control of Vensim s behaviour the Vensim DLL allows the user to control Vensim from Visual Basic Delphi or any other programming language For the development of ANEMI model the Visual studio package Microsoft 2008 is found to be the most suitable For those ANEMI model users who will be modifying the model structure familiarity with creation of DLL files to exchange data information with Vensim is required 4 2 1 Visual Studio Installation 1 As pre requirement prior to the Visual Studio installation system needs to be checked and verified by the setup wizard Execute Visual Studio installer 40 2 Read information Click the Install Visual Studio 2008 link to start the installation Figure 4 3 process Visual Studio 2008 Setup icrosoft Visual Studio 2008 Install Visual Studio 2008 features and required components Install Product Documentation Install the MSDN Library which includes Help for Visual Studia Check for Service Releases 5 ases Chec st Service Figure 4 3 Installation option view of the Visual Studio 3
107. ind 1 i if x lt xvals i 1 break tab gt Istind 1 return yvals tab Istind 1 return yvals i yvals i 1 yvals i x xvals i xvals i 1 xvals i this is just to illustrate how different arguments are passed and in what order this is a self looping function taking one each of the different argument types note that the first argument is the left hand side variable passed as a vector double MYALLTYPES VECTOR Ihs const char literal TAB TYPE tab VECTOR vecarg double inti n 0 if Ihs dim info tot dim 0 vecarg gt dim_info gt tot_dim 0 i21 else lhs gt dim_info gt dim lhs gt dim_info gt tot_dim 1 if n int vecarg gt dim_info gt dim vecarg gt dim_info gt tot_dim 1 151 if i VENGV error message VERROR The third argument must have same dimension as left hand side 135 Ihs gt vals 0 1 0 0 return 1 0 Ihs vals 0 cause floating point exception for i 0 i lt n i Ihs gt vals i COMPREAL vecarg gt vals i return Ihs vals 0 double MYCONSTDEF CONSTANT_MATRIX cmat const char literal int i j if cmat gt keyval CONSTANT_MATRIX_KEY VENGV error message STOP Bad call to MYCONSTDEF return 0 just fill in the matrix with some simple numbers VENGV gt alloc_simmem 0 cmat 0 for i 0 i lt cmat gt nrow i 4 for j 0 j lt cmat
108. ing Tarana Solaiman and Slobodan P Simonovic 2010 Assessment of Climatic Vulnerability in the Upper Thames River Basin Part 2 Water Resources Research Report no 066 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 72pages ISBN print 978 0 7714 2834 0 online 978 0 7714 2835 7 30 Christopher J Popovich Slobodan P Simonovic and Gordon A McBean 2010 Use of an Integrated System Dynamics Model for Analyzing Behaviour of the Social Economic Climatic System in Policy Development Water Resources Research Report no 067 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 37 pages ISBN print 978 0 7714 2838 8 online 978 0 7714 2839 5 31 Eum and Slobodan Simonovic 2009 City of London Vulnerability of Infrastructure to Climate Change Background Report 1 Climate and Hydrologic Modeling 141 Water Resources Research Report no 068 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 102pages ISBN print 978 0 7714 2844 9 online 978 0 7714 2845 6 32 Dragan Sredojevic Slobodan Simonovic 2009 City of London Vulnerability of Infrastructure to Climate Change Background Report 2 Hydraulic Modeling and Floodplain Mapping Water Resources Research Report no 069 Facility fo
109. ion 40 4 3 Integration of External Functions With Vensim 5 42 4 3 1 Steps for DLL file compilation 42 4 3 2 Running Vensim and MATLAB 46 4 4 important 11 11 ee 52 5 SIMULATIONS OF POLICY SCENARIQS eren eher he 54 5 1 Scenario l Increase M Water Use cce tiit 54 5 1 1 Scenario 1 Analysis With Global ANEMI 54 5 1 2 Scenario 1 Analysis With ANEMI Regional 55 5 2 Scenario 2 Increase in Food 57 5 2 1 Scenario 2 Analysis With Global ANEMI Model 57 5 2 2 Scenario 2 Analysis With Regional ANEMI 59 5 3 Scenario 3 Carbon uum extn RR ee 61 5 3 1 Scenario 3 Analysis With Global ANEMI Model 61 5 3 2 Scenario 3 Analysis With Regional ANEMI 63 66 APPENDIX ANEMI MODEL CODE MATLAB 68 APPENDIX EXTERNAL 5 119 APPENDIX C DISAGGREGATION MODEL CODE 137 APPENDIX D P
110. l Electricity production 2 8 exp El Ael exp a1 exp Fe1 eta e exp a2 exp Fe2 eta exp a3 exp Fe3 eta nh weight exp e4 eta e nh weight exp e5 eta e 1 eta z 9 exp Pel 1 exp TCe2 exp TCe3 exp r k4 exp r k5 exp El 107 2 10 FC1 tau1 exp short_El exp alp 1 FC2 tau2 exp short_El exp a2p exp TCe2 2 11 FC2 tau2 exp short_El exp a2p 2 FC3 tau3 exp short_El exp a3p exp TCe3 96 energy production 2 12 exp Eh Ah b1 exp Fh1 eta b2 exp Fh2 eta h b3 exp Fh3 eta b4 exp Fh4 eta h 1 eta 2 13 exp Ph exp TCh1 exp TCh2 exp TCh3 exp TCh4 exp Eh 2 14 FC1 tau1 exp short_H b1 exp Fh1 4 eta_h 1 exp TCh1 FC2 tau2 exp short_H b2 exp Fh2 4 eta_h 1 exp TCh2 2 15 FC2 tau2 exp short H b2 exp Fh2 eta h 1 exp TCh2 FC34tau3 exp short H b3 exp Fh3 eta h 1 exp TCh3 2 16 FC3 tau3 exp short_H b3 exp Fh3 4 eta_h 1 exp TCh3 1 mu2 exp FC4 exp short_H b4 exp Fh4 4 eta_h 1 4 96 Nuclear and hydro electricity production 2 17 exp e4 a4 2 18 5 a5 Fuel prices 2 19 fstar1 exp Fe1 exp Fh1 Exp1 2 20 fstar2 exp Fe2 exp Fh2 Exp2 2 21 fstar3 exp Fe3 exp Fh3 Exp3 Total co
111. l XML Document Browse Information Build Events Custom Build Step Output File Override the default output file name OUT file 141 Figure 4 10 View of Linker option Provide required files name VENSIMDP LIB and VENEXT DFF which are shipped with Vensim software package under Input option and then press OK Figure 4 11 to continue 44 10111 Property Pages Configuration Active Debug gt Platform Active Win32 Configuration Manager Common Properties Additional Dependencies VENSIMDP LIB 4 Configuration Propertie Ignore All Default Libraries No General Ignore Specific Library Debugging Module Definition File VENEXT DEF Module to Assembly 4 Linker Embed Managed Resource File General Force Symbol References Input Delay Loaded DLLs Manifest File Assembly Link Resource Debugging System Optimization Embedded IDL Advanced Command Line Manifest XML Document Gene Browse Information Build Events Custom Build Step Additional Dependencies Specifies additional items to add to the link line kernel32 lib configuration specific Cancei n Figure 4 11 Definition file extraction window 7 Create the expected DLL file VENSIM DLL Press Debug button 7 and wait for the result which will appear in the Output window Figure 4 12
112. l CES weight for natural gas CES weight for alternative heat energy Base year price for coal Base year price for oil Base year price for natural gas Current reserve value for coal Current reserve value for oil Current reserve value for natural gas Base year reserve value for coal Base year reserve value for oil Base year reserve value for natural gas Capital s share Labour s share Share parameter for energy aggregation Elasticity parameter for fossil fuel price function Elasticity parameter for energy aggregation Total Factor Productivity Nordhaus damage coefficient Labour force 97 4 5 1 mu2 eta e eta h om Ael Ah tau1 tau2 tau3 nh weight fstar1 fstar2 fstar3 Prescribed nuclear energy Prescribed hydro power Parameter for alternative heat energy price function Parameter for alternative heat energy price function Elasticity parameter for electricity production Elasticity paramater for heat energy production Scale parameter for CES weights in electricity production Electricity specific productivity term Heat energy specific productivity term Carbon tax rate for coal Carbon tax rate for oil Carbon tax rate for natural gas CES weight for nuclear and hydro power Total extraction of coal Total extraction of oil Total extraction of natural gas 98 Solver File This file is the primary solver file used for the regional model It takes inputs from Vensim calls the appropriate fun
113. l Area in sq km Figure 3 14 View of the sea level subsystem All the variables constants and parameters shown in Figures 3 2 to 3 14 are representing stocks or flows or auxiliary variables in the ANEMI stock and flow diagrams 31 3 2 ANEMI Model Simulations The ANEMI system dynamics modelling follows a structural approach of modelling so that each individual sector is based on the best understanding of the real world Here the structural approach means that equations used to drive the model are not only based on a mathematical expressions and matching data but also on the current level of scientific understanding and judgment to appropriately represent the physical processes occurring within the complex system Therefore it is often observed that the ANEMI model fails to exhibit excellent match with the actual data At the same time model is capable of avoiding data overfitting problem The greatest strength of the system dynamics model like ANEMI is its structure rather than the set of equations that provides the best fit to the data So manipulation of the calibration parameters is not the primary and only modeling objective The calibration procedure concentrates primarily on the manipulation of uncertain structural elements through alterations to stocks and flows and feedback structures whereas parameter tuning constitutes a minor part of the model calibration and verification proc
114. l Usage of Max Diktion hation Capacity Acceptable value for Domestic cams foe Domastis Water Typical Nitrogen totalN from Domestic water 7777 mode Documenti 2 Concentration Model Tools Windows Help R start980 new4 base tax BE 2 Desired Agricultural Effective Agricultural Bhie Water V drawal Water Withdrawal Effective Water Withdrawal Turn On Green Water z Dihtion sw New Water Stress Final water stress Water Stress Hide Times NewRoman v2 e i Tu S5 e Figure 3 10 View of the water stress subsystem 29 ensim Global tart1980 new4 mdl Var Atmospheric CO2 Concentration Edt View 22 Model Tools Windows Help 218 amp 1980 news base tax be X3 REY Sm REELS monthly temperature 4 increase factor related death 0 14 2 Total temperature monthly temperature Times related death 0 14 related death im libor force participation monthly death factor 80 total temperature 044 related death reproductive Labour force 80 30 80 monthly death 65 p
115. ld using system dynamic based Vensim platform still it has a dynamic link with outside computational environment MATLAB In each time step Vensim sends some information to MATLAB to get a new set of parameters for the next time step Therefore it is essential to maintain same calculation time step for both programs However if it seems time consuming to use the same time step then a predefined computational time step in such a case the maximum computational time step between Vensim and MATLAB will work should be selected All numerical integration techniques require the selection of a discrete finite time step at which solutions are calculated for each simulated variable This time step has a significant effect on model behaviour so its value must be chosen carefully to avoid the introduction of integration error into the simulated values Since integration error depends on the rate at which flows change relative to the selected time step faster rates of change in flows demand shorter time steps The practical advice for selection of an appropriate time step for system dynamics model is Time steps should be divisible by 2 so that possible time step values are 1 0 5 0 25 0 125 and so on Time steps should be roughly one quarter to one tenth the size of the smallest time constant in the model To test the suitability of the chosen time step user needs to run a model simulation and check its behaviour When using Euler integr
116. licking on any variable After that user will be able to edit the equation or incorporate equation in the designated area Figure 2 8 20 Editing equation for Potential Customer Potential Customer Land Conversion INTEG Initie Value Wd 7 8 9 Variables Functions More Level 24 01 415161 Choose Variable Inputs z Normal zi 1 2 Potential Customer Supplementary Land Conversion Help 127 Units Com n ment E Group Range Prev Next 351154 5 1 Errors Equation Modified Check Syntex Check Model Delete Variable Cancel Figure 2 8 Equation editor window Define the initial conditions for the model two stocks Insert 100 and 0 value for Potential Customer and Actual Customer respectively In this case at the beginning of the simulation period all of the customers 100 were potential customer as there was no home to handover which leads to zero number of actual customer In the problem description it is mentioned that the project progress rate is aimed to transform 2 596 of potential customers to actual customer in each month So the land conversion rate can be defined as Land conversion Potential customer 0 025 Vensim also allows user to visualize all the embedded equations under the diagra
117. lookup functions passed this structure is not currently accessible but will be made so in the future if Flist i sym sym Flist i sym argument desc Flist i argument_desc num_arg Flist i num_args num_vector Flist i num_vector func_index Flist i func_index dim_act 0 modify Flist i modify num loop Flist i num loop num literal Flist i num literal lookup Flist i num lookup return 1 return 0 indicating the end of list some memory management utility routines used by the examples that may be of value for other functions RAE OR typedef struct _rorstr RORSTR struct _rorstr COMPREAL times HANDLE times_hndl COMPREAL 124 HANDLE vals RORSTR next int streamid int ntimes int maxtimes any flags that individual function need set to perform properly on the next invocation must be reset by vext clearmem static int Matrix invert maxn static RORSTR Internal ror fror static HANDLE used 40 static int Num mem used 0 static int mem used 0 static void vext_allocate unsigned nbytes HANDLE hndl HANDLE Ihndl if Num mem used gt mem 5 Max mem used 100 if Mem_used Mem used HANDLE realloc Mem used Max mem used sizeof HANDLE memset Mem_used
118. m in the text format which looks as Actual customer INTEG Land conversion 0 m number of customer Land conversion Potential customer 0 025 21 number customer Potential customer Land conversion 100 number of customer Simulation Control Parameters FINAL TIME 100 p Month The final time for the simulation INITIAL TIME 0 Month initial time for the simulation 5 Month 0 2 The frequency with which output is stored TIME STEP 1 e Month 0 2 e The time step for the simulation 22 As the last step model simulation is initiated by pressing button from the Tool Bar After completion of the simulation the user can visualize or extract the results file both in graphical and numerical format In the problem description it is mentioned that the total land available is sufficient for 85 customers So from the graph of actual customers Figure 2 9 it can be seen that 75 months would be sufficient to sell all the properties within the subdivision Actual customer 100 75 50 25 Time Month Figure 2 9 Time series plot of the number o
119. mand Window 7 Open the Vensim model from the Start menu Figure 4 20 Set Program Access and Defaults W windows Catalog Windows Update 22 Microsoft Update MM Programs 0 gt E Microsoft office gt Norton 360 Documents vensin 055 Vensim 055 DbiPrec Reader E Settings search and support 1 7 Run 72 Log Off Khaled Windows Home Edition Off Computer Figure 4 20 View of the Start Vensim 8 Select Open Model from the File menu Choose model mdl file Figure 4 21 Vensim No Model Open Var FINAL TIME File Model Tools Windows Help CET 498 bY R4 Close Save Settings Publish Edit File Print Options Exit Figure 4 21 File menu of Vensim 9 From the Model menu select Setting option to setup the Model Setting option Figure 4 22 This setup is required to define the simulation horizon as well as the computational time step Figure 4 23 Press OK to proceed further Vensim Global_model_start1980_new4 mdl Var 0 14 age group File Edit View fools Windows Help ew4 base HighDisc tax 28064 cm oy Reform and Clean Turn On Climatt Compare to Effects on Wate Simulate Partial Simulation
120. mentation Year 9 Save the model with a suitable name and close the Vensim program and 10 Follow the procedures from Section 4 3 2 for simulating the regional ANEMI model 5 2 Scenario 2 Increase in Food Production The introduction of Scenario 2 is presented in Section 3 3 2 of the Manual In this section the instructions are presented for simulating this scenario 2 with the ANEMI model 5 2 1 Scenario 2 Analysis With Global ANEMI Model 1 Select the Land Use view Figure 5 4 to implement Scenario 2 57 lobal_model_start1980_all discovery at the begining taxpolicy mdl Var Matrix Multiplier Landuse Fie ven Tooke Windows Heb oa 212111980 base discovery at begini kY hace CR D F Land Bering vd Land Change 4 2 NOTE hoe M m Cet Bm E 2 iini 2 uen rre e _ ae reme E zn I Pd nm re lia flea hm jh rod Pur mei Lond Jg New Romen MB Figure 5 4 View of the Land Use sector 2 Select equation button wc first and then click on the Matrix Multiplier for Land use Change 3 Change the value of 141 to 0 1
121. mes Subdivision has 100 potential home customers if the land for development is available 2 596 of potential customers each month may decide to move to the subdivision and become actual customers assume that units for land conversion are expressed using number of customers one customer is equal to one home plot of land total agricultural land available is sufficient for 85 customers The solution of the problem follows the procedure as outlined a Development of a causal diagram for the problem b Development of the corresponding stock and flow diagram c Development of the Vensim model for the problem d Simulation of the Vensim model 17 Solution a 1 Start the Vensim program from the Start Menu and draw the causal loop diagram 2 After opening the program select button Auxiliary Constant and then click on the workspace area to identify all the variables Vensim Unnamed VarFINAL TIME 74 File Edit View Layout Model Tools amp bc amp f s o A Variable Auxiliary Constant Select the arrow button to connect the appropriate variables in such a way that the arrow starts from a cause and ends with a result like if number of potential customers increases then the land conversion rate should follow In such case user should start from the Potential customer and connect towards Land conversion to keep arrow head towards
122. n Support Department of Civil and Environmental Engineering London Ontario Canada 437 pages ISBN print 978 0 7714 2638 4 online 978 0 7714 2639 1 18 Subhankar Karmakar and Slobodan P Simonovic 2007 Flood Frequency Analysis Using Copula with Mixed Marginal Distributions Water Resources Research Report no 055 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 144 pages ISBN print 978 0 7714 2658 2 online 978 0 7714 2659 9 19 Jordan Black Subhankar Karmakar and Slobodan P Simonovic 2007 A Web Based Flood Information System Water Resources Research Report no 056 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 133 pages ISBN print 978 0 7714 2660 5 online 978 0 7714 2661 2 20 Angela Peck Subhankar Karmakar and Slobodan P Simonovic 2007 Physical Economical Infrastructural and Social Flood Risk Vulnerability Analyses in GIS Water Resources Research Report no 057 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 80 pages ISBN print 978 0 7714 2662 9 online 978 0 7714 2663 6 21 Predrag Prodanovic and Slobodan P Simonovic 2007 Development of Rainfall Intensity Duration Frequency Curves for the City of London Under the Changing Climate Water Resources Research Report no 058 F
123. n of a particular policy with the ANEMI model 3 3 1 Scenario 1 Increase in Water Use Key Question What are the impacts from increase in water use The key question is converted into what scenario of maintaining current irrigation practices and whether such practices and consequently agricultural output can be sustained in case of increased water stress This scenario is examined with the global and regional version focusing on Canada of the ANEMI model As the food production sector is not only dependent on land use it is also possible to assess the interaction between the food production and the changes in water population and variables of the energy economy sector This scenario looks more broadly to several sectors including hydrologic cycle water quality energy economy population climate carbon and food production A 1596 increase in water use is considered under this scenario to meet future water demand In the ANEMI model the Scenario 1 is created by assigning the two input variables Water use increase in and Implementation year In this case we decided to implement our scenario 1 from the year 2015 So the following modifications are required to implement the scenario 1 Figures 3 3 Water use increase in 15 Implementation year 2015 33 Editing equation for Water use increase 96 Water use increase in X Undo Variables Subscripts Functions More
124. nal model and matches the historical trend for fossil fuel consumption in heat energy and electricity production function z energysect cal can y par cap eng variables 1 1 1 2 1 3 El y 1 4 Fh1 y 1 5 Fh2 y 1 6 Fh3 y 1 7 Fel y 1 8 Fe2 y 1 9 Fe3 y 1 10 r y 1 11 w 1 12 Pe y 1 13 Ph y 1 14 Pel y 1 15 e4 1 16 5 1 17 1 1 18 2 1 19 y 1 20 110 1 1 21 2 1 22 TCe3 1 23 TCh1 1 24 TCh2 1 25 TCh3 1 26 1 1 27 2 1 28 1 29 1 1 30 2 y 1 31 3 1 32 Fh4 1 33 1 34 TCh4 1 35 short El y 1 36 short H y 1 37 imports y 1 38 y 1 39 gam2 y 1 40 y 1 41 b1 y 1 42 62 1 43 63 1 44 capital K cap 1 1 1 1 2 k2 cap 1 3 111 1 4 4 1 5 5 1 6 96parameters Pfz1 par 1 7 Pfz2 par 1 8 Pfz3 par 1 9 1 par 1 10 2 1 11 1 12 221 1 13 822 1 14 Rz3 par 1 15 alpha par 1 16 beta par 1 17 gamma par 1 18 rho par 1 19 theta par 1 20 At par 1 21 OMt par 1 22 L par 1 23 a4 par 1 24 a5 par 1 25 b4 par 1 26
125. ns The status bar provides buttons for modifying the sketch Each sketch view shows a part of the model much like each page in a book tells part of a story In Vensim Professional and DSS the build window can be switched to a text editor for building and editing text based models 2 2 4 Sketch Tools Sketch tools are grouped into a sketch toolset Customized toolsets can be saved to files and reopened for later use The built in sketch toolset default sts contains most of the sketch tools needed for building models 10 Lock Variable Arrow Model Merge Comment Hide Equations Variable Wand CP VEO vo A Move Size Rate Shadow Input Unhide Delete Reference Variable Variable Output Wand Modes Object Vensim PLE and PLE Plus do not contain the Model Variable Merge Unhide Wand or Hide Wand tools The sketch tools in the built in sketch toolset are Lock sketch is locked Pointer can select sketch objects and the Workbench Variable but cannot move sketch objects e Move Size move sizes and selects sketch objects variables arrows etc e Variable creates variables Constants Auxiliaries and Data Variable create variables with a box shape used for Levels or Stocks e Arrow creates straight or curved arrows e Rate creates Rate or flow construct consisting of perpendicular arrows a valve and if necessary sources and sinks clouds e Model Variable
126. odel DLL TestDII TestDIl1 ensect_solve_ac4_march10 m 1 11 tic Figure 4 18 MATLAB Editor window 6 Check the accuracy of the optimization by looking at the MATLAB Command Window Figure 4 19 48 Iteration Func count Residual Step size deri 0 38 7 71475 028 Optimization terminated directional derivative along Search direction less than TolFun and infinity norm of gradient less than 10 TolFun TolX Command Window Command History Norm of Firs Iteration Func count f x step opti 0 44 140 658 1 88 5 82977 1 2 132 3 22802 2 5 3 176 0 362691 6 25 4 220 0 00354438 4 06338 5 264 1 10749 005 0 320355 0 6 308 3 82473 010 0 0143313 0 0 7 352 1 33872 019 5 57114 005 5 36 8 396 3 35278e 029 6 00298 010 9 2 Optimization terminated first order optimality less th Norm of Firs Iteration Func count step opti 0 38 1 77498 02 5 353 Optimization terminated first order optimality is less Warning Default trust region dogleg method of FSOLVE handle non square systems using Gauss Newton method inst gt In fsolve at 248 In ensect solve 10 at 142 Iteration Func count Residual Step size deri 0 38 1 77498 029 Optimization terminated directional derivative along search direction less than TolFun and infinity norm of gradient less than 10 TolFun tTolX Figure 4 19 View of the MATLAB Com
127. og boxes simplify controls by separating information into different folders with tabs The user can switch between folders by clicking on the appropriate tab 2 1 4 Vensim Installation To install Vensim user needs to get the software either from the CD or as a download from the VENTANA Systems Inc website http www vensim com last accessed August 2011 The Vensim CD The Vensim CD contains the installation programs for all Vensim configurations The label of the CD will show the version number Though installers for all configurations are included the user will only be able to install the specific configuration as per the license agreement Downloading Vensim The user is allowed to download Vensim from the website of VENTANA Systems inc after the purchase of Vensim license that includes one year of free electronic updates The direct link for downloading Vensim is http www vensim com cgibin download exe last accessed August 2011 This link is available only with the valid registration code The registration code identifies the productTo download Vensim PLE free version of software for educational purpose user needs to visit http www vensim com freedownload html last accessed August 2011 The Windows installer is broken into a number of relatively small files The first of these files has name that depends on the product for example vendss32 exe for Vensim DSS The remaining files are labelled disk2 vip disk
128. om 2006 and onwards the parameters are extrapolated following a naive updating rule function z vedge v par eng 1 v 1 1 vedge2 v 1 2 vedge3 v 1 3 tel eng 1 1 eng 1 4 eng 1 7 te2 eng 1 2 eng 1 5 eng 1 8 te3 eng 1 3 eng 1 6 eng 1 9 Pfz1 par 1 7 Pfz2 par 1 8 Pfz3 par 1 9 PR1 par 1 10 PR2 par 1 11 PR3 par 1 12 Rz1 par 1 13 Rz2 par 1 14 Rz3 par 1 15 rho par 1 19 FC1 par 1 38 FC2 par 1 39 117 1 40 2 1 tel vedge1 Rz1 FC1 Pfz1 1 rho 2 2 te2 PR2 vedge2 Rz2 FC2 Pfz2 1 rho 2 3 te3 vedge3 Rz3 FC3 Pfz3 1 rho 118 APPENDIX EXTERNAL FUNCTIONS include imsl h include lt stdio h gt include lt math h gt include lt time h gt include lt windows h gt define WANT_WINDOWS_INCLUDES the sample implementation of this requires windows includes libraries define VENEXT_GLOBALS include vensim h include lt malloc h gt GLOB_VARS VENGV the value for this is set by set_gv below ELE ERE ALLA RRR TEER 1 function ids used to swich between choices RASA LA define COS FUNCO define 1 define PSUM_FUNC 2 define INVERT_FUNC 3 define INPLACE_INVERT_FUNC 4 define INTERNAL_ROR_FUNC 5 define MYMESSAGE_FUNC 6 define MYFINDZERO_
129. on Support Department of Civil and Environmental Engineering London Ontario Canada 137 pages ISBN print 978 0 7714 2630 8 online 978 0 7714 2631 5 14 Ibrahim El Baroudy and Slobodan P Simonovic 2006 A Decision Support System for Integrated Risk Management Water Resources Research Report no 051 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 146 pages ISBN print 978 0 7714 2632 2 online 978 0 7714 2633 9 15 Predrag Prodanovic and Slobodan P Simonovic 2006 Inverse Flood Risk Modelling of The Upper Thames River Basin Water Resources Research Report no 052 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 163 pages ISBN print 978 0 7714 2634 6 online 978 0 7714 2635 3 139 16 Predrag Prodanovic and Slobodan Simonovic 2006 Inverse Drought Risk Modelling of The Upper Thames River Basin Water Resources Research Report no 053 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 252 pages ISBN print 978 0 7714 2636 0 online 978 0 7714 2637 7 17 Predrag Prodanovic and Slobodan P Simonovic 2007 Dynamic Feedback Coupling of Continuous Hydrologic and Socio Economic Model Components of the Upper Thames River Basin Water Resources Research Report no 054 Facility for Intelligent Decisio
130. opy the Price of Fossil Fuel from the Energy Economy sector Select the Price of Fossil Fuel variable and then press the Table button Copy the global fossil fuel price in Microsoft Excel Open the Energy Economy view of the regional version of the ANEMI model Import the respective fossil fuel price from the Excel file containing global fuel price with tax for Coal Oil and NaturalGas Figure 5 12 63 Vensin Global_model_start1980_all discovery at the begining taxpolicy mdl Var Carbon Tax ON DSA 1900 newt basc all discovery at begin MHF HBO Sa TTA wD of RELA le mopio Tress Ron 1216 oS ESSA Figure 5 12 View of the regional Energy Economy sector 5 Select equation button and then click the Carbon Tax ON and replace 0 by 1 to activate the carbon tax policy Figure 5 13 Editing equation for Carbon Tax ON Type Undo 7 Constant 1701 Normal 1 Supplenentary Variables Subscripts Functions More Choose Variable Inputs 8 5 2 global v Range Go To Prev Next 5 New Modified Check Syntax Check Model Delete Variable Cancel Figure 5 13 Option window to tu
131. ort Stockholm Environment Institute Oxford Office Oxford FAO Food and Agricultural Organization 2009 2050 A Third More Mouths to Feed Food Production Will Have to Increase By 70 Percent FAO Convenes High Level Expert Forum Available from http www fao org news story 0 item 35571 icode en last accessed February 20 2011 Foley J de Fries R Defries R Asner G P Barford C Bonan G Carpenter S R Chapin F S Coe M T Daily G C Gibbs H K Helkowski J H Holloway T Howard E Kucharik Monfreda Patz J Prentice Ramankutty N Snyder P K 2005 Global consequences of land use Science 309 570 574 Intergovernmental Panel on Climate Change IPCC 2007 Summary for Policymakers Synthesis Report Paris IPCC Working Group 2008 Climate Change and Water Technical Paper VI IPCC Working Group II Technical Support Unit Bates B C Z W Kundzewicz S Wu and J P Palutikof Eds 2008 Climate Change and Water Technical Paper of the Intergovernmental Panel on Climate Change IPCC Secretariat Geneva 210 pp 66 Microsoft 1998 Guide to Visual Studio 6 0 professional edition Visual Studio Developing for Windows and the Web Microsoft Corporation USA Mote P W D J Canning D L Fluharty R C Francis J F Franklin A F Hamlet M Hershman M Holmberg K N Gray Ideker W S Keeton D P Lettenmaier L R Leung N J Mantua E L Miles B Noble
132. porting and exporting datasets The Tools menu sets Vensim s global options and allows the user to manipulate analysis tools and sketch tools as well as to set global options The Windows menu enables the user to switch among different open windows The Help menu provides access to the on line help system Menus are context sensitive and the commands apply to whichever window currently is active The most commonly used menu commands also have shortcut keys and can be performed from the toolbar described below 2 2 2 Toolbar The toolbar provides buttons for some of the most commonly used menu items and simulation features The first set of buttons access File and Edit menu items New Model Open Model Save Print Cut Paste The next several buttons and the Runname editing box are used for model simulation Control Runname Simulate Game Optimize Setup a Choose SyntheSim Sensitivity Reality Simulation Runname Check The last few buttons access the window classes User may need to click on a button to bring forward that type of window or circulate through windows of that type ut Build Windows Control cw Output Windows Subscript Control 2 2 3 The Build Window Build window is used to create model in Vensim By default the window opens with the sketch tools for sketching the structure of the model and for writing equatio
133. r where all files copied from the supplied DVD are kept and select ensect solve can apr17 1 m file Define the path to the working folder where all files from the DVD are stored in MATLAB environment gt start the optimization press the Run button in the Editor window of MATLAB If the optimization for the initial time step works fine then MATLAB will create an in txt file which will then be used by Vensim Open the Vensim model from the start menu From the File menu select Open Model and select the Regional Model mdl file Select Setting option from the Model menu to setup the Model Setting option This setup is required to define the simulation horizon and the computational time step Follow the same process from step 9 to step 14 presented for global version of the ANEMI model to complete the simulation 4 4 Important Remarks 52 something goes wrong during the simulation process user will not be able to stop Vensim software by only pressing Escape key on the keyboard As per the external function command Vensim is forced to wait until it gets a new text file in txt In such a situation press Escape key first and then open b in txt file and save it as in txt Now the decision be made whether the result should be saved or not The user can also choose to continue the simulation but the chance of having erroneous result
134. r Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 147 pages ISBN print 978 0 7714 2846 3 online 978 0 7714 2847 0 33 Tarana A Solaiman and Slobodan P Simonovic 2011 Quantifying Uncertainties in the Modelled Estimates of Extreme Precipitation Events at the Upper Thames River Basin Water Resources Research Report no 070 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 167 pages ISBN print 978 0 7714 2878 4 online 978 0 7714 2880 7 34 Tarana A Solaiman and Slobodan P Simonovic 2011 Assessment of Global and Regional Reanalyses Data for Hydro Climatic Impact Studies in the Upper Thames River Basin Water Resources Research Report no 071 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 74 pages ISBN print 978 0 7714 2892 0 online 978 0 7714 2899 9 35 Tarana A Solaiman and Slobodan P Simonovic 2011 Development of Probability Based Intensity Duration Frequency Curves under Climate Change Water Resources Research Report no 072 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 89 pages ISBN print 978 0 7714 2893 7 online 978 0 7714 2900 2 36 Dejan Vucetic and Slobodan P Simonovic 2011 Water Resources Decision Making Under Uncert
135. rn ON carbon tax for the regional version of ANEMI model 6 Review modify Tau1 tax Tau2 tax and Tau3 tax Figure 5 14 as they represent the carbon tax for Coal Oil and NaturalGas respectively It is advised to use the same tax policy with global and regional versions of the ANEMI model In this experiment equivalent amount of tax is implemented based on the emission intensity from each unit of fossil fuel Any other tax policy can be implemented 64 Graph Lookup tax NIN Salas utpul o 0 fo 0 02667 0 05333 oos 0 1067 101353 016 0 1857 Vals X min 1980 2092 y 0 06579 Xmax 2100 Reset Scaling OK Clear Points Clear All Points Clear Reference Ref gt Cur Cancel Figure 5 14 Look up table for Carbon Tax rate input in the regional version of ANEMI model 7 Export Total Industrial Emission and GDP values into the regional ANEMI model 8 Save the model with a suitable name and close the Vensim program 9 Complete the simulation using procedure from the Section 4 3 2 for simulation of regional ANEMI model 65 REFERENCES Akhtar M K S P Simonovic J Wibe J MacGee and J Davies 2011 An integrated system dynamics model for analyzing be
136. rt Department of Civil and Environmental Engineering London Ontario Canada 40 pages ISBN print 978 0 7714 2622 3 online 978 0 7714 2623 0 10 Juraj Cunderlik and Slobodan P Simonovic 2004 Selection of Calibration and Verification Data for the HEC HMS Hydrologic Model Water Resources Research Report no 047 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 29 pages ISBN print 978 0 7714 2624 7 online 978 0 7714 2625 4 11 Juraj Cunderlik and Slobodan P Simonovic 2004 Calibration Verification and Sensitivity Analysis of the HEC HMS Hydrologic Model Water Resources Research Report no 048 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 113 pages ISBN print 978 0 7714 2626 1 online 978 0 7714 2627 8 12 Predrag Prodanovic and Slobodan P Simonovic 2004 Generation of Synthetic Design Storms for the Upper Thames River basin Water Resources Research Report no 049 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 20 pages ISBN print 978 0 7714 2628 5 online 978 0 7714 2629 2 13 Ibrahim El Baroudy and Slobodan Simonovic 2005 Application of the Fuzzy Performance Indices to the City of London Water Supply System Water Resources Research Report no 050 Facility for Intelligent Decisi
137. st functions for electricity 2 22 1 exp r k1 exp Fe1 FC1 tau1 2 23 exp TCe2 exp r k2 exp Fe2 FC2 tau2 2 24 exp TCe3 exp r k3 exp Fe3 FC3 tau3 Total cost functions for heat energy 2 25 exp TCh1 exp Fh1 FC1 tau1 108 2 26 exp TCh2 exp Fh2 FC2 tau2 2 27 exp TCh3 exp Fh3 FC3 tau3 2 28 exp TCh4 exp Fh4 exp FC4 96 CES Function weights 2 29 exp a1 1 om gam1 exp Fe1 k1 2 2 30 exp a2 1 om gam2 exp Fe2 k2 2 2 31 exp a3 1 om gam3 exp Fe3 k3 2 2 32 exp Fe1 1 eta e exp a1p exp a1 eta e 2 om exp Fe1 k1 2 2 33 exp Fe2 1 eta e exp a2p exp a2 eta e 2 om exp Fe2 k2 2 2 34 exp Fe3 1 eta e exp a3p exp a3 eta e 2 om exp Fe3 k3 2 96 Price Function for alternative Heat Energy 2 35 exp FC4 mu1 exp Fh4 mu2 Short hand expressions 2 36 exp short eta e exp a1 exp Fe1 eta e exp a2 exp Fe2 eta e exp a3 exp Fe3 eta e nh weight exp e4 eta nh weight exp e5 eta 2 37 exp short b1 exp Fh1 eta h b2 exp Fh2 eta h b3 exp Fh3 eta b4 exp Fh4 eta 96 Balanced Trade Condition 2 38 imports FC1 tau1 Exp1 FC2 tau2 Exp2 FC3 tau3 Exp3 109 Calibration Function File The calibration function file for MATLAB solves the one period problem for the regio
138. t 978 0 7714 2614 8 online 978 0 7714 2615 5 6 K D W Nandalal and Slobodan P Simonovic 2002 State of the Art Report on Systems Analysis Methods for Resolution of Conflicts in Water Resources Management Water Resources Research Report no 043 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 216 pages ISBN print 978 0 7714 2616 2 online 978 0 7714 2617 9 7 K D W Nandalal and Slobodan P Simonovic 2003 Conflict Resolution Support System A Software for the Resolution of Conflicts in Water Resource Management Water Resources Research Report no 044 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 144 pages ISBN print 978 0 7714 2618 6 online 978 0 7714 2619 3 138 8 Ibrahim El Baroudy Slobodan Simonovic 2003 New Fuzzy Performance Indices for Reliability Analysis of Water Supply Systems Water Resources Research Report no 045 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 90 pages ISBN print 978 0 7714 2620 9 online 978 0 7714 2621 6 9 Juraj Cunderlik 2003 Hydrologic Model Selection for the CFCAS Project Assessment of Water Resources Risk and Vulnerability to Changing Climatic Conditions Water Resources Research Report no 046 Facility for Intelligent Decision Suppo
139. t calculation for natural gas Alternative heat energy GJ Price of alternatie heat energy Total cost of heat energy produced from alternative energy Short hand term for electricity calculations Short hand term for heat energy calculations 69 List of Parameters gam1 gam2 gam3 61 62 63 64 Pfz1 Pfz2 Pfz3 1 2 Rz1 Rz2 Rz3 alpha beta gamma rho theta At OMt Parameter for CES weight function for coal Parameter for CES weight function for oil Parameter for CES weight function for natural gas CES weight for coal CES weight for oil CES weight for natural gas CES weight for alternative heat energy Base year price for coal Base year price for oil Base year price for natural gas Current reserve value for coal Current reserve value for oil Current reserve value for natural gas Base year reserve value for coal Base year reserve value for oil Base year reserve value for natural gas Capital s share Labour s share Share parameter for energy aggregation Elasticity parameter for fossil fuel price function Elasticity parameter for energy aggregation Total Factor Productivity Nordhaus damage coefficient Labour force 70 4 5 1 mu2 eta e eta h om Ael Ah tau1 tau2 tau3 nh weight Prescribed nuclear energy Prescribed hydro power Parameter for alternative heat energy price function Parameter for alternative heat energy price function Elasticity parameter for electrici
140. tation to Climate Change Impacts in the Upper Thames River Basin Water Resources Research Report no 062 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 81 pages ISBN print 978 0 7714 2710 7 online 978 0 7714 2711 4 26 Evan G R Davies and Slobodan P Simonovic 2009 Energy Sector for the Integrated System Dynamics Model for Analyzing Behaviour of the Social Economic Climatic Model Water Resources Research Report no 063 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 191 pages ISBN print 978 0 7714 2712 1 online 978 0 7714 2713 8 27 Leanna King Tarana Solaiman and Slobodan P Simonovic 2009 Assessment of Climatic Vulnerability in the Upper Thames River Basin Water Resources Research Report no 064 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 61pages ISBN print 978 0 7714 2816 6 online 978 0 7714 2817 3 28 Slobodan P Simonovic and Angela Peck 2009 Updated Rainfall Intensity Duration Frequency Curves for the City of London under Changing Climate Water Resources Research Report no 065 Facility for Intelligent Decision Support Department of Civil and Environmental Engineering London Ontario Canada 64pages ISBN print 978 0 7714 2819 7 online 987 0 7714 2820 3 29 Leanna K
141. the simulation output 51 Figure 4 25 View of the a Simulation 51 Figure 4 26 View of the dataset analysis 15 nsns nana 51 Figure 5 1 View of the water demang 54 Figure 5 2 View of the energy economy sector focusing on fossil fuel price 56 Figure 5 3 Parameters to implement Scenario 1 policy Error Bookmark not defined Figure 5 4 View of the Land Use snas agar nnns snas naa 58 Figure 5 5 Option view to choose land transformation rate 58 Figure 5 6 Fossil fuel price to be imported in the regional version of the ANEMI model 59 Figure 5 7 Parameters to implement with Scenario 2 60 Figure 5 8 Option view to choose land use transformation rate regional ANEMI model 61 Figure 5 9 View of the Energy Economy sector 1 1111 enean nenne sss nain nnne sss nana 62 Figure 5 10 Option view to turn ON carbon tax 62 Figure 5 11 Look up table for carbon tax rate enne nnne nina 63 Figure 5 12 View of the regional Energy Economy 64 Figure 5 13 Option window to turn
142. tially by checking derivatives between the set time intervals without imposing a heavy computational burden Several different Runge Kutta intervals can be chosen in Vensim fixed step size of one half fixed RK2 and one quarter fixed as well as automatic adjustments of step size RK2 auto and auto Auto performs fourth order Runge Kutta integration with automatic adjustment of the step size to ensure accuracy This is the best choice if the user wants an accurate answer quickly but requires significantly more computational effort than the other forms Therefore RK4 auto is the slowest of the numerical integration techniques Fixed performs fourth order Runge Kutta integration with a fixed step size specified by TIME STEP This is usually very accurate but does not detect own inaccuracies RK2 Auto which performs second order Runge Kutta integration with automatic adjustment of the step size This 15 is less accurate but sometimes faster than RK4 auto is not recommended unless user feels there is a special reason to use it RK2 Fixed performs second order Runge Kutta integration with a fixed step size This is faster than RK4 but more accurate than Euler It is useful when both speed and accuracy are important and difficult to achieve In the use of ANEMI model user should avoid Runge Kutta2 auto or Runge Kutta4 auto as the model setup requires predefined time step Even though ANEMI model is mostly bui
143. times gt ror gt maxtimes reallocate ror gt maxtimes 100 ror gt times COMPREAL vext_reallocate ror gt maxtimes sizeof COMPREAL amp ror gt times_hndl ror gt vals COMPREAL vext_reallocate ror gt maxtimes sizeof COMPREAL amp ror gt vals_hndl ror gt times ror gt ntimes COMPREAL time ror gt vals ror gt ntimes COMPREAL inval ror gt ntimes if compute_flag gt 1 0 for range maxval minval 4 0 result minval maxval 2 0 133 granular 1 granular lt 20 granular range 2 0 0 for i 0 i lt ror gt ntimes i ror vals i exp result ror gt times 0 ror gt times i if npv lt 0 0 result range else if npv gt 0 0 result range else break return result return 0 0 double MYMESSAGE const char message double time char 40 sprintf timestr At time g time MessageBox NULL message timestr MB ICONSTOP MB OK return 1 0 note that we could also use the following call vensim error message INFORM timestr return 1 0 Note the following will often fail it is included here as an example only double MYFINDZERO VECTOR VECTOR vy int int ij int rval double maxerr COMPREAL x y char buf 128 validate vector arg vx O narg validate vector arg vy O narg x vx
144. to Vensim set val 0 this value will be used the equation output val 0 val COMPREAL rval return 1 a 1 return value signals vensim of successful completetion 7 actual function bodies these could be a separate file actual function bodies are all set up to use and return doubles except when acting on vectors this aids portability across different platforms and compilers as the C standard for floating point argument passing uses doubles ERROR float Solve Sys of Nonlinear Equations int index float float par2 float par3 float float 5 float par6 float 7 float par8 float par9 float par10 float par11 float par12 float par13 float par14 float par15 float 16 float par17 float par18 float par19 float 20 float par21 float par22 float par23 float par24 float par25 float par26 float par27 float par28 float par29 float par30 float par31 float par32 float par33 float par34 float par35 float par36 float par37 10000 float err_rel 0 00000000001 float xguess N 10 2 0 2 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5
145. ty production Elasticity paramater for heat energy production Scale parameter for CES weights in electricity production Electricity specific productivity term Heat energy specific productivity term Carbon tax rate for coal Carbon tax rate for oil Carbon tax rate for natural gas CES weight for nuclear and hydro power 71 Solver File This file is the primary solver file used for the global ANEMI model It takes inputs from Vensim calls the appropriate function and produces the solution to the one period energy economy model clear all tic options1 optimset FunValCheck on 1 0 9 TolFun 1 0e 9 MaxFunEvals 1 0e 9 Maxlter 0 100e 3 Display iter NonlEqnAlgorithm dogleg options2 optimset FunValCheck on 1 0 12 TolFun 1 0e 12 MaxFunEvals 1 0e 12 Maxlter 0 501e 3 Display iter NonlEqnAlgorithm lm n 121 time linspace 1 n 121 flag zeros 1 n par check zeros 37 n count2 1 par mat xlsread par values 1 xls eng mat xlsread eng values xls XO cal 2 91358474058133 2 06326283606995 1 62053847133827 4 11331109535488 0 301549557940114 0 194442342794547 0 571260880029906 2 17853176565763 3 05841668528190 3 90908781731049 1 85915914556616 1 48589400409797 1 73994526093445 1 62394359422644 5 06755448357096 3 71373791361643 2 71449037441833 1 43801570954409 0 533396790576313 1 66283102760545 2 0485
146. vals vy vals 0 NA initialize for i 0 i lt narg i x i COMPREAL 1 0 for j 0 j lt 50 j FVENGV execute curloop if rval execution failuer give up should not happen break if rval 1 floating point error VENGV gt error_message VERROR Floating point error in solving MYFINDZERO now generate a floating point error so that Vensim can report back on the problem vensim still knows where it trapped the problem can t use raise SIGFPE because this causes everyting to close via an untrapped exit call maxerr 1 0 0 0 x 0 compiling this will likely generate a warning message 134 now we use maxerr otherwise the the above line will never be executed when the code is optimized if maxerr 0 return 1 return NA give up for this example else for i O maxerr 0 0 i lt narg i if fabs y i gt maxerr maxerr fabs y i xli y i 10 if maxerr lt 1 0 4 break if maxerr gt 1 0 4 sprintf buf MYFINDZERO convergance failure at time 2 gt VENGV error message VERROR buf return x 0 double MYLOOKUP TAB TYPE tab double x REAL xvals yvals inti if IVENGV return NA xvals REAL VENGV gt tabbase tab gt x yvals REAL VENGV gt tabbase tab gt y if x lt xvals 0 return yvals 0 for i 0 i lt tab gt Ist
Download Pdf Manuals
Related Search
Related Contents
Philips PFL3403D User's Manual BENDIX BW7537 User's Manual Audition numéro - Le Grand Débat Samsung BN68-02624A-05 User's Manual mode d`emploi et education therapeutique montauban 18 iHome iHM12 User's Manual CopperLink Model 1314 Long Range Ethernet Extender User Manual Manual do utilizador Banheiras de hidromassagem Guía de Trabajos Finales Reducida here - Afnic Copyright © All rights reserved.
Failed to retrieve file