# Two-country private storage, public reserve, trade policies model:

declarations:

  states: [Aa, Ab]

  controls: [PSa, PSb, Sa, Sb, Ha, Hb, Pa, Pb, Xab, Xba, phia, phib]

  expectations: [EPa, EPb, EPae, EPbe]

  shocks: [ea, eb]

  parameters: [ka, kb, ra, rb, elastSa, elastSb, ha, hb, mua, mub, elastDa, elastDb, gammaa, gammab, thetaab, thetaba, phiamax, phibmax, Xabmax, Xbamax, Pamax, Pbmax, sca, scb]

equations:

  arbitrage:

    .. Pa-Pamax                         |    0 <= PSa   <= sca
    .. Pb-Pbmax                         |    0 <= PSb   <= scb
    .. Pa+ka-EPa/(1+ra)                  |    0 <= Sa    <= inf
    .. Pb+kb-EPb/(1+rb)                  |    0 <= Sb    <= inf
    .. EPae/(1+ra) = ha*Ha^mua           | -inf <= Ha    <= inf
    .. EPbe/(1+rb) = hb*Hb^mub           | -inf <= Hb    <= inf
    .. Aa+Xba = gammaa*Pa^elastDa+Sa+PSa+Xab | -inf <= Pa    <= inf
    .. Ab+Xab = gammab*Pb^elastDb+Sb+PSb+Xba | -inf <= Pb    <= inf
    .. Pa-Pb+thetaab+phia                    |    0 <= Xab <= Xabmax
    .. Pb-Pa+thetaba+phib                    |    0 <= Xba <= Xbamax
    .. Pamax - Pa + PSa - sca           |    0 <= phia <= phiamax
    .. Pbmax - Pb + PSb - scb           |    0 <= phib <= phibmax


  transition:

    .. Aa  = PSa(-1)+Sa(-1)+Ha(-1)*ea
    .. Ab  = PSb(-1)+Sb(-1)+Hb(-1)*eb


  expectation:

    .. EPa  = Pa(1)
    .. EPb  = Pb(1)
    .. EPae = Pa(1)*ea
    .. EPbe = Pb(1)*eb


calibration:

  parameters:

    ka      :  0.06
    kb      :  0.06
    ra     :  0.03
    rb     :  ra
    elastSa :  0.2
    elastSb :  0.2
    ha     : 1/(1+ra)
    hb     : 1/(1+rb)
    mua     : 1/elastSa
    mub     : 1/elastSb
    elastDa : -0.2
    elastDb : -0.2
    gammaa  : 1.0
    gammab  : 1.0
    thetaab  : 0.05
    thetaba  : 0.05
    phiamax  : 0
    phibmax  : 0
    Xabmax   : 10000
    Xbamax   : 10000
    Pamax    :  1.4
    Pbmax    :  1.4
    sca  :  0.1
    scb  :  0.1

  steady_state:

    Aa    : 1+sca
    Ab    : 1+scb
    PSa   : sca
    PSb   : scb
    Sa    : 0
    Sb    : 0
    Ha    : 1
    Hb    : 1
    Pa    : 1
    Pb    : 1
    Xab   : 0
    Xba   : 0
    phia  : 0
    phib  : 0
 
