diff --git a/ModFile.cc b/ModFile.cc
index 553f0b3e2ea0b1829d56e0373438064cc2cbb7a0..554901776c5937822b7ace9f134407bcafa8bcbf 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -39,7 +39,7 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
     steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
     linear(false), block(false), byte_code(false), use_dll(false), no_static(false), 
     differentiate_forward_vars(false),
-    nonstationary_variables(false), orig_eqn_nbr(0),
+    nonstationary_variables(false), orig_eqn_nbr(0), ramsey_eqn_nbr(0),
     warnings(warnings_arg)
 {
 }
@@ -349,6 +349,7 @@ ModFile::transformPass(bool nostrict)
       dynamic_model.cloneDynamic(ramsey_FOC_equations_dynamic_model);
       ramsey_FOC_equations_dynamic_model.computeRamseyPolicyFOCs(*planner_objective);
       ramsey_FOC_equations_dynamic_model.replaceMyEquations(dynamic_model);
+      ramsey_eqn_nbr = dynamic_model.equation_number() - orig_eqn_nbr;
     }
 
   if (mod_file_struct.stoch_simul_present
@@ -741,7 +742,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
     mOutputFile << "addpath " << basename << ";" << endl;
 
   mOutputFile << "M_.orig_eq_nbr = " << orig_eqn_nbr << ";" << endl
-              << "M_.eq_nbr = " << dynamic_model.equation_number() << ";" << endl;
+              << "M_.eq_nbr = " << dynamic_model.equation_number() << ";" << endl
+              << "M_.ramsey_eq_nbr = " << ramsey_eqn_nbr << ";" << endl;
 
   if (dynamic_model.equation_number() > 0)
     {
diff --git a/ModFile.hh b/ModFile.hh
index 465d905eaa819ff10512cc98a52840c48cca1246..d8b042a73ed55c6749140b7ec603b9e407decec8 100644
--- a/ModFile.hh
+++ b/ModFile.hh
@@ -95,6 +95,9 @@ public:
   //! Stores the original number of equations in the model_block
   int orig_eqn_nbr;
 
+  //! Stores the number of equations added to the Ramsey model
+  int ramsey_eqn_nbr;
+
   //! Stores the list of extra files to be transefered during a parallel run
   /*! (i.e. option parallel_local_files of model block) */
   vector<string> parallel_local_files;