.GCM Syntax Help - Solve Base Model then run Fiscal Sim

Questions regarding data management and analysis, including import/export of (timeseries) data, graphing, etc.
MTmanc
Posts: 2
Joined: Wed Jul 15, 2020 8:36 pm

.GCM Syntax Help - Solve Base Model then run Fiscal Sim

Postby MTmanc » Wed Jul 15, 2020 8:55 pm

Gekko version 3.1.4 (develop)
New User: I wonder if anyone could help with the syntax which I have been struggling with correct syntax to achieve the following:

1. Opening multiple .CSV files into a New .GBK
I am trying to open/merge multiple .CSV files (around 100) into a working "internal" db eg Test1_u.GBK.
I cant seem to get the syntax right to "open" up an .GBK before Importing all the .CSV - see my attempt below with commented lines where errors occurred.

Code: Select all

// From Command Line:  RUN C:\data\Gekko\mod\Test1_u.gcm
MODE data;      //  MODE mixed;
MODEL C:\data\Gekko\mod\Test1_u.frm;
OPTION freq = q; 
// OPEN<create> Test1_u.gbk;
OPEN Test1_u.gbk;
// CLOSE Test1_u.gbk;
IMPORT <csv> c:\data\ws_dat\US_GEN1_GDP to Test1_u;
IMPORT <csv> c:\data\ws_dat\US_GEN1_C to Test1_u;
IMPORT <csv> c:\data\ws_dat\US_GEN1_xGC to Test1_u;
// OPTION solve method = Gauss-Seidel;
STOP;

Once .CSV data is imported I want to then Solve the model (see below)dynamically using G-S over 1973q1-2040q4 - presum. I need to switch mode to "sim" to do this (or just set "mixed" mode at the outset ?)

Code: Select all

FRML _I     GDP_u  = C_u + IF_u + xGC_u;
FRML _S     C_u  = (1 - Dc) * (0.4 * GDP_u + 0.4 * GDP_u[-1] + Jc) + Dc * Zc;
FRML Y      Jc = C_u - (0.4 * GDP_u + 0.4 * GDP_u[-1]);
FRML Y      Zc = C_u;
FRML T      cGDP_u = C_u/GDP_u;


2. Projecting C_u at 1% growth each quarter + Fix over 2020q1-2040q4 & solve using Gauss-Seidel; then Unfixing (to reveal an implied C_u residual over the forecast period 2020q1-2040q4) so that C_u can subsequently react in a Sim (see 3 below). Saving all results to 1973q1-2040q4 so they can be used in 3 below.

3. Running a Sim where Exogenous xGC_u is boosted 10% over 2021q1-2040q4 - then dumping seperate output .CSVs over all variables converted to annual data to power some charts.

Appreciate any guidance/tips to get the .GCM syntax correct - thanks

(BTW Is there any guidance/routines for converting a .TXT model from WinSolve format to Gekko format ?)

---------- .CSV DATA FILES (as I can't seem to attach the .CSV listed in the above code)

Code: Select all

Period,GDP_u
1973Q1,1410.67
1973Q2,1426.02
1973Q3,1418.53
1973Q4,1431.99
1974Q1,1419.68
1974Q2,1423.05
1974Q3,1409.6
1974Q4,1404.13
1975Q1,1387.04
1975Q2,1396.95
1975Q3,1420.86
1975Q4,1439.99
1976Q1,1472.38
1976Q2,1483.18
1976Q3,1491.32
1976Q4,1502.13
1977Q1,1519.87
1977Q2,1549.42
1977Q3,1577.38
1977Q4,1577.41
1978Q1,1582.45
1978Q2,1643.6
1978Q3,1660.12
1978Q4,1682.44
1979Q1,1685.46
1979Q2,1687.27
1979Q3,1699.8
1979Q4,1704.05
1980Q1,1709.41
1980Q2,1674.19
1980Q3,1672.2
1980Q4,1703.38
1981Q1,1736.76
1981Q2,1723.89
1981Q3,1744.53
1981Q4,1725.53
1982Q1,1698.72
1982Q2,1706.47
1982Q3,1699.95
1982Q4,1700.62
1983Q1,1723.04
1983Q2,1762.25
1983Q3,1797.47
1983Q4,1834.97
1984Q1,1870.84
1984Q2,1903.17
1984Q3,1921.51
1984Q4,1937.29
1985Q1,1956.06
1985Q2,1973.28
1985Q3,2003.42
1985Q4,2018.31
1986Q1,2037.15
1986Q2,2046.33
1986Q3,2065.91
1986Q4,2077.01
1987Q1,2092.48
1987Q2,2115.06
1987Q3,2133.41
1987Q4,2170.04
1988Q1,2181.25
1988Q2,2209.91
1988Q3,2222.86
1988Q4,2252.48
1989Q1,2275.38
1989Q2,2292.74
1989Q3,2309.73
1989Q4,2314.28
1990Q1,2339.57
1990Q2,2348.06
1990Q3,2349.62
1990Q4,2328.23
1991Q1,2317.34
1991Q2,2335.41
1991Q3,2347.21
1991Q4,2355.39
1992Q1,2383.59
1992Q2,2409.43
1992Q3,2433.24
1992Q4,2458.63
1993Q1,2462.74
1993Q2,2477.09
1993Q3,2488.91
1993Q4,2522.76
1994Q1,2547.24
1994Q2,2581.75
1994Q3,2596.85
1994Q4,2626.59
1995Q1,2635.91
1995Q2,2643.78
1995Q3,2666.27
1995Q4,2684.37
1996Q1,2704.47
1996Q2,2749.58
1996Q3,2774.24
1996Q4,2803.05
1997Q1,2821.15
1997Q2,2868.03
1997Q3,2903.91
1997Q4,2928.85
1998Q1,2958.12
1998Q2,2985.51
1998Q3,3022.9
1998Q4,3071.75
1999Q1,3100.82
1999Q2,3124.67
1999Q3,3165.6
1999Q4,3219.4
2000Q1,3231.04
2000Q2,3290.21
2000Q3,3294.6
2000Q4,3315.13
2001Q1,3305.67
2001Q2,3325
2001Q3,3311.2
2001Q4,3320.21
2002Q1,3349.25
2002Q2,3369.54
2002Q3,3384.52
2002Q4,3389.76
2003Q1,3408.56
2003Q2,3437.89
2003Q3,3496.27
2003Q4,3536.41
2004Q1,3555.29
2004Q2,3582.38
2004Q3,3616.25
2004Q4,3652.47
2005Q1,3692.9
2005Q2,3709.95
2005Q3,3743.01
2005Q4,3766.65
2006Q1,3816.76
2006Q2,3825.68
2006Q3,3831.59
2006Q4,3864.23
2007Q1,3873.33
2007Q2,3895.52
2007Q3,3916.68
2007Q4,3940.49
2008Q1,3917.85
2008Q2,3938.08
2008Q3,3916.76
2008Q4,3832.01
2009Q1,3788.99
2009Q2,3783.53
2009Q3,3797.31
2009Q4,3839.01
2010Q1,3853.79
2010Q2,3889.32
2010Q3,3917.99
2010Q4,3937.66
2011Q1,3928.19
2011Q2,3956.27
2011Q3,3955.18
2011Q4,4001.03
2012Q1,4032.35
2012Q2,4049.7
2012Q3,4055.17
2012Q4,4059.78
2013Q1,4095.74
2013Q2,4100.8
2013Q3,4132.92
2013Q4,4165.91
2014Q1,4154.14
2014Q2,4210.37
2014Q3,4261.77
2014Q4,4285.76
2015Q1,4319.4
2015Q2,4351.42
2015Q3,4365.81
2015Q4,4367.23
2016Q1,4389.21
2016Q2,4409.85
2016Q3,4433.77
2016Q4,4456.06
2017Q1,4481.31
2017Q2,4505.26
2017Q3,4540.89
2017Q4,4580.62
2018Q1,4609.56
2018Q2,4649.53
2018Q3,4683.18
2018Q4,4695.89
2019Q1,4731.82
2019Q2,4755.47
2019Q3,4780.28
2019Q4,4805.12
2020Q1,
2020Q2,
2020Q3,
2020Q4,
2021Q1,
2021Q2,
2021Q3,
2021Q4,
2022Q1,
2022Q2,
2022Q3,
2022Q4,
2023Q1,
2023Q2,
2023Q3,
2023Q4,
2024Q1,
2024Q2,
2024Q3,
2024Q4,
2025Q1,
2025Q2,
2025Q3,
2025Q4,
2026Q1,
2026Q2,
2026Q3,
2026Q4,
2027Q1,
2027Q2,
2027Q3,
2027Q4,
2028Q1,
2028Q2,
2028Q3,
2028Q4,
2029Q1,
2029Q2,
2029Q3,
2029Q4,
2030Q1,
2030Q2,
2030Q3,
2030Q4,
2031Q1,
2031Q2,
2031Q3,
2031Q4,
2032Q1,
2032Q2,
2032Q3,
2032Q4,
2033Q1,
2033Q2,
2033Q3,
2033Q4,
2034Q1,
2034Q2,
2034Q3,
2034Q4,
2035Q1,
2035Q2,
2035Q3,
2035Q4,
2036Q1,
2036Q2,
2036Q3,
2036Q4,
2037Q1,
2037Q2,
2037Q3,
2037Q4,
2038Q1,
2038Q2,
2038Q3,
2038Q4,
2039Q1,
2039Q2,
2039Q3,
2039Q4,
2040Q1,
2040Q2,
2040Q3,
2040Q4,


Code: Select all

Period,C_u
1973Q1,891.74
1973Q2,891.34
1973Q3,894.47
1973Q4,891.81
1974Q1,883.83
1974Q2,887.01
1974Q3,890.82
1974Q4,877.8
1975Q1,885.16
1975Q2,899.72
1975Q3,912.51
1975Q4,922.32
1976Q1,940.76
1976Q2,949.42
1976Q3,959.41
1976Q4,971.86
1977Q1,983.32
1977Q2,988.65
1977Q3,998
1977Q4,1013
1978Q1,1018.69
1978Q2,1040.47
1978Q3,1044.84
1978Q4,1053.27
1979Q1,1058.73
1979Q2,1058.04
1979Q3,1068.34
1979Q4,1070.99
1980Q1,1069.46
1980Q2,1045.38
1980Q3,1056.84
1980Q4,1071.12
1981Q1,1074.71
1981Q2,1074.79
1981Q3,1079.76
1981Q4,1072.38
1982Q1,1080.28
1982Q2,1083.57
1982Q3,1090.83
1982Q4,1109.94
1983Q1,1120.91
1983Q2,1143.74
1983Q3,1164.25
1983Q4,1182.8
1984Q1,1192.61
1984Q2,1209.32
1984Q3,1218.29
1984Q4,1234.07
1985Q1,1255.04
1985Q2,1266.56
1985Q3,1290.62
1985Q4,1293.41
1986Q1,1304.71
1986Q2,1318.93
1986Q3,1342.26
1986Q4,1350.5
1987Q1,1351.84
1987Q2,1370.29
1987Q3,1385.93
1987Q4,1388.86
1988Q1,1413.4
1988Q2,1423.83
1988Q3,1436.48
1988Q4,1452.82
1989Q1,1459.56
1989Q2,1466.37
1989Q3,1480.57
1989Q4,1487
1990Q1,1499.51
1990Q2,1504.08
1990Q3,1510.04
1990Q4,1498.55
1991Q1,1492.92
1991Q2,1505.29
1991Q3,1512.8
1991Q4,1512.04
1992Q1,1540.35
1992Q2,1550.81
1992Q3,1567.43
1992Q4,1586.11
1993Q1,1592.19
1993Q2,1606.68
1993Q3,1624.56
1993Q4,1638.82
1994Q1,1657.56
1994Q2,1670.46
1994Q3,1683.2
1994Q4,1701.4
1995Q1,1705.63
1995Q2,1720.58
1995Q3,1736.18
1995Q4,1748.29
1996Q1,1764.41
1996Q2,1783.39
1996Q3,1794.19
1996Q4,1808.48
1997Q1,1827.54
1997Q2,1835.77
1997Q3,1867.05
1997Q4,1889.36
1998Q1,1908.47
1998Q2,1942.08
1998Q3,1967.41
1998Q4,1995.83
1999Q1,2015.19
1999Q2,2044.58
1999Q3,2067.65
1999Q4,2097.95
2000Q1,2130.18
2000Q2,2150.75
2000Q3,2171.87
2000Q4,2190.55
2001Q1,2199.32
2001Q2,2204.52
2001Q3,2212.08
2001Q4,2245.15
2002Q1,2252.02
2002Q2,2263.59
2002Q3,2279.99
2002Q4,2293.09
2003Q1,2303.88
2003Q2,2329.75
2003Q3,2363.92
2003Q4,2379.95
2004Q1,2401.13
2004Q2,2416.07
2004Q3,2442.78
2004Q4,2469.35
2005Q1,2483.76
2005Q2,2511.94
2005Q3,2536.32
2005Q4,2543.86
2006Q1,2572.22
2006Q2,2585.25
2006Q3,2600.95
2006Q4,2626.12
2007Q1,2640.82
2007Q2,2645.71
2007Q3,2660.62
2007Q4,2668.2
2008Q1,2661.11
2008Q2,2665.42
2008Q3,2645.46
2008Q4,2620.84
2009Q1,2614.92
2009Q2,2604.33
2009Q3,2622.3
2009Q4,2618.41
2010Q1,2631.36
2010Q2,2652.29
2010Q3,2670.84
2010Q4,2688.5
2011Q1,2699.94
2011Q2,2705.91
2011Q3,2716.51
2011Q4,2721.47
2012Q1,2743.33
2012Q2,2747.4
2012Q3,2751.88
2012Q4,2764.21
2013Q1,2778.55
2013Q2,2780.55
2013Q3,2791.86
2013Q4,2815.91
2014Q1,2827
2014Q2,2857.96
2014Q3,2888.71
2014Q4,2923.74
2015Q1,2948.03
2015Q2,2971.5
2015Q3,2994.15
2015Q4,3007.56
2016Q1,3031.05
2016Q2,3052.82
2016Q3,3072.27
2016Q4,3091.33
2017Q1,3109.72
2017Q2,3128.22
2017Q3,3146.57
2017Q4,3182.43
2018Q1,3195.73
2018Q2,3227.3
2018Q3,3254.95
2018Q4,3266.58
2019Q1,3275.83
2019Q2,3312.51
2019Q3,3338.28
2019Q4,3352.6
2020Q1,
2020Q2,
2020Q3,
2020Q4,
2021Q1,
2021Q2,
2021Q3,
2021Q4,
2022Q1,
2022Q2,
2022Q3,
2022Q4,
2023Q1,
2023Q2,
2023Q3,
2023Q4,
2024Q1,
2024Q2,
2024Q3,
2024Q4,
2025Q1,
2025Q2,
2025Q3,
2025Q4,
2026Q1,
2026Q2,
2026Q3,
2026Q4,
2027Q1,
2027Q2,
2027Q3,
2027Q4,
2028Q1,
2028Q2,
2028Q3,
2028Q4,
2029Q1,
2029Q2,
2029Q3,
2029Q4,
2030Q1,
2030Q2,
2030Q3,
2030Q4,
2031Q1,
2031Q2,
2031Q3,
2031Q4,
2032Q1,
2032Q2,
2032Q3,
2032Q4,
2033Q1,
2033Q2,
2033Q3,
2033Q4,
2034Q1,
2034Q2,
2034Q3,
2034Q4,
2035Q1,
2035Q2,
2035Q3,
2035Q4,
2036Q1,
2036Q2,
2036Q3,
2036Q4,
2037Q1,
2037Q2,
2037Q3,
2037Q4,
2038Q1,
2038Q2,
2038Q3,
2038Q4,
2039Q1,
2039Q2,
2039Q3,
2039Q4,
2040Q1,
2040Q2,
2040Q3,
2040Q4,


Code: Select all

Period,xGC_u
1973Q1,177.67
1973Q2,179.47
1973Q3,181.28
1973Q4,183.11
1974Q1,184.96
1974Q2,186.83
1974Q3,188.72
1974Q4,190.62
1975Q1,192.55
1975Q2,194.49
1975Q3,196.46
1975Q4,198.44
1976Q1,200.45
1976Q2,202.47
1976Q3,204.52
1976Q4,206.58
1977Q1,208.67
1977Q2,210.78
1977Q3,212.9
1977Q4,215.06
1978Q1,217.23
1978Q2,219.42
1978Q3,221.64
1978Q4,223.88
1979Q1,226.14
1979Q2,228.42
1979Q3,230.73
1979Q4,233.06
1980Q1,235.41
1980Q2,237.79
1980Q3,240.19
1980Q4,242.62
1981Q1,245.07
1981Q2,247.55
1981Q3,250.05
1981Q4,252.57
1982Q1,255.12
1982Q2,257.7
1982Q3,260.3
1982Q4,262.93
1983Q1,265.59
1983Q2,268.27
1983Q3,270.98
1983Q4,273.72
1984Q1,276.48
1984Q2,279.28
1984Q3,282.1
1984Q4,284.95
1985Q1,287.83
1985Q2,290.73
1985Q3,293.67
1985Q4,296.64
1986Q1,299.63
1986Q2,302.66
1986Q3,305.72
1986Q4,308.8
1987Q1,311.92
1987Q2,315.07
1987Q3,318.26
1987Q4,321.47
1988Q1,324.72
1988Q2,328
1988Q3,331.31
1988Q4,334.66
1989Q1,338.04
1989Q2,341.45
1989Q3,344.9
1989Q4,348.39
1990Q1,351.91
1990Q2,355.46
1990Q3,359.05
1990Q4,362.68
1991Q1,366.34
1991Q2,370.04
1991Q3,373.78
1991Q4,377.55
1992Q1,381.37
1992Q2,385.22
1992Q3,389.11
1992Q4,393.04
1993Q1,397.01
1993Q2,401.02
1993Q3,405.07
1993Q4,409.16
1994Q1,413.3
1994Q2,417.47
1994Q3,421.69
1994Q4,425.95
1995Q1,430.25
1995Q2,434.6
1995Q3,438.99
1995Q4,443.42
1996Q1,447.9
1996Q2,452.42
1996Q3,456.99
1996Q4,461.61
1997Q1,466.27
1997Q2,470.98
1997Q3,475.74
1997Q4,480.55
1998Q1,485.4
1998Q2,490.3
1998Q3,495.26
1998Q4,500.26
1999Q1,505.31
1999Q2,510.41
1999Q3,515.57
1999Q4,520.78
2000Q1,526.04
2000Q2,531.35
2000Q3,536.72
2000Q4,542.14
2001Q1,547.62
2001Q2,553.15
2001Q3,558.74
2001Q4,564.38
2002Q1,570.08
2002Q2,574.75
2002Q3,576.06
2002Q4,579.36
2003Q1,580.22
2003Q2,587.13
2003Q3,585.67
2003Q4,589.53
2004Q1,593.07
2004Q2,594.08
2004Q3,595.83
2004Q4,595.74
2005Q1,599.24
2005Q2,598.07
2005Q3,600.59
2005Q4,600.76
2006Q1,606.5
2006Q2,604.83
2006Q3,605.76
2006Q4,610.88
2007Q1,611.22
2007Q2,615.12
2007Q3,618.2
2007Q4,622.27
2008Q1,624.49
2008Q2,628.08
2008Q3,633.27
2008Q4,639.47
2009Q1,649.15
2009Q2,658.14
2009Q3,659.71
2009Q4,662.79
2010Q1,661.94
2010Q2,661.75
2010Q3,656.33
2010Q4,652.66
2011Q1,645.97
2011Q2,642.39
2011Q3,632.43
2011Q4,632.43
2012Q1,632.26
2012Q2,628.91
2012Q3,630.21
2012Q4,624.6
2013Q1,620.99
2013Q2,620.33
2013Q3,615.68
2013Q4,611.26
2014Q1,611.9
2014Q2,609.85
2014Q3,614.46
2014Q4,612.86
2015Q1,618.54
2015Q2,621.51
2015Q3,624.87
2015Q4,628.75
2016Q1,631.9
2016Q2,632.47
2016Q3,636.57
2016Q4,637.63
2017Q1,636.04
2017Q2,637.47
2017Q3,638.39
2017Q4,641.39
2018Q1,644.58
2018Q2,648
2018Q3,651.51
2018Q4,651.42
2019Q1,653.58
2019Q2,660.08
2019Q3,663.21
2019Q4,666
2020Q1,670.995
2020Q2,676.0274625
2020Q3,681.09766846875
2020Q4,686.205900982266
2021Q1,691.352445239633
2021Q2,696.53758857893
2021Q3,701.761620493272
2021Q4,707.024832646972
2022Q1,712.327518891824
2022Q2,717.669975283513
2022Q3,723.052500098139
2022Q4,728.475393848875
2023Q1,733.938959302742
2023Q2,739.443501497513
2023Q3,744.989327758744
2023Q4,750.576747716935
2024Q1,756.206073324812
2024Q2,761.877618874748
2024Q3,767.591701016308
2024Q4,773.348638773931
2025Q1,779.148753564735
2025Q2,784.992369216471
2025Q3,790.879811985594
2025Q4,796.811410575486
2026Q1,802.787496154803
2026Q2,808.808402375964
2026Q3,814.874465393784
2026Q4,820.986023884237
2027Q1,827.143419063369
2027Q2,833.346994706344
2027Q3,839.597097166642
2027Q4,845.894075395392
2028Q1,852.238280960857
2028Q2,858.630068068064
2028Q3,865.069793578574
2028Q4,871.557817030414
2029Q1,878.094500658142
2029Q2,884.680209413078
2029Q3,891.315310983676
2029Q4,898.000175816054
2030Q1,904.735177134674
2030Q2,911.520690963184
2030Q3,918.357096145408
2030Q4,925.244774366499
2031Q1,932.184110174248
2031Q2,939.175491000554
2031Q3,946.219307183059
2031Q4,953.315951986932
2032Q1,960.465821626834
2032Q2,967.669315289035
2032Q3,974.926835153703
2032Q4,982.238786417356
2033Q1,989.605577315486
2033Q2,997.027619145352
2033Q3,1004.50532628894
2033Q4,1012.03911623611
2034Q1,1019.62940960788
2034Q2,1027.27663017994
2034Q3,1034.98120490629
2034Q4,1042.74356394309
2035Q1,1050.56414067266
2035Q2,1058.44337172771
2035Q3,1066.38169701566
2035Q4,1074.37955974328
2036Q1,1082.43740644136
2036Q2,1090.55568698967
2036Q3,1098.73485464209
2036Q4,1106.9753660519
2037Q1,1115.27768129729
2037Q2,1123.64226390702
2037Q3,1132.06958088633
2037Q4,1140.56010274297
2038Q1,1149.11430351355
2038Q2,1157.7326607899
2038Q3,1166.41565574582
2038Q4,1175.16377316391
2039Q1,1183.97750146264
2039Q2,1192.85733272361
2039Q3,1201.80376271904
2039Q4,1210.81729093943
2040Q1,1219.89842062148
2040Q2,1229.04765877614
2040Q3,1238.26551621696
2040Q4,1247.55250758859

admin
Site Admin
Posts: 7
Joined: Thu May 07, 2015 8:13 am

Re: .GCM Syntax Help - Solve Base Model then run Fiscal Sim

Postby admin » Thu Jul 30, 2020 8:37 am

Hello MTmanc,

I've taken down the forum, because it is not being used much, it attracts spam, and I am looking into other possibilities regarding such questions.

Regarding your first question, use OPEN <edit> Test1_u.gbk; CLEAR Test1_u.gbk;

Regarding the other questions: could you email me? (See mail address at the bottom of this page: http://www.t-t.dk).

Best regards,

-Thomas Thomsen
Gekko project editor


Return to “Data management”

Who is online

Users browsing this forum: No registered users and 1 guest