From f67e9c044b5a343818b39cd9331d618166d2a9aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 9 Dec 2020 17:32:08 +0100
Subject: [PATCH] =?UTF-8?q?JSON=20output:=20fix=20=E2=80=9Cvariable=5Fmapp?=
 =?UTF-8?q?ing=E2=80=9D=20for=20Ramsey=20models?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Ref. dynare#1755
---
 src/ModFile.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ModFile.cc b/src/ModFile.cc
index 18e379e2..0752b5da 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -608,7 +608,9 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, bool
     }
   // And finally perform the substitutions
   dynamic_model.substituteVarExpectation(var_expectation_subst_table);
-  dynamic_model.createVariableMapping(original_model.equation_number());
+  dynamic_model.createVariableMapping(mod_file_struct.orig_eq_nbr +
+                                      (mod_file_struct.ramsey_model_present ?
+                                       mod_file_struct.ramsey_eq_nbr : 0));
 
   /* Create auxiliary vars for leads and lags greater than 2, on both endos and
      exos. The transformation is not exactly the same on stochastic and
-- 
GitLab