Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit f2641d7

Browse files
lochelOpenModelica-Hudson
authored andcommitted
Remove attribute useStart from model_init.xml
1 parent 369fd73 commit f2641d7

File tree

6 files changed

+14
-27
lines changed

6 files changed

+14
-27
lines changed

Compiler/SimCode/SerializeInitXML.mo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ algorithm
402402
case Type.T_INTEGER(__)
403403
algorithm
404404
File.write(file, "<Integer ");
405-
scalarVariableTypeUseAttribute(file, startValue, "useStart", "start");
405+
scalarVariableTypeAttribute(file, startValue, "start");
406406
scalarVariableTypeFixedAttribute(file, isFixed);
407407
scalarVariableTypeAttribute(file, minValue, "min");
408408
scalarVariableTypeAttribute(file, maxValue, "max");
@@ -413,7 +413,7 @@ algorithm
413413
case Type.T_REAL(__)
414414
algorithm
415415
File.write(file, "<Real ");
416-
scalarVariableTypeUseAttribute(file, startValue, "useStart", "start");
416+
scalarVariableTypeAttribute(file, startValue, "start");
417417
scalarVariableTypeFixedAttribute(file, isFixed);
418418
scalarVariableTypeUseAttribute(file, nominalValue, "useNominal", "nominal");
419419
scalarVariableTypeAttribute(file, minValue, "min");
@@ -424,23 +424,23 @@ algorithm
424424
case Type.T_BOOL(__)
425425
algorithm
426426
File.write(file, "<Boolean ");
427-
scalarVariableTypeUseAttribute(file, startValue, "useStart", "start");
427+
scalarVariableTypeAttribute(file, startValue, "start");
428428
scalarVariableTypeFixedAttribute(file, isFixed);
429429
scalarVariableTypeStringAttribute(file, unit, "unit");
430430
scalarVariableTypeStringAttribute(file, displayUnit, "displayUnit");
431431
then ();
432432
case Type.T_STRING(__)
433433
algorithm
434434
File.write(file, "<String ");
435-
scalarVariableTypeUseAttribute(file, startValue, "useStart", "start");
435+
scalarVariableTypeAttribute(file, startValue, "start");
436436
scalarVariableTypeFixedAttribute(file, isFixed);
437437
scalarVariableTypeStringAttribute(file, unit, "unit");
438438
scalarVariableTypeStringAttribute(file, displayUnit, "displayUnit");
439439
then ();
440440
case Type.T_ENUMERATION(__)
441441
algorithm
442442
File.write(file, "<Integer ");
443-
scalarVariableTypeUseAttribute(file, startValue, "useStart", "start");
443+
scalarVariableTypeAttribute(file, startValue, "start");
444444
scalarVariableTypeFixedAttribute(file, isFixed);
445445
scalarVariableTypeStringAttribute(file, unit, "unit");
446446
scalarVariableTypeStringAttribute(file, displayUnit, "displayUnit");

Compiler/Template/CodegenCppInit.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ template ScalarVariableTypeStartAttribute(SimCode simCode, DAE.ComponentRef simV
186186
let &complexStartExpressions += '<%varDecls%><%complexPreExpression%>SystemDefaultImplementation::set<%type%>StartValue(<%crefStr%>,<%expression%>);<%\n%>'
187187
''
188188
else ''
189-
'useStart="false"'
189+
''
190190
else
191-
'useStart="true"<%startString%>'
192-
case NONE() then 'useStart="false"'
191+
'<%startString%>'
192+
case NONE() then ''
193193
end ScalarVariableTypeStartAttribute;
194194

195195
template algLoopXML(SimEqSystem eqs, SimCode simCode, HashTableCrIListArray.HashTable varToArrayIndexMapping, String indexForUndefinedReferences)

Compiler/Template/CodegenFMU.tpl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,7 +3006,6 @@ template ScalarVariableTypeFMU(String attrstr, String unit, String displayUnit,
30063006
<%attrstr%>.min = <%optInitValFMU(minValue,"-DBL_MAX")%>;
30073007
<%attrstr%>.max = <%optInitValFMU(maxValue,"DBL_MAX")%>;
30083008
<%attrstr%>.fixed = <%if isFixed then 1 else 0%>;
3009-
<%attrstr%>.useStart = <%if startValue then 1 else 0%>;
30103009
<%attrstr%>.start = <%optInitValFMU(startValue,"0")%>;
30113010
>>
30123011
case T_REAL(__) then
@@ -3018,26 +3017,22 @@ template ScalarVariableTypeFMU(String attrstr, String unit, String displayUnit,
30183017
<%attrstr%>.fixed = <%if isFixed then 1 else 0%>;
30193018
<%attrstr%>.useNominal = <%if nominalValue then 1 else 0%>;
30203019
<%attrstr%>.nominal = <%optInitValFMU(nominalValue,"0.0")%>;
3021-
<%attrstr%>.useStart = <%if startValue then 1 else 0%>;
30223020
<%attrstr%>.start = <%optInitValFMU(startValue,"0.0")%>;
30233021
>>
30243022
case T_BOOL(__) then
30253023
<<
30263024
<%attrstr%>.fixed = <%if isFixed then 1 else 0%>;
3027-
<%attrstr%>.useStart = <%if startValue then 1 else 0%>;
30283025
<%attrstr%>.start = <%optInitValFMU(startValue,"0")%>;
30293026
>>
30303027
case T_STRING(__) then
30313028
<<
3032-
<%attrstr%>.useStart = <%if startValue then 1 else 0%>;
30333029
<%attrstr%>.start = <%optInitValFMU(startValue,"\"\"")%>;
30343030
>>
30353031
case T_ENUMERATION(__) then
30363032
<<
30373033
<%attrstr%>.min = <%optInitValFMU(minValue,"1")%>;
30383034
<%attrstr%>.max = <%optInitValFMU(maxValue,listLength(names))%>;
30393035
<%attrstr%>.fixed = <%if isFixed then 1 else 0%>;
3040-
<%attrstr%>.useStart = <%if startValue then 1 else 0%>;
30413036
<%attrstr%>.start = <%optInitValFMU(startValue,"0")%>;
30423037
>>
30433038
else error(sourceInfo(), 'ScalarVariableTypeFMU: <%unparseType(type_)%>')

Compiler/Template/CodegenUtil.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ template ScalarVariableTypeStartAttribute(Option<DAE.Exp> startValue, DAE.Type t
272272
"generates code for start attribute"
273273
::=
274274
match startValue
275-
case SOME(exp) then 'useStart="true"<%StartString(exp)%>'
276-
case NONE() then 'useStart="false"'
275+
case SOME(exp) then '<%StartString(exp)%>'
276+
else ''
277277
end ScalarVariableTypeStartAttribute;
278278

279279
template ScalarVariableTypeFixedAttribute(Boolean isFixed)

SimulationRuntime/c/simulation/simulation_input_xml.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,45 +374,41 @@ static void read_var_info(omc_ScalarVariable *v, VAR_INFO *info)
374374

375375
static void read_var_attribute_real(omc_ScalarVariable *v, REAL_ATTRIBUTE *attribute)
376376
{
377-
read_value_bool(findHashStringString(v,"useStart"), (modelica_boolean*)&(attribute->useStart));
378377
read_value_real(findHashStringStringEmpty(v,"start"), &(attribute->start), 0.0);
379378
read_value_bool(findHashStringString(v,"fixed"), (modelica_boolean*)&(attribute->fixed));
380379
read_value_bool(findHashStringString(v,"useNominal"), (modelica_boolean*)&(attribute->useNominal));
381380
read_value_real(findHashStringStringEmpty(v,"nominal"), &(attribute->nominal), 1.0);
382381
read_value_real(findHashStringStringEmpty(v,"min"), &(attribute->min), REAL_MIN);
383382
read_value_real(findHashStringStringEmpty(v,"max"), &(attribute->max), REAL_MAX);
384383

385-
infoStreamPrint(LOG_DEBUG, 0, "Real %s(%sstart=%g%s, fixed=%s, %snominal=%g%s, min=%g, max=%g)", findHashStringString(v,"name"), (attribute->useStart)?"":"{", attribute->start, (attribute->useStart)?"":"}", (attribute->fixed)?"true":"false", (attribute->useNominal)?"":"{", attribute->nominal, attribute->useNominal?"":"}", attribute->min, attribute->max);
384+
infoStreamPrint(LOG_DEBUG, 0, "Real %s(start=%g, fixed=%s, %snominal=%g%s, min=%g, max=%g)", findHashStringString(v,"name"), attribute->start, (attribute->fixed)?"true":"false", (attribute->useNominal)?"":"{", attribute->nominal, attribute->useNominal?"":"}", attribute->min, attribute->max);
386385
}
387386

388387
static void read_var_attribute_int(omc_ScalarVariable *v, INTEGER_ATTRIBUTE *attribute)
389388
{
390-
read_value_bool(findHashStringString(v,"useStart"), &attribute->useStart);
391389
read_value_long(findHashStringStringEmpty(v,"start"), &attribute->start, 0);
392390
read_value_bool(findHashStringString(v,"fixed"), &attribute->fixed);
393391
read_value_long(findHashStringStringEmpty(v,"min"), &attribute->min, INTEGER_MIN);
394392
read_value_long(findHashStringStringEmpty(v,"max"), &attribute->max, INTEGER_MAX);
395393

396-
infoStreamPrint(LOG_DEBUG, 0, "Integer %s(%sstart=%ld%s, fixed=%s, min=%ld, max=%ld)", findHashStringString(v,"name"), attribute->useStart?"":"{", attribute->start, attribute->useStart?"":"}", attribute->fixed?"true":"false", attribute->min, attribute->max);
394+
infoStreamPrint(LOG_DEBUG, 0, "Integer %s(start=%ld, fixed=%s, min=%ld, max=%ld)", findHashStringString(v,"name"), attribute->start, attribute->fixed?"true":"false", attribute->min, attribute->max);
397395
}
398396

399397
static void read_var_attribute_bool(omc_ScalarVariable *v, BOOLEAN_ATTRIBUTE *attribute)
400398
{
401-
read_value_bool(findHashStringString(v,"useStart"), &attribute->useStart);
402399
read_value_bool(findHashStringStringEmpty(v,"start"), &attribute->start);
403400
read_value_bool(findHashStringString(v,"fixed"), &attribute->fixed);
404401

405-
infoStreamPrint(LOG_DEBUG, 0, "Boolean %s(%sstart=%s%s, fixed=%s)", findHashStringString(v,"name"), attribute->useStart?"":"{", attribute->start?"true":"false", attribute->useStart?"":"}", attribute->fixed?"true":"false");
402+
infoStreamPrint(LOG_DEBUG, 0, "Boolean %s(start=%s, fixed=%s)", findHashStringString(v,"name"), attribute->start?"true":"false", attribute->fixed?"true":"false");
406403
}
407404

408405
static void read_var_attribute_string(omc_ScalarVariable *v, STRING_ATTRIBUTE *attribute)
409406
{
410407
const char *start = NULL;
411-
read_value_bool(findHashStringString(v,"useStart"), &attribute->useStart);
412408
read_value_string(findHashStringStringEmpty(v,"start"), &start);
413409
attribute->start = mmc_mk_scon_persist(start);
414410

415-
infoStreamPrint(LOG_DEBUG, 0, "String %s(%sstart=%s%s)", findHashStringString(v,"name"), attribute->useStart?"":"{", MMC_STRINGDATA(attribute->start), attribute->useStart?"":"}");
411+
infoStreamPrint(LOG_DEBUG, 0, "String %s(start=%s)", findHashStringString(v,"name"), MMC_STRINGDATA(attribute->start));
416412
}
417413

418414
/* \brief

SimulationRuntime/c/simulation_data.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ typedef struct REAL_ATTRIBUTE
196196
modelica_boolean fixed; /* depends on the type */
197197
modelica_boolean useNominal; /* = false */
198198
modelica_real nominal; /* = 1.0 */
199-
modelica_boolean useStart; /* = false */
200199
modelica_real start; /* = 0.0 */
201200
}REAL_ATTRIBUTE;
202201

@@ -205,20 +204,17 @@ typedef struct INTEGER_ATTRIBUTE
205204
modelica_integer min; /* = -Inf */
206205
modelica_integer max; /* = +Inf */
207206
modelica_boolean fixed; /* depends on the type */
208-
modelica_boolean useStart; /* = false */
209207
modelica_integer start; /* = 0 */
210208
}INTEGER_ATTRIBUTE;
211209

212210
typedef struct BOOLEAN_ATTRIBUTE
213211
{
214212
modelica_boolean fixed; /* depends on the type */
215-
modelica_boolean useStart; /* = false */
216213
modelica_boolean start; /* = false */
217214
}BOOLEAN_ATTRIBUTE;
218215

219216
typedef struct STRING_ATTRIBUTE
220217
{
221-
modelica_boolean useStart; /* = false */
222218
modelica_string start; /* = "" */
223219
}STRING_ATTRIBUTE;
224220

0 commit comments

Comments
 (0)