Skip to content

Commit 6b95e13

Browse files
author
Willi Braun
committed
- changed compilation flag for fmu-export from -O2 to -O
- added String support for fmu-import - added MultiBody.DoublePendelum test git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11621 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent f1ede99 commit 6b95e13

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

Compiler/susan_codegen/SimCode/CodegenC.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,11 @@ case eqn as SES_ARRAY_CALL_ASSIGN(__) then
18091809
<%preExp%>
18101810
copy_real_array_data_mem(&<%expPart%>, &<%cref(eqn.componentRef)%>);<%inlineArray(context,expPart,eqn.componentRef)%>
18111811
>>
1812+
case "string" then
1813+
<<
1814+
<%preExp%>
1815+
copy_string_array_data_mem(&<%expPart%>, &<%cref(eqn.componentRef)%>);<%inlineArray(context,expPart,eqn.componentRef)%>
1816+
>>
18121817
else error(sourceInfo(), 'No runtime support for this sort of array call: <%printExpStr(eqn.exp)%>')
18131818
%>
18141819
<%endModelicaLine()%>

Compiler/susan_codegen/SimCode/CodegenFMU.tpl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,10 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
10201020
let compilecmds = getPlatformString2(makefileParams.platform, fileNamePrefix, dirExtra, libsPos1, libsPos2, makefileParams.omhome)
10211021
<<
10221022
# Makefile generated by OpenModelica
1023-
1024-
# Simulations use -O2 by default
1025-
SIM_OR_DYNLOAD_OPT_LEVEL=-O2
1023+
1024+
# Simulation of the fmu with dymola does not work
1025+
# with inline-small-functions
1026+
SIM_OR_DYNLOAD_OPT_LEVEL=-O #-O2 -fno-inline-small-functions
10261027
CC=<%makefileParams.ccompiler%>
10271028
CXX=<%makefileParams.cxxcompiler%>
10281029
LINK=<%makefileParams.linker%>

SimulationRuntime/fmi/import/fmuWrapper.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99

1010
/* Define for Debuging */
11-
/*
12-
#define _PRINT_OUT__
13-
#define _DEBUG_
11+
/*#define _PRINT_OUT__
12+
#define _DEBUG_
1413
*/
1514

1615
#define BUFSIZE 4096

SimulationRuntime/fmi/import/moGenerator.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,15 +637,27 @@ fmiAlias getFMIAlias(ScalarVariable* sv) {
637637
void instScalarVariable(ModelDescription* md, fmiScalarVariable* list) {
638638
int i;
639639
unsigned int len;
640+
char* tempDesc;
640641
if (md->modelVariables) {
641642
for (i = 0; md->modelVariables[i]; i++) {
642643
list[i].name = getName(md->modelVariables[i]);
643644
len = strlen(list[i].name);
644645
list[i].flatName = (char*) calloc(len + 1, sizeof(char));
645646
strcpy(list[i].flatName, list[i].name);
646647
charReplace(list[i].flatName, len, '.', '_');
648+
charReplace(list[i].flatName, len, '[', '_');
649+
charReplace(list[i].flatName, len, ']', '_');
650+
charReplace(list[i].flatName, len, ',', '_');
647651
list[i].vr = getValueReference(md->modelVariables[i]);
648652
list[i].description = getDescription(md, md->modelVariables[i]);
653+
if (list[i].description != NULL){
654+
len = strlen(list[i].description);
655+
tempDesc = (char*) calloc(len + 1, sizeof(char));
656+
memcpy(tempDesc, list[i].description, len);
657+
charReplace(tempDesc, len, 0x22, 0x27);
658+
list[i].description = (const char *) tempDesc;
659+
}
660+
//tempDesc = (char*) calloc(len + 1, sizeof(char));
649661

650662
#ifdef _DEBUG_
651663
printf("#### Description of sv %s, %s, value reference: %d\n",list[i].name, list[i].description,list[i].vr );
@@ -1359,6 +1371,7 @@ void blockcodegen(fmuModelDescription* fmuMD, const char* decompPath,
13591371
fprintf(pfile, "%d};\n", tmpReal->vr);
13601372
}
13611373
}
1374+
13621375
if (noRealParam > 0) {
13631376
tmpRealParam = pntRealParam;
13641377
fprintf(pfile, "\tparameter Real realVParam[%d];\n", noRealParam);

SimulationRuntime/fmi/import/xmlparser.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ static void XMLCALL endElement(void *context, const char *elm) {
587587
case elm_RealType:
588588
case elm_IntegerType:
589589
case elm_BooleanType:
590+
case elm_StringType:
590591
case elm_EnumerationType:
591592
break;
592593
default:
@@ -637,6 +638,7 @@ static void XMLCALL endElement(void *context, const char *elm) {
637638
case elm_Real:
638639
case elm_Integer:
639640
case elm_Boolean:
641+
case elm_String:
640642
case elm_Enumeration:
641643
break;
642644
default:

0 commit comments

Comments
 (0)