Deterministic model with OBC

I’m trying to solve a deterministic small open economy with an occasionally binding endogenous collateral constraint. I’m using the LMMCP option in the perfect foresight solver but I’m not entirely sure if I’ve specified the MCP condition correctly. I’ve defined the ‘collateral constraint gap’ (collgap) as the difference between debt and the value of the collateral constraint. Then I’ve written the MCP condition as
[mcp = ‘collgap < 0’]
mu = 0;
where mu is the Lagrange multiplier on the collateral constraint. My understanding is that this syntax means “If the collateral constraint gap is negative, set the multiplier = 0, otherwise, set the collateral constraint gap = 0 and let the code determine mu.”
The code computes the (unconstrained) steady state correctly but then I can’t obtain simulations in which the collateral constraint binds for some time. Either mu is zero (up to rounding error) throughout the simulation horizon or the code does not compute the solution. I don’t understand if I have a problem with the code or with the model (perhaps in the calibration).
Any help would be much appreciated.
Thanks
SOE_flowcoll.mod (3.1 KB)

With a smaller shock, the complementary slackness condition seems to work: Either mu or collgap is zero.
SOE_flowcoll.mod (3.2 KB)

Thanks. One issue is that the multiplier is negative the period in which it is non-zero, which I’m guessing has to do with the way in which the complementary slackness condition is written. However, just changing the collateral gap definition creates problems with the solution. The other issue is that increasing either the size of the shock or the persistence a tiny bit also creates problems with the solution.

Have you defined the multiplier and the constraint correctly for it to be zero? Put differently, should it be

1 - mu

or

1+mu

in the Euler equation?

I think it should be 1-mu.

You should check again. A positive sign for the Lagrange multiplier attached to an inequality constraint requires you to write the constraint as g(x)\leq0