18 #include "fmi_dll_1_0_cs.h" 19 #include "fmi_dll_1_0_me.h" 20 #include "fmi_dll_common.h" 22 #include "fmi_zip_unzip.h" 23 #include <FMI1/fmi1_xml_model_description.h> 27 #define PRINT_MY_DEBUG printf("Line: %d \t File: %s \n",__LINE__, __FILE__) 33 va_start(argp, message);
34 vsprintf(msg, message, argp);
35 if (!instanceName) instanceName =
"?";
36 if (!category) category =
"?";
37 printf(
"fmiStatus = %d; %s (%s): %s\n", status, instanceName, category, msg);
48 int main(
int argc,
char *argv[])
50 fmiCallbackFunctions callBackFunctions;
52 const char* FMUPath =
"C:\\P510-JModelica\\FMIToolbox\\trunk\\src\\wrapperfolder\\Furuta.fmu";
53 const char* tmpPath =
"C:\\Documents and Settings\\p418_baa\\Desktop\\XMLtest\\temporaryfolder";
55 const char* modelIdentifier;
56 const char* modelName;
57 const char* model_description_path;
58 const char* instanceName;
60 fmi_dll_standard_enu_t standard = FMI_ME1;
65 fmi1_xml_model_description_t* md;
71 printf(
"Failed to unzip the FMU file\n");
76 callBackFunctions.allocateMemory = calloc;
77 callBackFunctions.freeMemory = free;
81 md = fmi1_xml_allocate_model_description(0);
85 if(fmi1_xml_parse(md, model_description_path)) {
86 printf(
"Error parsing XML file %s:%s\n", FMUPath, fmi1_xml_get_last_error(md));
87 fmi1_xml_free_model_description(md);
92 printf(
"Model name: %s\n", fmi1_xml_get_model_name(md));
93 printf(
"Model identifier: %s\n", fmi1_xml_get_model_identifier(md));
94 printf(
"Model GUID: %s\n", fmi1_xml_get_GUID(md));
96 modelIdentifier = fmi1_xml_get_model_identifier(md);
97 modelName = fmi1_xml_get_model_name(md);
98 GUID = fmi1_xml_get_GUID(md);
100 modelIdentifier = fmi1_xml_get_model_identifier(md);
106 fmu = fmi_dll_common_create_dllfmu(dllPath, modelIdentifier, callBackFunctions, standard);
108 printf(
"An error occured while fmi_dll_common_create_dllfmu was called, an error message should been printed.\n");
113 status = fmi_dll_common_load_dll(fmu);
115 printf(
"Error in fmi_dll_common_load_dll: %s\n", fmi_dll_common_get_last_error(fmu));
120 status = fmi_dll_common_load_fcn(fmu);
122 printf(
"Error in fmi_dll_common_load_fcn: %s\n", fmi_dll_common_get_last_error(fmu));
127 printf(
"fmi_dll_1_0_me_get_version: %s\n", fmi_dll_1_0_me_get_version(fmu));
129 fmi_dll_common_free_dll(fmu);
130 fmi_dll_common_destroy_dllfmu(fmu);
132 fmi1_xml_free_model_description(md);
134 printf(
"Everything seems to be OK since you got this far=)!\n");
FMILIB_EXPORT char * fmi_import_get_dll_path(const char *fmu_unzipped_path, const char *model_identifier, jm_callbacks *callBackFunctions)
FMILIB_EXPORT char * fmi_import_get_model_description_path(const char *fmu_unzipped_path, jm_callbacks *callBackFunctions)
void mylogger(fmiComponent c, fmiString instanceName, fmiStatus status, fmiString category, fmiString message,...)
jm_status_enu_t
Return status codes.
int main(int argc, char *argv[])