This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
howtos:toolcoding:projecting_a_share_into_simulation_time [2011/01/07 20:42] shona.weldon |
howtos:toolcoding:projecting_a_share_into_simulation_time [2011/01/31 16:52] shona.weldon |
||
---|---|---|---|
Line 8: | Line 8: | ||
===== Example call to the sub-routine ===== | ===== Example call to the sub-routine ===== | ||
- | |||
- | There is a subroutine which can be hooked into your model and then called from views which does saturated projections with several parameters. | ||
- | |||
- | Here's some reference code you would put in your view to call the sub routine and below that is the code for the sub routine itself: | ||
- | |||
<code> | <code> | ||
! NOTE these informants should be put into your model then these lines should not be included when calling the sub routine | ! NOTE these informants should be put into your model then these lines should not be included when calling the sub routine | ||
Line 56: | Line 51: | ||
local defaultJoin[] = create (; data=2) ! join trend | local defaultJoin[] = create (; data=2) ! join trend | ||
+ | |||
+ | local firstHisYearForProjection[], asymtoticPercentChange[], joinMethod[] | ||
tool $informPath/satProjFromHist.t \ | tool $informPath/satProjFromHist.t \ | ||
Line 64: | Line 61: | ||
defaultJoin[] \ | defaultJoin[] \ | ||
varHis[upperdims,timeseq] \ | varHis[upperdims,timeseq] \ | ||
- | varResult[upperdims,timeseq] | + | varResult[upperdims,timeseq] \ |
+ | firstHisYearForProjection[] \ | ||
+ | asymtoticPercentChange[] \ | ||
+ | joinMethod[] | ||
+ | |||
- | newSizeShrPU[cr,vcld,t][3] = varResult[upperdims,timeseq] | + | 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] * \ | newPUVehShr[cr,vcld->vpsld,ts][3] = mapcat (newSizeShrPU[cr,vcld,t][3] * \ | ||
newEngineShrPU[cr,vcld,vpsld,th][2]; category=vcldCOvpsld, \ | newEngineShrPU[cr,vcld,vpsld,th][2]; category=vcldCOvpsld, \ | ||
desc=$viewMenuChoices) | desc=$viewMenuChoices) | ||
+ | |||