User Tools

Site Tools


howtos:toolcoding:projecting_a_share_into_simulation_time

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:toolcoding:projecting_a_share_into_simulation_time [2009/12/01 16:19]
shona.weldon created
howtos:toolcoding:projecting_a_share_into_simulation_time [2011/02/15 21:36] (current)
marcus.williams
Line 1: Line 1:
 ====== Projecting Share Variables into Simulation Time ====== ====== Projecting Share Variables into Simulation Time ======
  
-Projecting share variables from history into the simulation time using a saturating projection is a common way to create the business as usual data for these variables.  ​Attached is a template for a simulation view script ​to do this for any share variable summing to over one dimension.+Projecting share variables from history into the simulation time using a saturating projection is a common way to create the business as usual data for these variables.  ​ 
 + 
 +To find the sub-routine related files look in: 
 +\\maxwell\whatif\whatifdocs\toolSubroutines\satProj 
 + 
 + 
 +===== Example call to the sub-routine ===== 
 +<​code>​ 
 +! NOTE these informants should be put into your model then these lines should not be included when calling the sub routine 
 +skipto afterInformants 
 +localinformant yearInfoSet[] = create (; object=set, \ 
 + desc="​defaults wrt projection year", \ 
 + elemName1 = "​min",​ \ 
 + elemName2 = "​max",​ \ 
 + elemName3 = "​default",​ \ 
 + elemName4 = "​timeDimNum"​) 
 +localinformant boundsInfoSet[] = create (; object=set, \ 
 + desc="​defaults wrt bounds checking",​ \ 
 + elemName1 = "​setMax",​ \ 
 + elemName2 = "​maxVal",​ \ 
 + elemName3 = "​setMin",​ \ 
 + elemName4 = "​minVal"​) 
 +localinformant normInfoSet[] = create (; object=set, \ 
 + desc="​defaults wrt normalizing",​ \ 
 + elemName1 = "​doRenorm",​ \ 
 + elemName2 = "​normDimNum"​)  
 +afterInformants:​ 
 + 
 +local varHis[upperdims,​timeseq] = newSizeShrPU[cr,​vcld,​t][1] 
 +local varResult[upperdims,​timeseq] = newSizeShrPU[cr,​vcld,​t][3] 
 + 
 +local yearInfoForProj[yearInfoSet] = create (; dim=yearInfoSet,​ dataType=integer) 
 +yearInfoForProj[yearInfoSet] = insert (1982; yearInfoSet:​min) 
 +yearInfoForProj[yearInfoSet] = insert (2000; yearInfoSet:​max) 
 +yearInfoForProj[yearInfoSet] = insert (1982; yearInfoSet:​default) 
 +yearInfoForProj[yearInfoSet] = insert (3; yearInfoSet:​timeDimNum) 
 + 
 +local boundsChecking[boundsInfoSet] = create (; dim=boundsInfoSet) 
 +boundsChecking[boundsInfoSet] = insert (1.0; boundsInfoSet:​setMax) 
 +boundsChecking[boundsInfoSet] = insert (1.0; boundsInfoSet:​maxVal) 
 +boundsChecking[boundsInfoSet] = insert (1.0; boundsInfoSet:​setMin) 
 +boundsChecking[boundsInfoSet] = insert (0.0; boundsInfoSet:​minVal) 
 + 
 +local normInfo[normInfoSet] = create (; dim=normInfoSet,​ dataType=integer) 
 +normInfo[yearInfoSet] = insert (1; normInfoSet:​doRenorm) 
 +normInfo[yearInfoSet] = insert (2; normInfoSet:​normDimNum) 
 + 
 +local percentChgFromLYHis[] = create (; data=50.0) 
 + 
 +local defaultJoin[] = create (; data=2) ! join trend  
 + 
 +local firstHisYearForProjection[],​ asymtoticPercentChange[],​ joinMethod[] 
 + 
 +string $viewDesc = "view myViewName: " 
 + 
 +tool $informPath/​satProjFromHist.t \ 
 + yearInfoForProj[yearInfoSet] \ 
 + boundsChecking[boundsInfoSet] \ 
 + normInfo[normInfoSet] \ 
 + percentChgFromLYHis[] \ 
 + defaultJoin[] \ 
 + varHis[upperdims,​timeseq] \ 
 + varResult[upperdims,​timeseq] \ 
 + firstHisYearForProjection[] \ 
 + asymtoticPercentChange[] \ 
 + joinMethod[] 
 +  
 + 
 +integer $firstHisYearForProjection 
 +getobjinfo (firstHisYearForProjection[],​ $firstHisYearForProjection;​ info=dataElement) 
 +buildstring ($viewDesc,​$viewDesc,"​first year of history ​for projection = ",​$firstHisYearForProjection,":​ ") 
 + 
 +string $asymtoticPercentChange 
 +getobjinfo (asymtoticPercentChange[],​ $asymtoticPercentChange;​ info=dataElement) 
 +buildstring ($viewDesc,​$viewDesc,"​asymtotic percent change = ",​$asymtoticPercentChange,":​ ") 
 + 
 +integer $joinMethod 
 +getobjinfo (joinMethod[],​ $joinMethod;​ info=dataElement) 
 +if $joinMethod == 1 
 + buildstring ($viewDesc,​$viewDesc,"​join to projection of last 2 years of history"​) 
 +endif 
 +if $joinMethod == 2 
 + buildstring ($viewDesc,​$viewDesc,"​join to trend line"​) 
 +endif 
 +if $joinMethod == 3 
 + buildstring ($viewDesc,​$viewDesc,"​join to trend projection of last history year"​) 
 +endif 
 + 
 +newSizeShrPU[cr,​vcld,​t][3] = assign (varResult[upperdims,​timeseq];​ desc=$viewDesc) 
 + 
 +newPUVehShr[cr,​vcld->​vpsld,​ts][3] = mapcat (newSizeShrPU[cr,​vcld,​t][3] * \ 
 + newEngineShrPU[cr,​vcld,​vpsld,​th][2];​ category=vcldCOvpsld,​ \ 
 +desc=$viewMenuChoices) 
 + 
 + 
 + 
 +</​code>​ 
 + 
 +===== How to load ===== 
 +Go to your informants window in SAMM and load the informs.samm file from your sub-routine directory
  
-At the top of the file there are directions for how to customize the view to your share variable. 
-{{:​howtos:​toolcoding:​satprojshrfromhist_template.t|}} 
  
howtos/toolcoding/projecting_a_share_into_simulation_time.1259684349.txt.gz · Last modified: 2009/12/01 16:19 by shona.weldon