Skip to content

Commit

Permalink
Updated the initialization warning text.
Browse files Browse the repository at this point in the history
Also marked it for translation.
  • Loading branch information
adeas31 authored and OpenModelica-Hudson committed Sep 21, 2016
1 parent 25249c8 commit 7c98eac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Compiler/BackEnd/Initialization.mo
Expand Up @@ -97,6 +97,7 @@ protected
BackendDAE.Variables initVars;
BackendDAE.Variables vars, fixvars;
Boolean b, b1, b2, useHomotopy;
String msg;
HashSet.HashSet hs "contains all pre variables";
list<BackendDAE.Equation> removedEqns;
list<BackendDAE.Var> dumpVars, dumpVars2;
Expand Down Expand Up @@ -228,6 +229,7 @@ algorithm
// warn about selected default initial conditions
b1 := not listEmpty(dumpVars);
b2 := not listEmpty(removedEqns);
msg := System.gettext("For more information set +d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"+d=initialization\")");
if Flags.isSet(Flags.INITIALIZATION) then
if b1 then
Error.addCompilerWarning("Assuming fixed start value for the following " + intString(listLength(dumpVars)) + " variables:\n" + warnAboutVars2(dumpVars));
Expand All @@ -237,17 +239,17 @@ algorithm
end if;
else
if b1 then
Error.addCompilerWarning("The initial conditions are not fully specified. Use +d=initialization for more information.");
Error.addMessage(Error.INITIALIZATION_NOT_FULLY_SPECIFIED, {msg});
end if;
if b2 then
Error.addCompilerWarning("The initial conditions are over specified. Use +d=initialization for more information.");
Error.addMessage(Error.INITIALIZATION_OVER_SPECIFIED, {msg});
end if;
end if;

// warn about iteration variables with default zero start attribute
b := warnAboutIterationVariablesWithDefaultZeroStartAttribute(initdae);
if b and (not Flags.isSet(Flags.INITIALIZATION)) then
Error.addCompilerWarning("There are iteration variables with default zero start attribute. Use +d=initialization for more information.");
Error.addMessage(Error.INITIALIZATION_ITERATION_VARIABLES, {msg});
end if;

if Flags.isSet(Flags.DUMP_EQNINORDER) and Flags.isSet(Flags.DUMP_INITIAL_SYSTEM) then
Expand Down
6 changes: 6 additions & 0 deletions Compiler/Util/Error.mo
Expand Up @@ -709,6 +709,12 @@ public constant Message EXT_FN_SINGLE_RETURN_ARRAY = MESSAGE(290, TRANSLATION(),
public constant Message RHS_TUPLE_EXPRESSION = MESSAGE(291, TRANSLATION(), ERROR(),
Util.gettext("Tuple expressions may only occur on the left side of an assignment or equation with a single function call on the right side. Got the following expression: %s."));

public constant Message INITIALIZATION_NOT_FULLY_SPECIFIED = MESSAGE(496, TRANSLATION(), WARNING(),
Util.gettext("The initial conditions are not fully specified. %s."));
public constant Message INITIALIZATION_OVER_SPECIFIED = MESSAGE(497, TRANSLATION(), WARNING(),
Util.gettext("The initial conditions are over specified. %s."));
public constant Message INITIALIZATION_ITERATION_VARIABLES = MESSAGE(498, TRANSLATION(), WARNING(),
Util.gettext("There are iteration variables with default zero start attribute. %s."));
public constant Message UNBOUND_PARAMETER_WITH_START_VALUE_WARNING = MESSAGE(499, TRANSLATION(), WARNING(),
Util.gettext("Parameter %s has no value, and is fixed during initialization (fixed=true), using available start value (start=%s) as default value."));
public constant Message UNBOUND_PARAMETER_WARNING = MESSAGE(500, TRANSLATION(), WARNING(),
Expand Down

0 comments on commit 7c98eac

Please sign in to comment.