modify Julia output for mapping eqidx

issue#70
Michel Juillard 2020-03-17 09:27:10 +01:00
parent 7d1a467aa3
commit d668590ff8
1 changed files with 21 additions and 5 deletions

View File

@ -3163,14 +3163,30 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
equation_tags.writeOccbinOutput(output, modstruct, julia);
// Write mapping for variables and equations they are present in
for (const auto &variable : variableMapping)
if (!julia)
for (const auto &variable : variableMapping)
{
output << modstruct << "mapping." << symbol_table.getName(variable.first) << ".eqidx = [";
for (auto equation : variable.second)
output << equation + 1 << " ";
output << "];" << endl;
}
else
{
output << modstruct << "mapping." << symbol_table.getName(variable.first) << ".eqidx = [";
for (auto equation : variable.second)
output << equation + 1 << " ";
output << "];" << endl;
output << modstruct << "mapping.eqidx = Dict(\n";
for (const auto &variable : variableMapping)
{
output << " \""
<< symbol_table.getName(variable.first)
<< "\" => [";
for (auto equation : variable.second)
output << equation + 1 << ", ";
output << "]," << endl;
}
output << ")" << endl;
}
/* Say if static and dynamic models differ (because of [static] and [dynamic]
equation tags) */
output << modstruct << "static_and_dynamic_models_differ = "