FI 20 MOUT.TXT
FI 21 MIN.TXT
FI 22 MTFP.TXT
FI 23 MPFPK.TXT
FI 24 MPFPOPEX.TXT
SET NODOECHO
SET NOCOLOR
************************************************************************** 
** THIS FILE CALCULATES ELECTRICITY TNSP MULTILATERAL TFP FOR 2006-2024 **
** USING REVISED OUTPUT WEIGHTS ******************************************
**************************************************************************
** VARIABLES ARE IN ORDER: YEAR, TOTAL REVENUE, GWH, RATCHETED MAX DEMAND,
** END-USER NOS, CIRCUIT KMS, ENERGY NOT SUPPLIED, PRICE EN NOT SUPPLIED,
** OPEX, PRICE OF OPEX, OVERHEAD MVAKMS, UNDERGROUND MVAKMS, *************
** MVA TRANSFORMER CAPACITY, USER COST OF OVERHEAD LINES, ****************
** USER COST OF UNDERGROUND CABLES, USER COST OF TRANSFORMERS & OTHER, ***
** ADJ VENS **************************************************************
**************************************************************************
** OUTPUTS ARE GWH, RATCHETED MAX DEMAND, END-USER NOs, CIRCUIT LENGTH, **
** ADJUSTED ENERGY NOT SERVED ********************************************
** USING LEONTIEF COST FN SHARES OF 0.09, 0.29, 0.09, 0.53, RESP'LY ******
** INPUTS ARE OPEX, OH MVAKMS, UG MVAKMS, MVA TRF CAP & OTHER ASSETS *****
**************************************************************************
SMPL 1 95
read(TNSPdata.csv) TNSPYear Revenue	Energy RMDemand	EndUser	CircLen EnNotSer PrEnNotS &	
  Opex PrOpex OHLines UGCables Transf AUCOH	AUCUG AUCTrans AdjVENS / skiplines=1
GENR X2=OHLines
GENR X3=UGCables
GENR X4=Transf
GENR R1=PrOpex
GENR VI1=Opex
GENR VI2=AUCOH
GENR VI3=AUCUG
GENR VI4=AUCTrans
GENR Q1=Energy
GENR Q2=RMDemand
GENR Q3=EndUser
GENR Q4=CircLen
genr Q5=EnNotSer
GENR GR=Revenue+AdjVENS
GENR V1=GR*0.09445
GENR V2=GR*0.28685
GENR V3=GR*0.0933
GENR V4=GR*0.5254
GENR V5=-1*AdjVENS
GENR X1=VI1/R1
DO #=1,5
GENR P#=V#/Q#
GENR SO#=V#/GR
ENDO
DO #=2,4
GENR R#=VI#/X#
ENDO
GENR TC=VI1+VI2+VI3+VI4
DO #=1,4
GENR SI#=VI#/TC
ENDO
**********************************************************************
** MULTILATERAL CCD OUTPUT INDEX *************************************
**********************************************************************
GENR CCDOI=0
GENR TV=0
DO #=1,5
GENR TV=TV+Q#*P#
ENDO
DO #=1,5
GENR V=Q#*P#/TV
GENR LQ=LOG(Q#)
?STAT V/MEAN=VM
?STAT LQ/MEAN=LQM
GENR CCDOI=CCDOI+0.5*(V+VM)*(LQ-LQM)
ENDO
GEN1 BASEO=CCDOI:1
GENR CCDOI=CCDOI-BASEO
GENR CCDOI=EXP(CCDOI)
**********************************************************************
** MULTILATERAL CCD INPUT INDEX **************************************
**********************************************************************
GENR CCDII=0
GENR TV=0
DO #=1,4
GENR TV=TV+X#*R#
ENDO
DO #=1,4
GENR W=X#*R#/TV
GENR LX=LOG(X#)
?STAT W/MEAN=WM
?STAT LX/MEAN=LXM
GENR CCDII=CCDII+0.5*(W+WM)*(LX-LXM)
ENDO
GEN1 BASE=CCDII:1
GENR CCDII=CCDII-BASE
GENR CCDII=EXP(CCDII)
**********************************************************************
** MULTILATERAL CCD CAPITAL INPUT INDEX ******************************
**********************************************************************
GENR CCDKI=0
GENR TK=0
DO #=2,4
GENR TK=TK+X#*R#
ENDO
DO #=2,4
GENR WK=X#*R#/TK
GENR LXK=LOG(X#)
?STAT WK/MEAN=WKM
?STAT LXK/MEAN=LXKM
GENR CCDKI=CCDKI+0.5*(WK+WKM)*(LXK-LXKM)
ENDO
GEN1 BASEK=CCDKI:1
GENR CCDKI=CCDKI-BASEK
GENR CCDKI=EXP(CCDKI)
**********************************************************************
** MULTILATERAL CCD TFP INDEX ****************************************
**********************************************************************
GENR CCDTFP=CCDOI/CCDII
DO #=1,5
GEN1 BASEO#=Q#(1)
GENR QB#=Q#/BASEO#
ENDO
DO #=1,4
GEN1 BASE#=X#(1)
GENR XB#=X#/BASE#
GENR PP#=CCDOI/XB#
ENDO
GENR PPK=CCDOI/CCDKI
PRINT TNSPYEAR QB1-QB5 / WIDE
PRINT TNSPYEAR SO1-SO5 / WIDE
PRINT TNSPYEAR XB1-XB4
PRINT TNSPYEAR SI1-SI4
PRINT TNSPYEAR PP1 PPK PP2-PP4 / WIDE
PRINT TNSPYEAR CCDOI CCDII CCDTFP
**********************************************************************
** WRITE INDEXES TO FILES ********************************************
**********************************************************************
FORMAT(13F8.4)
SMPL 1 19
WRITE (20) CCDOI / FORMAT NOREWIND
SMPL 20 38
WRITE (20) CCDOI / FORMAT NOREWIND
SMPL 39 57
WRITE (20) CCDOI / FORMAT NOREWIND
SMPL 58 76
WRITE (20) CCDOI / FORMAT NOREWIND
SMPL 77 95
WRITE (20) CCDOI / FORMAT NOREWIND
SMPL 1 19
WRITE (21) CCDII / FORMAT NOREWIND
SMPL 20 38
WRITE (21) CCDII / FORMAT NOREWIND
SMPL 39 57
WRITE (21) CCDII / FORMAT NOREWIND
SMPL 58 76
WRITE (21) CCDII / FORMAT NOREWIND
SMPL 77 95
WRITE (21) CCDII / FORMAT NOREWIND
SMPL 1 19
WRITE (22) CCDTFP / FORMAT NOREWIND
SMPL 20 38
WRITE (22) CCDTFP / FORMAT NOREWIND
SMPL 39 57
WRITE (22) CCDTFP / FORMAT NOREWIND
SMPL 58 76
WRITE (22) CCDTFP / FORMAT NOREWIND
SMPL 77 95
WRITE (22) CCDTFP / FORMAT NOREWIND
SMPL 1 19
WRITE (23) PPK / FORMAT NOREWIND
SMPL 20 38
WRITE (23) PPK / FORMAT NOREWIND
SMPL 39 57
WRITE (23) PPK / FORMAT NOREWIND
SMPL 58 76
WRITE (23) PPK / FORMAT NOREWIND
SMPL 77 95
WRITE (23) PPK / FORMAT NOREWIND
SMPL 1 19
WRITE (24) PP1 / FORMAT NOREWIND
SMPL 20 38
WRITE (24) PP1 / FORMAT NOREWIND
SMPL 39 57
WRITE (24) PP1 / FORMAT NOREWIND
SMPL 58 76
WRITE (24) PP1 / FORMAT NOREWIND
SMPL 77 95
WRITE (24) PP1 / FORMAT NOREWIND
STOP