Skip to content

Commit

Permalink
- changed compilation flag for fmu-export from -O2 to -O
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
Willi Braun committed Apr 1, 2012
1 parent f1ede99 commit 6b95e13
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Compiler/susan_codegen/SimCode/CodegenC.tpl
Expand Up @@ -1809,6 +1809,11 @@ case eqn as SES_ARRAY_CALL_ASSIGN(__) then
<%preExp%>
copy_real_array_data_mem(&<%expPart%>, &<%cref(eqn.componentRef)%>);<%inlineArray(context,expPart,eqn.componentRef)%>
>>
case "string" then
<<
<%preExp%>
copy_string_array_data_mem(&<%expPart%>, &<%cref(eqn.componentRef)%>);<%inlineArray(context,expPart,eqn.componentRef)%>
>>
else error(sourceInfo(), 'No runtime support for this sort of array call: <%printExpStr(eqn.exp)%>')
%>
<%endModelicaLine()%>
Expand Down
7 changes: 4 additions & 3 deletions Compiler/susan_codegen/SimCode/CodegenFMU.tpl
Expand Up @@ -1020,9 +1020,10 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
let compilecmds = getPlatformString2(makefileParams.platform, fileNamePrefix, dirExtra, libsPos1, libsPos2, makefileParams.omhome)
<<
# Makefile generated by OpenModelica

# Simulations use -O2 by default
SIM_OR_DYNLOAD_OPT_LEVEL=-O2

# Simulation of the fmu with dymola does not work
# with inline-small-functions
SIM_OR_DYNLOAD_OPT_LEVEL=-O #-O2 -fno-inline-small-functions
CC=<%makefileParams.ccompiler%>
CXX=<%makefileParams.cxxcompiler%>
LINK=<%makefileParams.linker%>
Expand Down
5 changes: 2 additions & 3 deletions SimulationRuntime/fmi/import/fmuWrapper.c
Expand Up @@ -8,9 +8,8 @@


/* Define for Debuging */
/*
#define _PRINT_OUT__
#define _DEBUG_
/*#define _PRINT_OUT__
#define _DEBUG_
*/

#define BUFSIZE 4096
Expand Down
13 changes: 13 additions & 0 deletions SimulationRuntime/fmi/import/moGenerator.c
Expand Up @@ -637,15 +637,27 @@ fmiAlias getFMIAlias(ScalarVariable* sv) {
void instScalarVariable(ModelDescription* md, fmiScalarVariable* list) {
int i;
unsigned int len;
char* tempDesc;
if (md->modelVariables) {
for (i = 0; md->modelVariables[i]; i++) {
list[i].name = getName(md->modelVariables[i]);
len = strlen(list[i].name);
list[i].flatName = (char*) calloc(len + 1, sizeof(char));
strcpy(list[i].flatName, list[i].name);
charReplace(list[i].flatName, len, '.', '_');
charReplace(list[i].flatName, len, '[', '_');
charReplace(list[i].flatName, len, ']', '_');
charReplace(list[i].flatName, len, ',', '_');
list[i].vr = getValueReference(md->modelVariables[i]);
list[i].description = getDescription(md, md->modelVariables[i]);
if (list[i].description != NULL){
len = strlen(list[i].description);
tempDesc = (char*) calloc(len + 1, sizeof(char));
memcpy(tempDesc, list[i].description, len);
charReplace(tempDesc, len, 0x22, 0x27);
list[i].description = (const char *) tempDesc;
}
//tempDesc = (char*) calloc(len + 1, sizeof(char));

#ifdef _DEBUG_
printf("#### Description of sv %s, %s, value reference: %d\n",list[i].name, list[i].description,list[i].vr );
Expand Down Expand Up @@ -1359,6 +1371,7 @@ void blockcodegen(fmuModelDescription* fmuMD, const char* decompPath,
fprintf(pfile, "%d};\n", tmpReal->vr);
}
}

if (noRealParam > 0) {
tmpRealParam = pntRealParam;
fprintf(pfile, "\tparameter Real realVParam[%d];\n", noRealParam);
Expand Down
2 changes: 2 additions & 0 deletions SimulationRuntime/fmi/import/xmlparser.c
Expand Up @@ -587,6 +587,7 @@ static void XMLCALL endElement(void *context, const char *elm) {
case elm_RealType:
case elm_IntegerType:
case elm_BooleanType:
case elm_StringType:
case elm_EnumerationType:
break;
default:
Expand Down Expand Up @@ -637,6 +638,7 @@ static void XMLCALL endElement(void *context, const char *elm) {
case elm_Real:
case elm_Integer:
case elm_Boolean:
case elm_String:
case elm_Enumeration:
break;
default:
Expand Down

0 comments on commit 6b95e13

Please sign in to comment.