Browse Source

removed unused code

Cláudio Gomes 3 years ago
parent
commit
8947398ac7
67 changed files with 0 additions and 18206 deletions
  1. 0 68
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/build_all.bat
  2. 0 312
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/co_simulation/power_window_plain_cosim.c
  3. 0 75
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/fmi2.h
  4. 0 243
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/include/fmi2FunctionTypes.h
  5. 0 333
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/include/fmi2Functions.h
  6. 0 115
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/include/fmi2TypesPlatform.h
  7. 0 654
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlElement.cpp
  8. 0 160
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlElement.h
  9. 0 314
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParser.cpp
  10. 0 126
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParser.h
  11. 0 242
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParserCApi.cpp
  12. 0 203
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParserCApi.h
  13. 0 50
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParserException.h
  14. 0 96
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/DOCBparser.h
  15. 0 306
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/HTMLparser.h
  16. 0 147
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/HTMLtree.h
  17. 0 173
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/SAX.h
  18. 0 178
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/SAX2.h
  19. 0 126
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/c14n.h
  20. 0 182
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/catalog.h
  21. 0 230
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/chvalid.h
  22. 0 217
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/debugXML.h
  23. 0 86
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/dict.h
  24. 0 240
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/encoding.h
  25. 0 151
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/entities.h
  26. 0 509
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/globals.h
  27. 0 233
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/hash.h
  28. 0 137
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/list.h
  29. 0 163
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/nanoftp.h
  30. 0 81
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/nanohttp.h
  31. 0 1241
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/parser.h
  32. 0 644
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/parserInternals.h
  33. 0 100
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/pattern.h
  34. 0 217
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/relaxng.h
  35. 0 958
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/schemasInternals.h
  36. 0 142
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/schematron.h
  37. 0 84
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/threads.h
  38. 0 1311
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/tree.h
  39. 0 94
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/uri.h
  40. 0 458
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/valid.h
  41. 0 129
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xinclude.h
  42. 0 189
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xlink.h
  43. 0 366
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlIO.h
  44. 0 146
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlautomata.h
  45. 0 945
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlerror.h
  46. 0 162
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlexports.h
  47. 0 224
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlmemory.h
  48. 0 57
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlmodule.h
  49. 0 428
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlreader.h
  50. 0 222
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlregexp.h
  51. 0 88
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlsave.h
  52. 0 246
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlschemas.h
  53. 0 151
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlschemastypes.h
  54. 0 140
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlstring.h
  55. 0 202
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlunicode.h
  56. 0 489
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlversion.h
  57. 0 488
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xmlwriter.h
  58. 0 557
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xpath.h
  59. 0 632
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xpathInternals.h
  60. 0 114
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml/xpointer.h
  61. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml2.lib
  62. 0 21
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/libxml_license.txt
  63. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/x64/libxml2.lib
  64. 0 661
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/sim_support.c
  65. 0 40
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/sim_support.h
  66. 0 82
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/xmlVersionParser.c
  67. 0 28
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/xmlVersionParser.h

+ 0 - 68
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/build_all.bat

@@ -1,68 +0,0 @@
-@echo off 
-
-setlocal
-
-echo -----------------------------------------------------------
-echo building fmu20sim_cs.exe - FMI for Co-Simulation 2.0
-echo -----------------------------------------------------------
-
-rem save env variable settings
-set PREV_PATH=%PATH%
-if defined INCLUDE set PREV_INCLUDE=%INLUDE%
-if defined LIB     set PREV_LIB=%LIB%
-if defined LIBPATH set PREV_LIBPATH=%LIBPATH%
-
-if "%1"=="-win64" (set x64=x64\) else set x64=
-
-rem setup the compiler
-if defined x64 (
-if not exist ..\..\bin\x64 mkdir ..\..\bin\x64
-if defined VS140COMNTOOLS (call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS100COMNTOOLS (call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS90COMNTOOLS (call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS80COMNTOOLS (call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-goto noCompiler
-) else (
-if defined VS140COMNTOOLS (call "%VS140COMNTOOLS%\vsvars32.bat") else ^
-if defined VS100COMNTOOLS (call "%VS100COMNTOOLS%\vsvars32.bat") else ^
-if defined VS90COMNTOOLS (call "%VS90COMNTOOLS%\vsvars32.bat") else ^
-if defined VS80COMNTOOLS (call "%VS80COMNTOOLS%\vsvars32.bat") else ^
-goto noCompiler
-)
-
-set SRC=power_window_plain_cosim.c ..\shared\sim_support.c ..\shared\xmlVersionParser.c ..\shared\parser\XmlParser.cpp ..\shared\parser\XmlElement.cpp ..\shared\parser\XmlParserCApi.cpp
-set INC=/I..\shared\include /I..\shared /I..\shared\parser
-set OPTIONS=/DFMI_COSIMULATION /nologo /EHsc /DSTANDALONE_XML_PARSER /DLIBXML_STATIC /DEBUG:FULL /Zi /INCREMENTAL:NO
-
-rem create fmu20sim_cs.exe in co_simulation dir
-pushd co_simulation
-cl %SRC% %INC% %OPTIONS% /Fefmu20sim_cs.exe /link /LIBPATH:..\shared\parser\%x64% /NODEFAULTLIB:libcmtd.lib
-
-del *.obj
-del *.ilk
-popd
-if not exist co_simulation\fmu20sim_cs.exe goto compileError
-move /Y co_simulation\fmu20sim_cs.exe ..\..\bin\%x64%
-move /Y co_simulation\*.pdb ..\..\bin\%x64%
-goto done
-
-:noCompiler
-echo No Microsoft Visual C compiler found
-
-:compileError
-echo build of fmu20sim_cs.exe failed
-
-:done
-rem undo variable settings performed by vsvars32.bat
-set PATH=%PREV_PATH%
-if defined PREV_INCLUDE set INCLUDE=%PREV_INLUDE%
-if defined PREV_LIB     set LIB=%PREV_LIB%
-if defined PREV_LIBPATH set LIBPATH=%PREV_LIBPATH%
-echo done.
-
-endlocal
-
-
-if "%1"=="nopause" goto skip
-pause
-:skip

+ 0 - 312
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/co_simulation/power_window_plain_cosim.c

@@ -1,312 +0,0 @@
-/* -------------------------------------------------------------------------
- * Author: Claudio Gomes (claudio.gomes@uantwerp.be)
- * -------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "fmi2.h"
-#include "sim_support.h"
-
-// The paths to the FMUs to be simulated.
-#define OBSTACLE_FMU_PATH "fmu20\\fmu\\cs\\Obstacle.fmu"
-#define OBSTACLE_TARGET_DIR "obstacle\\"
-#define OBSTACLE_RESULTS "obstacle_results.csv"
-#define POWERSYSTEM_FMU_PATH "fmu20\\fmu\\cs\\PW_PowerSystem.fmu"
-#define POWERSYSTEM_TARGET_DIR "power_system\\"
-#define POWERSYSTEM_RESULTS "power_system_results.csv"
-#define WINDOW_FMU_PATH "fmu20\\fmu\\cs\\PW_Window.fmu"
-#define WINDOW_TARGET_DIR "window\\"
-#define WINDOW_RESULTS "window_results.csv"
-
-#define MSD_FMU_PATH "fmu20\\fmu\\cs\\mass_spring_damper.fmu"
-#define MSD_TARGET_DIR "mass_spring_damper\\"
-#define MSD_RESULTS "mass_spring_damper_results.csv"
-
-static int instantiateFMU(fmi2Component* c, FMU* fmu, const char* fmuTargetDir, fmi2Boolean loggingOn, const fmi2CallbackFunctions* callbacks){
-	const fmi2Boolean visible = fmi2False;
-	
-	printf("Instantiating fmu...\n");
-	const char *guid = getAttributeValue((Element *)fmu->modelDescription, att_guid);
-	printf("guid = %s\n", guid);
-	const char *instanceName = getAttributeValue((Element *)getCoSimulation(fmu->modelDescription), att_modelIdentifier);
-	printf("instanceName = %s\n", instanceName);
-	char *fmuResourceDir = getTempResourcesLocation(fmuTargetDir);
-	printf("fmuResourceDir = %s\n", fmuResourceDir);
-	*c = fmu->instantiate(instanceName, fmi2CoSimulation, guid, fmuResourceDir,
-                    callbacks, visible, loggingOn);
-	free(fmuResourceDir);
-	
-	if (!c)
-		return error("Could not instantiate fmu.");
-	
-	printf("Fmu instantiated\n");
-	
-	return 1; // success
-}
-
-static fmi2Status setupExperimentFMU(fmi2Component c, FMU* fmu, double start_time, double tEnd){
-	fmi2Boolean toleranceDefined = fmi2False; // Default value: false
-	fmi2Real tolerance;
-	ValueStatus xmlParserValueState;
-	Element * defaultExp;
-	
-	defaultExp = getDefaultExperiment(fmu->modelDescription);
-    if (defaultExp)
-		tolerance = getAttributeDouble(defaultExp, att_tolerance, &xmlParserValueState);
-    if (xmlParserValueState == valueDefined) {
-        toleranceDefined = fmi2True;
-    }
-	
-	return fmu->setupExperiment(c, toleranceDefined, tolerance, start_time, fmi2True, tEnd);
-}
-
-static int simulate(FMU* MSD, FMU* Obstacle, FMU* PW_PowerSystem, FMU* PW_Window, double tEnd, double H, fmi2Boolean loggingOn, char separator) {
-	// co simulation time vars
-	double time;
-    double start_time = 0;
-	int cosim_step_counter;
-	
-	// aux vars for intermediate results
-	fmi2Status returnCodeFmiFunctions;	
-	
-	// FMU results file
-    FILE* obstacle_results;
-    FILE* power_results;
-    FILE* window_results;
-    FILE* msd_results;
-	
-	// FMU instance data
-	fmi2Component obstacle_instance;
-	const fmi2CallbackFunctions obstacle_callbacks = {fmuLogger, calloc, free, NULL, Obstacle};
-	fmi2Component power_instance;
-	const fmi2CallbackFunctions power_callbacks = {fmuLogger, calloc, free, NULL, PW_PowerSystem};
-	fmi2Component window_instance;
-	const fmi2CallbackFunctions window_callbacks = {fmuLogger, calloc, free, NULL, PW_Window};
-	fmi2Component msd_instance;
-	const fmi2CallbackFunctions msd_callbacks = {fmuLogger, calloc, free, NULL, MSD};
-	
-	// Instantiate FMUS
-	printf("Instantiating obstacle fmu...\n");
-	instantiateFMU(&obstacle_instance, Obstacle, OBSTACLE_TARGET_DIR, loggingOn, &obstacle_callbacks);
-	
-	printf("Instantiating msd fmu...\n");
-	instantiateFMU(&msd_instance, MSD, MSD_TARGET_DIR, loggingOn, &msd_callbacks);
-	
-	printf("Instantiating window fmu...\n");
-	instantiateFMU(&window_instance, PW_Window, WINDOW_TARGET_DIR, loggingOn, &window_callbacks);
-	
-	printf("Instantiating power fmu...\n");
-	instantiateFMU(&power_instance, PW_PowerSystem, POWERSYSTEM_TARGET_DIR, loggingOn, &power_callbacks);
-	
-	// Setup experiments
-	
-	printf("Setting up default experiment for obstacle_instance fmu...\n");
-	returnCodeFmiFunctions = setupExperimentFMU(obstacle_instance, Obstacle, start_time, tEnd); 
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        return error("Could not set up experiment for obstacle_instance fmu.");
-    }
-	
-	printf("Setting up default experiment for msd_instance fmu...\n");
-	returnCodeFmiFunctions = setupExperimentFMU(msd_instance, MSD, start_time, tEnd); 
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        return error("Could not set up experiment for msd_instance fmu.");
-    }
-	
-	printf("Setting up default experiment for window_instance fmu...\n");
-	returnCodeFmiFunctions = setupExperimentFMU(window_instance, PW_Window, start_time, tEnd); 
-    if (returnCodeFmiFunctions > fmi2Warning) {
-		printf("Could not set up experiment for window_instance fmu.\n");
-        return error("Could not set up experiment for window_instance fmu.");
-    }
-	
-	printf("Setting up default experiment for power_instance fmu...\n");
-	returnCodeFmiFunctions = setupExperimentFMU(power_instance, PW_PowerSystem, start_time, tEnd); 
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        return error("Could not set up experiment for power_instance fmu.");
-    }
-	
-	// Init FMUs
-	
-	printf("Entering initialization mode for obstacle_instance fmu...\n");
-	returnCodeFmiFunctions = Obstacle->enterInitializationMode(obstacle_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-		printf("Could not enter initialization mode for obstacle_instance fmu.\n");
-        return error("Could not enter initialization mode for obstacle_instance fmu");
-    }
-	
-	printf("Entering initialization mode msd_instance fmu...\n");
-	returnCodeFmiFunctions = MSD->enterInitializationMode(msd_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-		printf("Could not enter initialization msd_instance for power fmu.\n");
-        return error("Could not enter initialization msd_instance for power fmu");
-    }
-	
-	printf("Entering initialization mode for power_instance fmu...\n");
-	returnCodeFmiFunctions = PW_PowerSystem->enterInitializationMode(power_instance);
-	printf("Entering initialization mode for power_instance fmu... DONE\n");
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        printf("Could not enter initialization mode for power_instance fmu.\n");
-		return error("Could not enter initialization mode for power_instance fmu");
-    }
-	
-	printf("Entering initialization mode window_instance fmu...\n");
-	returnCodeFmiFunctions = PW_Window->enterInitializationMode(window_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-		printf("Could not enter initialization window_instance for power fmu.\n");
-        return error("Could not enter initialization window_instance for power fmu");
-    }
-	
-	
-	
-	// Finish Init FMUs
-	
-	printf("Exiting initialization mode for obstacle_instance fmu...\n");
-	returnCodeFmiFunctions = Obstacle->exitInitializationMode(obstacle_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-		printf("Could not exit initialization mode for obstacle_instance fmu.\n");
-        return error("Could not exit initialization mode for obstacle_instance fmu");
-    }
-	
-	printf("Exiting initialization mode msd_instance fmu...\n");
-	returnCodeFmiFunctions = MSD->exitInitializationMode(msd_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        return error("Could not exit initialization msd_instance for power fmu");
-    }
-	
-	printf("Exiting initialization mode window_instance fmu...\n");
-	returnCodeFmiFunctions = PW_Window->exitInitializationMode(window_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        return error("Could not exit initialization window_instance for power fmu");
-    }
-	
-	printf("Exiting initialization mode for power_instance fmu...\n");
-	returnCodeFmiFunctions = PW_PowerSystem->exitInitializationMode(power_instance);
-    if (returnCodeFmiFunctions > fmi2Warning) {
-        return error("Could not exit initialization mode for power_instance fmu");
-    }
-	
-	// open result file
-	printf("Creating results files...\n");
-	
-	if (!(obstacle_results = fopen(OBSTACLE_RESULTS, "w"))) {
-        printf("could not write %s because:\n", OBSTACLE_RESULTS);
-        printf("    %s\n", strerror(errno));
-        return 0; // failure
-    }
-	if (!(msd_results = fopen(MSD_RESULTS, "w"))) {
-        printf("could not write %s because:\n", MSD_RESULTS);
-        printf("    %s\n", strerror(errno));
-        return 0; // failure
-    }
-	if (!(window_results = fopen(WINDOW_RESULTS, "w"))) {
-        printf("could not write %s because:\n", WINDOW_RESULTS);
-        printf("    %s\n", strerror(errno));
-        return 0; // failure
-    }
-	if (!(power_results = fopen(POWERSYSTEM_RESULTS, "w"))) {
-        printf("could not write %s because:\n", POWERSYSTEM_RESULTS);
-        printf("    %s\n", strerror(errno));
-        return 0; // failure
-    }
-    
-	// output solution for time t0
-    printf("Writting headers...\n");
-	outputRow(Obstacle, obstacle_instance, start_time, obstacle_results, separator, fmi2True);
-    outputRow(MSD, msd_instance, start_time, msd_results, separator, fmi2True);
-    outputRow(PW_PowerSystem, power_results, start_time, power_results, separator, fmi2True);
-    outputRow(PW_Window, window_instance, start_time, window_results, separator, fmi2True);
-	
-	printf("Writting first row of obstacle_instance...\n");
-	outputRow(Obstacle, obstacle_instance, start_time, obstacle_results, separator, fmi2False); // output values
-	printf("Writting first row of msd_instance...\n");
-    outputRow(MSD, msd_instance, start_time, msd_results, separator, fmi2False);
-	printf("Writting first row of power_instance...\n");
-	outputRow(PW_PowerSystem, power_instance, start_time, power_results, separator, fmi2False);
-	printf("Writting first row of window_instance...\n");
-    outputRow(PW_Window, window_instance, start_time, window_results, separator, fmi2False);
-	
-	// end simulation
-    printf("Terminating FMUs...\n");
-	Obstacle->terminate(obstacle_instance);
-	MSD->terminate(msd_instance);
-	PW_PowerSystem->terminate(power_results);
-	PW_Window->terminate(window_instance);
-	
-	printf("Releasing FMUs...\n");
-	Obstacle->freeInstance(obstacle_instance);
-    MSD->freeInstance(msd_instance);
-	PW_PowerSystem->freeInstance(power_results);
-	PW_Window->freeInstance(window_instance);
-    
-	printf("Closing files...\n");
-	fclose(obstacle_results);
-    fclose(msd_results);
-    fclose(power_results);
-    fclose(window_results);
-	
-	printf("Simulation done.\n");
-	
-	return 1; // success
-}
-
-int main(int argc, char *argv[]) {
-	// The fmus to be loaded and simulated.
-	FMU Obstacle; 
-	FMU PW_PowerSystem; 
-	FMU PW_Window; 
-	FMU MSD; 
-	
-	setbuf(stdout, NULL); // disable buffering on the stdout.
-	
-    double tEnd = 1.0;
-    double H=0.1;
-    fmi2Boolean loggingOn = fmi2True;
-    char csv_separator = ',';
-	
-	printf("Attempting to delete previously unzipped temp files...\n");
-    deleteUnzippedFiles();
-	
-	printf("Loading FMUs...\n");
-	
-	loadFMU(OBSTACLE_FMU_PATH, OBSTACLE_TARGET_DIR, &Obstacle);
-	loadFMU(MSD_FMU_PATH, MSD_TARGET_DIR, &MSD);
-	loadFMU(POWERSYSTEM_FMU_PATH, POWERSYSTEM_TARGET_DIR, &PW_PowerSystem);
-	loadFMU(WINDOW_FMU_PATH, WINDOW_TARGET_DIR, &PW_Window);
-	
-	printf("Simulating FMUs...\n");
-	
-	simulate(&MSD,&Obstacle,&PW_PowerSystem, &PW_Window, tEnd, H, loggingOn, csv_separator);
-	
-	// release FMU
-    
-	printf("Releasing FMU dlls...\n");
-	
-	if (!FreeLibrary(Obstacle.dllHandle)){
-		printf("Error unloading Obstacle.dllHandle.\n");
-	}
-    freeModelDescription(Obstacle.modelDescription);
-	
-	if (!FreeLibrary(MSD.dllHandle)){
-		printf("Error unloading MSD.dllHandle.\n");
-	}
-	freeModelDescription(MSD.modelDescription);
-	
-	if (!FreeLibrary(PW_Window.dllHandle)){
-		printf("Error unloading PW_Window.dllHandle.\n");
-	}
-    freeModelDescription(PW_Window.modelDescription);
-	
-	if (!FreeLibrary(PW_PowerSystem.dllHandle)){
-		printf("Error unloading PW_PowerSystem.dllHandle.\n");
-	}
-    freeModelDescription(PW_PowerSystem.modelDescription);
-    
-	// delete temp files obtained by unzipping the FMU
-    printf("Attempting to delete unzipped files...\n");
-    deleteUnzippedFiles();
-	
-	printf("All done.\n");
-	
-    return EXIT_SUCCESS;
-}

+ 0 - 75
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/fmi2.h

@@ -1,75 +0,0 @@
-/* ------------------------------------------------------------------------- 
- * fmi.h
- * Struct with the corresponding function pointers for FMI 2.0.
- * Copyright QTronic GmbH. All rights reserved.
- * -------------------------------------------------------------------------*/
-
-#ifndef FMI_H
-#define FMI_H
-
-#include <windows.h>
-#include "fmi2Functions.h"
-
-#include "XmlParserCApi.h"
-
-typedef struct {
-    ModelDescription* modelDescription;
-
-    HMODULE dllHandle; // fmu.dll handle
-    /***************************************************
-    Common Functions
-    ****************************************************/
-    fmi2GetTypesPlatformTYPE         *getTypesPlatform;
-    fmi2GetVersionTYPE               *getVersion;
-    fmi2SetDebugLoggingTYPE          *setDebugLogging;
-    fmi2InstantiateTYPE              *instantiate;
-    fmi2FreeInstanceTYPE             *freeInstance;
-    fmi2SetupExperimentTYPE          *setupExperiment;
-    fmi2EnterInitializationModeTYPE  *enterInitializationMode;
-    fmi2ExitInitializationModeTYPE   *exitInitializationMode;
-    fmi2TerminateTYPE                *terminate;
-    fmi2ResetTYPE                    *reset;
-    fmi2GetRealTYPE                  *getReal;
-    fmi2GetIntegerTYPE               *getInteger;
-    fmi2GetBooleanTYPE               *getBoolean;
-    fmi2GetStringTYPE                *getString;
-    fmi2SetRealTYPE                  *setReal;
-    fmi2SetIntegerTYPE               *setInteger;
-    fmi2SetBooleanTYPE               *setBoolean;
-    fmi2SetStringTYPE                *setString;
-    fmi2GetFMUstateTYPE              *getFMUstate;
-    fmi2SetFMUstateTYPE              *setFMUstate;
-    fmi2FreeFMUstateTYPE             *freeFMUstate;
-    fmi2SerializedFMUstateSizeTYPE   *serializedFMUstateSize;
-    fmi2SerializeFMUstateTYPE        *serializeFMUstate;
-    fmi2DeSerializeFMUstateTYPE      *deSerializeFMUstate;
-    fmi2GetDirectionalDerivativeTYPE *getDirectionalDerivative;
-    /***************************************************
-    Functions for FMI2 for Co-Simulation
-    ****************************************************/
-    fmi2SetRealInputDerivativesTYPE  *setRealInputDerivatives;
-    fmi2GetRealOutputDerivativesTYPE *getRealOutputDerivatives;
-    fmi2DoStepTYPE                   *doStep;
-    fmi2CancelStepTYPE               *cancelStep;
-    fmi2GetStatusTYPE                *getStatus;
-    fmi2GetRealStatusTYPE            *getRealStatus;
-    fmi2GetIntegerStatusTYPE         *getIntegerStatus;
-    fmi2GetBooleanStatusTYPE         *getBooleanStatus;
-    fmi2GetStringStatusTYPE          *getStringStatus;
-    /***************************************************
-    Functions for FMI2 for Model Exchange
-    ****************************************************/
-    fmi2EnterEventModeTYPE                *enterEventMode;
-    fmi2NewDiscreteStatesTYPE             *newDiscreteStates;
-    fmi2EnterContinuousTimeModeTYPE       *enterContinuousTimeMode;
-    fmi2CompletedIntegratorStepTYPE       *completedIntegratorStep;
-    fmi2SetTimeTYPE                       *setTime;
-    fmi2SetContinuousStatesTYPE           *setContinuousStates;
-    fmi2GetDerivativesTYPE                *getDerivatives;
-    fmi2GetEventIndicatorsTYPE            *getEventIndicators;
-    fmi2GetContinuousStatesTYPE           *getContinuousStates;
-    fmi2GetNominalsOfContinuousStatesTYPE *getNominalsOfContinuousStates;
-} FMU;
-
-#endif // FMI_H
-

+ 0 - 243
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/include/fmi2FunctionTypes.h

@@ -1,243 +0,0 @@
-#ifndef fmi2FunctionTypes_h
-#define fmi2FunctionTypes_h
-
-#include "fmi2TypesPlatform.h"
-
-/* This header file must be utilized when compiling an FMU or an FMI master.
-   It declares data and function types for FMI 2.0
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Apr.  3, 2014: Added #include <stddef.h> for size_t definition
-   - Mar. 27, 2014: Added #include "fmiTypesPlatform.h" (#179)
-   - Mar. 26, 2014: Introduced function argument "void" for the functions (#171)
-                      fmiGetTypesPlatformTYPE and fmiGetVersionTYPE
-   - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
-                      fmiInstantiateModelTYPE , fmiInstantiateSlaveTYPE  -> fmiInstantiateTYPE
-                      fmiFreeModelInstanceTYPE, fmiFreeSlaveInstanceTYPE -> fmiFreeInstanceTYPE
-                      fmiEnterModelInitializationModeTYPE, fmiEnterSlaveInitializationModeTYPE -> fmiEnterInitializationModeTYPE
-                      fmiExitModelInitializationModeTYPE , fmiExitSlaveInitializationModeTYPE  -> fmiExitInitializationModeTYPE
-                      fmiTerminateModelTYPE , fmiTerminateSlaveTYPE  -> fmiTerminate
-                      fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
-                    Functions renamed
-                      fmiUpdateDiscreteStatesTYPE -> fmiNewDiscreteStatesTYPE
-                    Renamed elements of the enumeration fmiEventInfo
-                      upcomingTimeEvent             -> nextEventTimeDefined // due to generic naming scheme: varDefined + var
-                      newUpdateDiscreteStatesNeeded -> newDiscreteStatesNeeded;
-   - June 13, 2013: Changed type fmiEventInfo
-                    Functions removed:
-                       fmiInitializeModelTYPE
-                       fmiEventUpdateTYPE
-                       fmiCompletedEventIterationTYPE
-                       fmiInitializeSlaveTYPE
-                    Functions added:
-                       fmiEnterModelInitializationModeTYPE
-                       fmiExitModelInitializationModeTYPE
-                       fmiEnterEventModeTYPE
-                       fmiUpdateDiscreteStatesTYPE
-                       fmiEnterContinuousTimeModeTYPE
-                       fmiEnterSlaveInitializationModeTYPE;
-                       fmiExitSlaveInitializationModeTYPE;
-   - Feb. 17, 2013: Added third argument to fmiCompletedIntegratorStepTYPE
-                    Changed function name "fmiTerminateType" to "fmiTerminateModelType" (due to #113)
-                    Changed function name "fmiGetNominalContinuousStateTYPE" to
-                                          "fmiGetNominalsOfContinuousStatesTYPE"
-                    Removed fmiGetStateValueReferencesTYPE.
-   - Nov. 14, 2011: First public Version
-
-
-   Copyright © 2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* make sure all compiler use the same alignment policies for structures */
-#if defined _MSC_VER || defined __GNUC__
-#pragma pack(push,8)
-#endif
-
-/* Include stddef.h, in order that size_t etc. is defined */
-#include <stddef.h>
-
-
-/* Type definitions */
-typedef enum {
-    fmi2OK,
-    fmi2Warning,
-    fmi2Discard,
-    fmi2Error,
-    fmi2Fatal,
-    fmi2Pending
-} fmi2Status;
-
-typedef enum {
-    fmi2ModelExchange,
-    fmi2CoSimulation
-} fmi2Type;
-
-typedef enum {
-    fmi2DoStepStatus,
-    fmi2PendingStatus,
-    fmi2LastSuccessfulTime,
-    fmi2Terminated
-} fmi2StatusKind;
-
-typedef void      (*fmi2CallbackLogger)        (fmi2ComponentEnvironment, fmi2String, fmi2Status, fmi2String, fmi2String, ...);
-typedef void*     (*fmi2CallbackAllocateMemory)(size_t, size_t);
-typedef void      (*fmi2CallbackFreeMemory)    (void*);
-typedef void      (*fmi2StepFinished)          (fmi2ComponentEnvironment, fmi2Status);
-
-typedef struct {
-   const fmi2CallbackLogger         logger;
-   const fmi2CallbackAllocateMemory allocateMemory;
-   const fmi2CallbackFreeMemory     freeMemory;
-   const fmi2StepFinished           stepFinished;
-   const fmi2ComponentEnvironment   componentEnvironment;
-} fmi2CallbackFunctions;
-
-typedef struct {
-	 fmi2Boolean newDiscreteStatesNeeded;
-   fmi2Boolean terminateSimulation;
-   fmi2Boolean nominalsOfContinuousStatesChanged;
-   fmi2Boolean valuesOfContinuousStatesChanged;
-   fmi2Boolean nextEventTimeDefined;
-   fmi2Real    nextEventTime;
-} fmi2EventInfo;
-
-
-/* reset alignment policy to the one set before reading this file */
-#if defined _MSC_VER || defined __GNUC__
-#pragma pack(pop)
-#endif
-
-
-/* Define fmi2 function pointer types to simplify dynamic loading */
-
-/***************************************************
-Types for Common Functions
-****************************************************/
-
-/* Inquire version numbers of header files and setting logging status */
-   typedef const char* fmi2GetTypesPlatformTYPE(void);
-   typedef const char* fmi2GetVersionTYPE(void);
-   typedef fmi2Status  fmi2SetDebugLoggingTYPE(fmi2Component, fmi2Boolean, size_t, const fmi2String[]);
-
-/* Creation and destruction of FMU instances and setting debug status */
-   typedef fmi2Component fmi2InstantiateTYPE (fmi2String, fmi2Type, fmi2String, fmi2String, const fmi2CallbackFunctions*, fmi2Boolean, fmi2Boolean);
-   typedef void          fmi2FreeInstanceTYPE(fmi2Component);
-
-/* Enter and exit initialization mode, terminate and reset */
-   typedef fmi2Status fmi2SetupExperimentTYPE        (fmi2Component, fmi2Boolean, fmi2Real, fmi2Real, fmi2Boolean, fmi2Real);
-   typedef fmi2Status fmi2EnterInitializationModeTYPE(fmi2Component);
-   typedef fmi2Status fmi2ExitInitializationModeTYPE (fmi2Component);
-   typedef fmi2Status fmi2TerminateTYPE              (fmi2Component);
-   typedef fmi2Status fmi2ResetTYPE                  (fmi2Component);
-
-/* Getting and setting variable values */
-   typedef fmi2Status fmi2GetRealTYPE   (fmi2Component, const fmi2ValueReference[], size_t, fmi2Real   []);
-   typedef fmi2Status fmi2GetIntegerTYPE(fmi2Component, const fmi2ValueReference[], size_t, fmi2Integer[]);
-   typedef fmi2Status fmi2GetBooleanTYPE(fmi2Component, const fmi2ValueReference[], size_t, fmi2Boolean[]);
-   typedef fmi2Status fmi2GetStringTYPE (fmi2Component, const fmi2ValueReference[], size_t, fmi2String []);
-
-   typedef fmi2Status fmi2SetRealTYPE   (fmi2Component, const fmi2ValueReference[], size_t, const fmi2Real   []);
-   typedef fmi2Status fmi2SetIntegerTYPE(fmi2Component, const fmi2ValueReference[], size_t, const fmi2Integer[]);
-   typedef fmi2Status fmi2SetBooleanTYPE(fmi2Component, const fmi2ValueReference[], size_t, const fmi2Boolean[]);
-   typedef fmi2Status fmi2SetStringTYPE (fmi2Component, const fmi2ValueReference[], size_t, const fmi2String []);
-
-/* Getting and setting the internal FMU state */
-   typedef fmi2Status fmi2GetFMUstateTYPE           (fmi2Component, fmi2FMUstate*);
-   typedef fmi2Status fmi2SetFMUstateTYPE           (fmi2Component, fmi2FMUstate);
-   typedef fmi2Status fmi2FreeFMUstateTYPE          (fmi2Component, fmi2FMUstate*);
-   typedef fmi2Status fmi2SerializedFMUstateSizeTYPE(fmi2Component, fmi2FMUstate, size_t*);
-   typedef fmi2Status fmi2SerializeFMUstateTYPE     (fmi2Component, fmi2FMUstate, fmi2Byte[], size_t);
-   typedef fmi2Status fmi2DeSerializeFMUstateTYPE   (fmi2Component, const fmi2Byte[], size_t, fmi2FMUstate*);
-
-/* Getting partial derivatives */
-   typedef fmi2Status fmi2GetDirectionalDerivativeTYPE(fmi2Component, const fmi2ValueReference[], size_t,
-                                                                   const fmi2ValueReference[], size_t,
-                                                                   const fmi2Real[], fmi2Real[]);
-
-/***************************************************
-Types for Functions for FMI2 for Model Exchange
-****************************************************/
-
-/* Enter and exit the different modes */
-   typedef fmi2Status fmi2EnterEventModeTYPE         (fmi2Component);
-   typedef fmi2Status fmi2NewDiscreteStatesTYPE      (fmi2Component, fmi2EventInfo*);
-   typedef fmi2Status fmi2EnterContinuousTimeModeTYPE(fmi2Component);
-   typedef fmi2Status fmi2CompletedIntegratorStepTYPE(fmi2Component, fmi2Boolean, fmi2Boolean*, fmi2Boolean*);
-
-/* Providing independent variables and re-initialization of caching */
-   typedef fmi2Status fmi2SetTimeTYPE            (fmi2Component, fmi2Real);
-   typedef fmi2Status fmi2SetContinuousStatesTYPE(fmi2Component, const fmi2Real[], size_t);
-
-/* Evaluation of the model equations */
-   typedef fmi2Status fmi2GetDerivativesTYPE               (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetEventIndicatorsTYPE           (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetContinuousStatesTYPE          (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetNominalsOfContinuousStatesTYPE(fmi2Component, fmi2Real[], size_t);
-
-
-/***************************************************
-Types for Functions for FMI2 for Co-Simulation
-****************************************************/
-
-/* Simulating the slave */
-   typedef fmi2Status fmi2SetRealInputDerivativesTYPE (fmi2Component, const fmi2ValueReference [], size_t, const fmi2Integer [], const fmi2Real []);
-   typedef fmi2Status fmi2GetRealOutputDerivativesTYPE(fmi2Component, const fmi2ValueReference [], size_t, const fmi2Integer [], fmi2Real []);
-
-   typedef fmi2Status fmi2DoStepTYPE     (fmi2Component, fmi2Real, fmi2Real, fmi2Boolean);
-   typedef fmi2Status fmi2CancelStepTYPE (fmi2Component);
-
-/* Inquire slave status */
-   typedef fmi2Status fmi2GetStatusTYPE       (fmi2Component, const fmi2StatusKind, fmi2Status* );
-   typedef fmi2Status fmi2GetRealStatusTYPE   (fmi2Component, const fmi2StatusKind, fmi2Real*   );
-   typedef fmi2Status fmi2GetIntegerStatusTYPE(fmi2Component, const fmi2StatusKind, fmi2Integer*);
-   typedef fmi2Status fmi2GetBooleanStatusTYPE(fmi2Component, const fmi2StatusKind, fmi2Boolean*);
-   typedef fmi2Status fmi2GetStringStatusTYPE (fmi2Component, const fmi2StatusKind, fmi2String* );
-
-
-#ifdef __cplusplus
-}  /* end of extern "C" { */
-#endif
-
-#endif /* fmi2FunctionTypes_h */

+ 0 - 333
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/include/fmi2Functions.h

@@ -1,333 +0,0 @@
-#ifndef fmi2Functions_h
-#define fmi2Functions_h
-
-/* This header file must be utilized when compiling a FMU.
-   It defines all functions of the
-         FMI 2.0 Model Exchange and Co-Simulation Interface.
-
-   In order to have unique function names even if several FMUs
-   are compiled together (e.g. for embedded systems), every "real" function name
-   is constructed by prepending the function name by "FMI2_FUNCTION_PREFIX".
-   Therefore, the typical usage is:
-
-      #define FMI2_FUNCTION_PREFIX MyModel_
-      #include "fmi2Functions.h"
-
-   As a result, a function that is defined as "fmi2GetDerivatives" in this header file,
-   is actually getting the name "MyModel_fmi2GetDerivatives".
-
-   This only holds if the FMU is shipped in C source code, or is compiled in a
-   static link library. For FMUs compiled in a DLL/sharedObject, the "actual" function
-   names are used and "FMI2_FUNCTION_PREFIX" must not be defined.
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Mar. 26, 2014: FMI_Export set to empty value if FMI_Export and FMI_FUNCTION_PREFIX
-                    are not defined (#173)
-   - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
-                      fmiInstantiateModel , fmiInstantiateSlave  -> fmiInstantiate
-                      fmiFreeModelInstance, fmiFreeSlaveInstance -> fmiFreeInstance
-                      fmiEnterModelInitializationMode, fmiEnterSlaveInitializationMode -> fmiEnterInitializationMode
-                      fmiExitModelInitializationMode , fmiExitSlaveInitializationMode  -> fmiExitInitializationMode
-                      fmiTerminateModel, fmiTerminateSlave  -> fmiTerminate
-                      fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
-                    Functions renamed:
-                      fmiUpdateDiscreteStates -> fmiNewDiscreteStates
-   - June 13, 2013: Functions removed:
-                       fmiInitializeModel
-                       fmiEventUpdate
-                       fmiCompletedEventIteration
-                       fmiInitializeSlave
-                    Functions added:
-                       fmiEnterModelInitializationMode
-                       fmiExitModelInitializationMode
-                       fmiEnterEventMode
-                       fmiUpdateDiscreteStates
-                       fmiEnterContinuousTimeMode
-                       fmiEnterSlaveInitializationMode;
-                       fmiExitSlaveInitializationMode;
-   - Feb. 17, 2013: Portability improvements:
-                       o DllExport changed to FMI_Export
-                       o FUNCTION_PREFIX changed to FMI_FUNCTION_PREFIX
-                       o Allow undefined FMI_FUNCTION_PREFIX (meaning no prefix is used)
-                    Changed function name "fmiTerminate" to "fmiTerminateModel" (due to #113)
-                    Changed function name "fmiGetNominalContinuousState" to
-                                          "fmiGetNominalsOfContinuousStates"
-                    Removed fmiGetStateValueReferences.
-   - Nov. 14, 2011: Adapted to FMI 2.0:
-                       o Split into two files (fmiFunctions.h, fmiTypes.h) in order
-                         that code that dynamically loads an FMU can directly
-                         utilize the header files).
-                       o Added C++ encapsulation of C-part, in order that the header
-                         file can be directly utilized in C++ code.
-                       o fmiCallbackFunctions is passed as pointer to fmiInstantiateXXX
-                       o stepFinished within fmiCallbackFunctions has as first
-                         argument "fmiComponentEnvironment" and not "fmiComponent".
-                       o New functions to get and set the complete FMU state
-                         and to compute partial derivatives.
-   - Nov.  4, 2010: Adapted to specification text:
-                       o fmiGetModelTypesPlatform renamed to fmiGetTypesPlatform
-                       o fmiInstantiateSlave: Argument GUID     replaced by fmuGUID
-                                              Argument mimetype replaced by mimeType
-                       o tabs replaced by spaces
-   - Oct. 16, 2010: Functions for FMI for Co-simulation added
-   - Jan. 20, 2010: stateValueReferencesChanged added to struct fmiEventInfo (ticket #27)
-                    (by M. Otter, DLR)
-                    Added WIN32 pragma to define the struct layout (ticket #34)
-                    (by J. Mauss, QTronic)
-   - Jan.  4, 2010: Removed argument intermediateResults from fmiInitialize
-                    Renamed macro fmiGetModelFunctionsVersion to fmiGetVersion
-                    Renamed macro fmiModelFunctionsVersion to fmiVersion
-                    Replaced fmiModel by fmiComponent in decl of fmiInstantiateModel
-                    (by J. Mauss, QTronic)
-   - Dec. 17, 2009: Changed extension "me" to "fmi" (by Martin Otter, DLR).
-   - Dez. 14, 2009: Added eventInfo to meInitialize and added
-                    meGetNominalContinuousStates (by Martin Otter, DLR)
-   - Sept. 9, 2009: Added DllExport (according to Peter Nilsson's suggestion)
-                    (by A. Junghanns, QTronic)
-   - Sept. 9, 2009: Changes according to FMI-meeting on July 21:
-                    meInquireModelTypesVersion     -> meGetModelTypesPlatform
-                    meInquireModelFunctionsVersion -> meGetModelFunctionsVersion
-                    meSetStates                    -> meSetContinuousStates
-                    meGetStates                    -> meGetContinuousStates
-                    removal of meInitializeModelClass
-                    removal of meGetTime
-                    change of arguments of meInstantiateModel
-                    change of arguments of meCompletedIntegratorStep
-                    (by Martin Otter, DLR):
-   - July 19, 2009: Added "me" as prefix to file names (by Martin Otter, DLR).
-   - March 2, 2009: Changed function definitions according to the last design
-                    meeting with additional improvements (by Martin Otter, DLR).
-   - Dec. 3 , 2008: First version by Martin Otter (DLR) and Hans Olsson (Dynasim).
-
-   Copyright © 2008-2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "fmi2TypesPlatform.h"
-#include "fmi2FunctionTypes.h"
-#include <stdlib.h>
-
-
-/*
-  Export FMI2 API functions on Windows and under GCC.
-  If custom linking is desired then the FMI2_Export must be
-  defined before including this file. For instance,
-  it may be set to __declspec(dllimport).
-*/
-#if !defined(FMI2_Export)
-  #if !defined(FMI2_FUNCTION_PREFIX)
-    #if defined _WIN32 || defined __CYGWIN__
-     /* Note: both gcc & MSVC on Windows support this syntax. */
-        #define FMI2_Export __declspec(dllexport)
-    #else
-      #if __GNUC__ >= 4
-        #define FMI2_Export __attribute__ ((visibility ("default")))
-      #else
-        #define FMI2_Export
-      #endif
-    #endif
-  #else
-    #define FMI2_Export
-  #endif
-#endif
-
-/* Macros to construct the real function name
-   (prepend function name by FMI2_FUNCTION_PREFIX) */
-#if defined(FMI2_FUNCTION_PREFIX)
-  #define fmi2Paste(a,b)     a ## b
-  #define fmi2PasteB(a,b)    fmi2Paste(a,b)
-  #define fmi2FullName(name) fmi2PasteB(FMI2_FUNCTION_PREFIX, name)
-#else
-  #define fmi2FullName(name) name
-#endif
-
-/***************************************************
-Common Functions
-****************************************************/
-#define fmi2GetTypesPlatform         fmi2FullName(fmi2GetTypesPlatform)
-#define fmi2GetVersion               fmi2FullName(fmi2GetVersion)
-#define fmi2SetDebugLogging          fmi2FullName(fmi2SetDebugLogging)
-#define fmi2Instantiate              fmi2FullName(fmi2Instantiate)
-#define fmi2FreeInstance             fmi2FullName(fmi2FreeInstance)
-#define fmi2SetupExperiment          fmi2FullName(fmi2SetupExperiment)
-#define fmi2EnterInitializationMode  fmi2FullName(fmi2EnterInitializationMode)
-#define fmi2ExitInitializationMode   fmi2FullName(fmi2ExitInitializationMode)
-#define fmi2Terminate                fmi2FullName(fmi2Terminate)
-#define fmi2Reset                    fmi2FullName(fmi2Reset)
-#define fmi2GetReal                  fmi2FullName(fmi2GetReal)
-#define fmi2GetInteger               fmi2FullName(fmi2GetInteger)
-#define fmi2GetBoolean               fmi2FullName(fmi2GetBoolean)
-#define fmi2GetString                fmi2FullName(fmi2GetString)
-#define fmi2SetReal                  fmi2FullName(fmi2SetReal)
-#define fmi2SetInteger               fmi2FullName(fmi2SetInteger)
-#define fmi2SetBoolean               fmi2FullName(fmi2SetBoolean)
-#define fmi2SetString                fmi2FullName(fmi2SetString)
-#define fmi2GetFMUstate              fmi2FullName(fmi2GetFMUstate)
-#define fmi2SetFMUstate              fmi2FullName(fmi2SetFMUstate)
-#define fmi2FreeFMUstate             fmi2FullName(fmi2FreeFMUstate)
-#define fmi2SerializedFMUstateSize   fmi2FullName(fmi2SerializedFMUstateSize)
-#define fmi2SerializeFMUstate        fmi2FullName(fmi2SerializeFMUstate)
-#define fmi2DeSerializeFMUstate      fmi2FullName(fmi2DeSerializeFMUstate)
-#define fmi2GetDirectionalDerivative fmi2FullName(fmi2GetDirectionalDerivative)
-
-
-/***************************************************
-Functions for FMI2 for Model Exchange
-****************************************************/
-#define fmi2EnterEventMode                fmi2FullName(fmi2EnterEventMode)
-#define fmi2NewDiscreteStates             fmi2FullName(fmi2NewDiscreteStates)
-#define fmi2EnterContinuousTimeMode       fmi2FullName(fmi2EnterContinuousTimeMode)
-#define fmi2CompletedIntegratorStep       fmi2FullName(fmi2CompletedIntegratorStep)
-#define fmi2SetTime                       fmi2FullName(fmi2SetTime)
-#define fmi2SetContinuousStates           fmi2FullName(fmi2SetContinuousStates)
-#define fmi2GetDerivatives                fmi2FullName(fmi2GetDerivatives)
-#define fmi2GetEventIndicators            fmi2FullName(fmi2GetEventIndicators)
-#define fmi2GetContinuousStates           fmi2FullName(fmi2GetContinuousStates)
-#define fmi2GetNominalsOfContinuousStates fmi2FullName(fmi2GetNominalsOfContinuousStates)
-
-
-/***************************************************
-Functions for FMI2 for Co-Simulation
-****************************************************/
-#define fmi2SetRealInputDerivatives      fmi2FullName(fmi2SetRealInputDerivatives)
-#define fmi2GetRealOutputDerivatives     fmi2FullName(fmi2GetRealOutputDerivatives)
-#define fmi2DoStep                       fmi2FullName(fmi2DoStep)
-#define fmi2CancelStep                   fmi2FullName(fmi2CancelStep)
-#define fmi2GetStatus                    fmi2FullName(fmi2GetStatus)
-#define fmi2GetRealStatus                fmi2FullName(fmi2GetRealStatus)
-#define fmi2GetIntegerStatus             fmi2FullName(fmi2GetIntegerStatus)
-#define fmi2GetBooleanStatus             fmi2FullName(fmi2GetBooleanStatus)
-#define fmi2GetStringStatus              fmi2FullName(fmi2GetStringStatus)
-
-/* Version number */
-#define fmi2Version "2.0"
-
-
-/***************************************************
-Common Functions
-****************************************************/
-
-/* Inquire version numbers of header files */
-   FMI2_Export fmi2GetTypesPlatformTYPE fmi2GetTypesPlatform;
-   FMI2_Export fmi2GetVersionTYPE       fmi2GetVersion;
-   FMI2_Export fmi2SetDebugLoggingTYPE  fmi2SetDebugLogging;
-
-/* Creation and destruction of FMU instances */
-   FMI2_Export fmi2InstantiateTYPE  fmi2Instantiate;
-   FMI2_Export fmi2FreeInstanceTYPE fmi2FreeInstance;
-
-/* Enter and exit initialization mode, terminate and reset */
-   FMI2_Export fmi2SetupExperimentTYPE         fmi2SetupExperiment;
-   FMI2_Export fmi2EnterInitializationModeTYPE fmi2EnterInitializationMode;
-   FMI2_Export fmi2ExitInitializationModeTYPE  fmi2ExitInitializationMode;
-   FMI2_Export fmi2TerminateTYPE               fmi2Terminate;
-   FMI2_Export fmi2ResetTYPE                   fmi2Reset;
-
-/* Getting and setting variables values */
-   FMI2_Export fmi2GetRealTYPE    fmi2GetReal;
-   FMI2_Export fmi2GetIntegerTYPE fmi2GetInteger;
-   FMI2_Export fmi2GetBooleanTYPE fmi2GetBoolean;
-   FMI2_Export fmi2GetStringTYPE  fmi2GetString;
-
-   FMI2_Export fmi2SetRealTYPE    fmi2SetReal;
-   FMI2_Export fmi2SetIntegerTYPE fmi2SetInteger;
-   FMI2_Export fmi2SetBooleanTYPE fmi2SetBoolean;
-   FMI2_Export fmi2SetStringTYPE  fmi2SetString;
-
-/* Getting and setting the internal FMU state */
-   FMI2_Export fmi2GetFMUstateTYPE            fmi2GetFMUstate;
-   FMI2_Export fmi2SetFMUstateTYPE            fmi2SetFMUstate;
-   FMI2_Export fmi2FreeFMUstateTYPE           fmi2FreeFMUstate;
-   FMI2_Export fmi2SerializedFMUstateSizeTYPE fmi2SerializedFMUstateSize;
-   FMI2_Export fmi2SerializeFMUstateTYPE      fmi2SerializeFMUstate;
-   FMI2_Export fmi2DeSerializeFMUstateTYPE    fmi2DeSerializeFMUstate;
-
-/* Getting partial derivatives */
-   FMI2_Export fmi2GetDirectionalDerivativeTYPE fmi2GetDirectionalDerivative;
-
-
-/***************************************************
-Functions for FMI2 for Model Exchange
-****************************************************/
-
-/* Enter and exit the different modes */
-   FMI2_Export fmi2EnterEventModeTYPE               fmi2EnterEventMode;
-   FMI2_Export fmi2NewDiscreteStatesTYPE            fmi2NewDiscreteStates;
-   FMI2_Export fmi2EnterContinuousTimeModeTYPE      fmi2EnterContinuousTimeMode;
-   FMI2_Export fmi2CompletedIntegratorStepTYPE      fmi2CompletedIntegratorStep;
-
-/* Providing independent variables and re-initialization of caching */
-   FMI2_Export fmi2SetTimeTYPE             fmi2SetTime;
-   FMI2_Export fmi2SetContinuousStatesTYPE fmi2SetContinuousStates;
-
-/* Evaluation of the model equations */
-   FMI2_Export fmi2GetDerivativesTYPE                fmi2GetDerivatives;
-   FMI2_Export fmi2GetEventIndicatorsTYPE            fmi2GetEventIndicators;
-   FMI2_Export fmi2GetContinuousStatesTYPE           fmi2GetContinuousStates;
-   FMI2_Export fmi2GetNominalsOfContinuousStatesTYPE fmi2GetNominalsOfContinuousStates;
-
-
-/***************************************************
-Functions for FMI2 for Co-Simulation
-****************************************************/
-
-/* Simulating the slave */
-   FMI2_Export fmi2SetRealInputDerivativesTYPE  fmi2SetRealInputDerivatives;
-   FMI2_Export fmi2GetRealOutputDerivativesTYPE fmi2GetRealOutputDerivatives;
-
-   FMI2_Export fmi2DoStepTYPE     fmi2DoStep;
-   FMI2_Export fmi2CancelStepTYPE fmi2CancelStep;
-
-/* Inquire slave status */
-   FMI2_Export fmi2GetStatusTYPE        fmi2GetStatus;
-   FMI2_Export fmi2GetRealStatusTYPE    fmi2GetRealStatus;
-   FMI2_Export fmi2GetIntegerStatusTYPE fmi2GetIntegerStatus;
-   FMI2_Export fmi2GetBooleanStatusTYPE fmi2GetBooleanStatus;
-   FMI2_Export fmi2GetStringStatusTYPE  fmi2GetStringStatus;
-
-#ifdef __cplusplus
-}  /* end of extern "C" { */
-#endif
-
-#endif /* fmi2Functions_h */

+ 0 - 115
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/include/fmi2TypesPlatform.h

@@ -1,115 +0,0 @@
-#ifndef fmi2TypesPlatform_h
-#define fmi2TypesPlatform_h
-
-/* Standard header file to define the argument types of the
-   functions of the Functional Mock-up Interface 2.0.
-   This header file must be utilized both by the model and
-   by the simulation engine.
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Mar   31, 2014: New datatype fmiChar introduced.
-   - Feb.  17, 2013: Changed fmiTypesPlatform from "standard32" to "default".
-                     Removed fmiUndefinedValueReference since no longer needed
-                     (because every state is defined in ScalarVariables).
-   - March 20, 2012: Renamed from fmiPlatformTypes.h to fmiTypesPlatform.h
-   - Nov.  14, 2011: Use the header file "fmiPlatformTypes.h" for FMI 2.0
-                     both for "FMI for model exchange" and for "FMI for co-simulation"
-                     New types "fmiComponentEnvironment", "fmiState", and "fmiByte".
-                     The implementation of "fmiBoolean" is change from "char" to "int".
-                     The #define "fmiPlatform" changed to "fmiTypesPlatform"
-                     (in order that #define and function call are consistent)
-   - Oct.   4, 2010: Renamed header file from "fmiModelTypes.h" to fmiPlatformTypes.h"
-                     for the co-simulation interface
-   - Jan.   4, 2010: Renamed meModelTypes_h to fmiModelTypes_h (by Mauss, QTronic)
-   - Dec.  21, 2009: Changed "me" to "fmi" and "meModel" to "fmiComponent"
-                     according to meeting on Dec. 18 (by Martin Otter, DLR)
-   - Dec.   6, 2009: Added meUndefinedValueReference (by Martin Otter, DLR)
-   - Sept.  9, 2009: Changes according to FMI-meeting on July 21:
-                     Changed "version" to "platform", "standard" to "standard32",
-                     Added a precise definition of "standard32" as comment
-                     (by Martin Otter, DLR)
-   - July  19, 2009: Added "me" as prefix to file names, added meTrue/meFalse,
-                     and changed meValueReferenced from int to unsigned int
-                     (by Martin Otter, DLR).
-   - March  2, 2009: Moved enums and function pointer definitions to
-                     ModelFunctions.h (by Martin Otter, DLR).
-   - Dec.  3, 2008 : First version by Martin Otter (DLR) and
-                     Hans Olsson (Dynasim).
-
-
-   Copyright © 2008-2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-/* Platform (unique identification of this header file) */
-#define fmi2TypesPlatform "default"
-
-/* Type definitions of variables passed as arguments
-   Version "default" means:
-
-   fmi2Component           : an opaque object pointer
-   fmi2ComponentEnvironment: an opaque object pointer
-   fmi2FMUstate            : an opaque object pointer
-   fmi2ValueReference      : handle to the value of a variable
-   fmi2Real                : double precision floating-point data type
-   fmi2Integer             : basic signed integer data type
-   fmi2Boolean             : basic signed integer data type
-   fmi2Char                : character data type
-   fmi2String              : a pointer to a vector of fmi2Char characters
-                             ('\0' terminated, UTF8 encoded)
-   fmi2Byte                : smallest addressable unit of the machine, typically one byte.
-*/
-   typedef void*           fmi2Component;               /* Pointer to FMU instance       */
-   typedef void*           fmi2ComponentEnvironment;    /* Pointer to FMU environment    */
-   typedef void*           fmi2FMUstate;                /* Pointer to internal FMU state */
-   typedef unsigned int    fmi2ValueReference;
-   typedef double          fmi2Real   ;
-   typedef int             fmi2Integer;
-   typedef int             fmi2Boolean;
-   typedef char            fmi2Char;
-   typedef const fmi2Char* fmi2String;
-   typedef char            fmi2Byte;
-
-/* Values for fmi2Boolean  */
-#define fmi2True  1
-#define fmi2False 0
-
-
-#endif /* fmi2TypesPlatform_h */

+ 0 - 654
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlElement.cpp

@@ -1,654 +0,0 @@
-/*
- * Copyright QTronic GmbH. All rights reserved.
- */
-
-/* ---------------------------------------------------------------------------*
- * XmlElement.cpp
- * Elements implementation that describe content of model description of a
- * FMI 2.0 model. All elements have Element as parent class. Elements have
- * attributes and other specific content.
- *
- * Author: Adrian Tirea
- * ---------------------------------------------------------------------------*/
-
-#include "XmlElement.h"
-#include <assert.h>
-#include <map>
-#include <string>
-#include <vector>
-#include "XmlParserException.h"
-
-#ifdef STANDALONE_XML_PARSER
-#define logThis(n, ...) printf(__VA_ARGS__); printf("\n")
-#else
-#include "GlobalIncludes.h"
-#include "logging.h"  // logThis
-#endif  // STANDALONE_XML_PARSER
-
-Element::~Element() {
-    for (std::map<XmlParser::Att, char *>::const_iterator it = attributes.begin(); it != attributes.end(); ++it) {
-        free(it->second);
-    }
-    attributes.clear();
-}
-template <typename T> void Element::deleteListOfElements(const std::vector<T *> &list) {
-    typename std::vector<T*>::const_iterator it;
-    for (it = list.begin(); it != list.end(); ++it) {
-        delete *it;
-    }
-}
-void Element::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    throw XmlParserException("Elements are not expected inside '%s'. Found instead '%s'",
-        XmlParser::elmNames[type],
-        childName);
-}
-void Element::printElement(int indent) {
-    std::string indentS(indent, ' ');
-    logThis(ERROR_INFO, "%s%s", indentS.c_str(), XmlParser::elmNames[type]);
-    for (std::map<XmlParser::Att, char *>::const_iterator it = attributes.begin(); it != attributes.end(); ++it) {
-        logThis(ERROR_INFO, "%s%s=%s", indentS.c_str(), XmlParser::attNames[it->first], it->second);
-    }
-}
-template <typename T> void Element::printListOfElements(int indent, const std::vector<T *> &list) {
-    typename std::vector<T*>::const_iterator it;
-    for (it = list.begin(); it != list.end(); ++it) {
-        (*it)->printElement(indent);
-    }
-}
-
-const char *Element::getAttributeValue(XmlParser::Att att) {
-    std::map<XmlParser::Att, char *>::const_iterator it = attributes.find(att);
-    if (it != attributes.end()) {
-        return it->second;
-    }
-    return NULL;
-}
-int Element::getAttributeInt(XmlParser::Att att, XmlParser::ValueStatus *vs) {
-    int n = 0;
-    const char *value = getAttributeValue(att);
-    if (!value) { *vs = XmlParser::valueMissing; return n; }
-    *vs = (1 == sscanf(value, "%d", &n)) ? XmlParser::valueDefined : XmlParser::valueIllegal;
-    return n;
-}
-unsigned int Element::getAttributeUInt(XmlParser::Att att, XmlParser::ValueStatus *vs) {
-    unsigned int u = -1;
-    const char* value = getAttributeValue(att);
-    if (!value) { *vs = XmlParser::valueMissing; return u; }
-    *vs = (1 == sscanf(value, "%u", &u)) ? XmlParser::valueDefined : XmlParser::valueIllegal;
-    return u;
-}
-double Element::getAttributeDouble(XmlParser::Att att, XmlParser::ValueStatus *vs) {
-    double d = 0;
-    const char* value = getAttributeValue(att);
-    if (!value) { *vs = XmlParser::valueMissing; return d; }
-    *vs = (1 == sscanf(value, "%lf", &d)) ? XmlParser::valueDefined : XmlParser::valueIllegal;
-    return d;
-}
-bool Element::getAttributeBool(XmlParser::Att att, XmlParser::ValueStatus *vs) {
-    const char* value = getAttributeValue(att);
-    if (!value) {*vs = XmlParser::valueMissing; return false;}
-    *vs = XmlParser::valueDefined;
-    if (!strcmp(value, "true")) return true;
-    if (!strcmp(value, "false")) return false;
-    *vs = XmlParser::valueIllegal;
-    return false;
-}
-
-ListElement::~ListElement() {
-    deleteListOfElements(list);
-}
-void ListElement::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    if (childType == XmlParser::elm_Item) {
-        Element *item = new Element;
-        item->type = childType;
-        parser->parseElementAttributes(item);
-        if (!isEmptyElement) {
-            parser->parseEndElement();
-        }
-        list.push_back(item);
-    } else {
-        throw XmlParserException("Expected '%s' element inside '%s'. Found instead: '%s'.",
-                XmlParser::elmNames[XmlParser::elm_Item],
-                XmlParser::elmNames[XmlParser::elm_Enumeration],
-                childName);
-    }
-}
-void ListElement::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-    printListOfElements(childIndent, list);
-}
-
-
-Unit::Unit() {
-    baseUnit = NULL;
-}
-Unit::~Unit() {
-    if (baseUnit) delete baseUnit;
-    deleteListOfElements(displayUnits);
-}
-void Unit::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    if (childType == XmlParser::elm_BaseUnit) {
-        baseUnit = new Element;
-        baseUnit->type = childType;
-        parser->parseElementAttributes(baseUnit);
-        if (!isEmptyElement) {
-            parser->parseEndElement();
-        }
-    } else if (childType == XmlParser::elm_DisplayUnit) {
-        Element *displayUnit = new Element;
-        displayUnit->type = childType;
-        parser->parseElementAttributes(displayUnit);
-        displayUnits.push_back(displayUnit);
-        if (!isEmptyElement) {
-            parser->parseEndElement();
-        }
-    } else {
-        throw XmlParserException("Expected '%s' | '%s' element inside '%s'. Found instead: '%s'.",
-            XmlParser::elmNames[XmlParser::elm_BaseUnit],
-            XmlParser::elmNames[XmlParser::elm_DisplayUnit],
-            XmlParser::elmNames[XmlParser::elm_SourceFiles],
-            childName);
-    }
-}
-void Unit::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-    if (baseUnit) baseUnit->printElement(childIndent);
-    printListOfElements(childIndent, displayUnits);
-}
-
-
-SimpleType::SimpleType() {
-    typeSpec = NULL;
-}
-SimpleType::~SimpleType() {
-    if (typeSpec) delete typeSpec;
-}
-void SimpleType::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    switch (childType) {
-        case XmlParser::elm_Real:
-        case XmlParser::elm_Integer:
-        case XmlParser::elm_Boolean:
-        case XmlParser::elm_String: {
-            typeSpec = new Element;
-            typeSpec->type = childType;
-            parser->parseElementAttributes(typeSpec);
-            if (!isEmptyElement) {
-                parser->parseEndElement();
-            }
-            break;
-        }
-        case XmlParser::elm_Enumeration: {
-            typeSpec = new ListElement;
-            typeSpec->type = childType;
-            parser->parseElementAttributes(typeSpec);
-            if (!isEmptyElement) {
-                parser->parseChildElements(typeSpec);
-            }
-            break;
-        }
-        default: {
-            throw XmlParserException(
-                "Expected '%s' | '%s' | '%s' | '%s' | '%s' element inside '%s'. Found instead: '%s'.",
-                XmlParser::elmNames[XmlParser::elm_Real],
-                XmlParser::elmNames[XmlParser::elm_Integer],
-                XmlParser::elmNames[XmlParser::elm_Boolean],
-                XmlParser::elmNames[XmlParser::elm_String],
-                XmlParser::elmNames[XmlParser::elm_Enumeration],
-                XmlParser::elmNames[type],
-                childName);
-        }
-    }
-}
-void SimpleType::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-    if (typeSpec) typeSpec->printElement(childIndent);
-}
-
-
-Component::~Component() {
-    deleteListOfElements(files);
-}
-void Component::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    if (childType == XmlParser::elm_SourceFiles) {
-        if (!isEmptyElement) {
-            parser->parseChildElements(this);
-        }
-    } else if (childType == XmlParser::elm_File) {
-        Element *sourceFile = new Element;
-        sourceFile->type = childType;
-        parser->parseElementAttributes(sourceFile);
-        if (!isEmptyElement) {
-            parser->parseEndElement();
-        }
-        files.push_back(sourceFile);
-    } else {
-        throw XmlParserException("Expected '%s' | '%s' element inside '%s'. Found instead: '%s'.",
-            XmlParser::elmNames[XmlParser::elm_File],
-            XmlParser::elmNames[XmlParser::elm_SourceFiles],
-            XmlParser::elmNames[type],
-            childName);
-    }
-}
-void Component::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-    printListOfElements(childIndent, files);
-}
-
-
-ScalarVariable::ScalarVariable() {
-    typeSpec = NULL;
-}
-ScalarVariable::~ScalarVariable() {
-    delete typeSpec;
-    deleteListOfElements(annotations);
-}
-void ScalarVariable::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    switch (childType) {
-        case XmlParser::elm_Real:
-        case XmlParser::elm_Integer:
-        case XmlParser::elm_Boolean:
-        case XmlParser::elm_String:
-        case XmlParser::elm_Enumeration: {
-            typeSpec = new Element;
-            typeSpec->type = childType;
-            parser->parseElementAttributes(typeSpec);
-            if (!isEmptyElement) {
-                parser->parseEndElement();
-            }
-            break;
-        }
-        case XmlParser::elm_Annotations: {
-            // no attributes expected; this class handles also the Tool
-            if (!isEmptyElement) parser->parseChildElements(this);
-            break;
-        }
-        case XmlParser::elm_Tool: {
-            Element *tool = new Element;
-            tool->type = childType;
-            parser->parseElementAttributes(tool, false);
-            if (!isEmptyElement) {
-                parser->parseSkipChildElement();
-            }
-            annotations.push_back(tool);
-            break;
-        }
-        default: {
-            throw XmlParserException(
-                "Expected '%s' | '%s' | '%s' | '%s' | '%s' | '%s' | '%s' element inside '%s'. Found instead: '%s'.",
-                XmlParser::elmNames[XmlParser::elm_Real],
-                XmlParser::elmNames[XmlParser::elm_Integer],
-                XmlParser::elmNames[XmlParser::elm_Boolean],
-                XmlParser::elmNames[XmlParser::elm_String],
-                XmlParser::elmNames[XmlParser::elm_Enumeration],
-                XmlParser::elmNames[XmlParser::elm_Annotations],
-                XmlParser::elmNames[XmlParser::elm_Tool],
-                XmlParser::elmNames[type],
-                childName);
-        }
-    }
-}
-fmi2ValueReference ScalarVariable::getValueReference() {
-    XmlParser::ValueStatus vs;
-    fmi2ValueReference ref = getAttributeUInt(XmlParser::att_valueReference, &vs);
-    assert(vs == XmlParser::valueDefined);  // this is a required attribute
-    return ref;
-}
-XmlParser::Enu ScalarVariable::getVariability() {
-    const char *value = getAttributeValue(XmlParser::att_variability);
-    if (!value) {
-        return XmlParser::enu_continuous;  // default
-    }
-    try {
-        return XmlParser::checkEnumValue(value);
-    } catch (XmlParserException& ) {
-        return XmlParser::enu_BAD_DEFINED;
-    }
-}
-XmlParser::Enu ScalarVariable::getCausality() {
-    const char *value = getAttributeValue(XmlParser::att_causality);
-    if (!value) {
-        return XmlParser::enu_local;  // default
-    }
-    try {
-        return XmlParser::checkEnumValue(value);
-    } catch (XmlParserException& ) {
-        return XmlParser::enu_BAD_DEFINED;
-    }
-}
-void ScalarVariable::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-    typeSpec->printElement(childIndent);
-    printListOfElements(childIndent, annotations);
-}
-
-ModelStructure::ModelStructure() {
-    unknownParentType = XmlParser::elm_BAD_DEFINED;
-}
-
-ModelStructure::~ModelStructure() {
-    deleteListOfElements(outputs);
-    deleteListOfElements(derivatives);
-    deleteListOfElements(discreteStates);
-    deleteListOfElements(initialUnknowns);
-}
-void ModelStructure::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    switch (childType) {
-    case XmlParser::elm_Outputs:
-    case XmlParser::elm_Derivatives:
-    case XmlParser::elm_DiscreteStates:
-    case XmlParser::elm_InitialUnknowns:
-        {
-            // no attributes expected; this class handles also the Unknown
-            if (!isEmptyElement) {
-                unknownParentType = childType;
-                parser->parseChildElements(this);
-            }
-            break;
-        }
-    case XmlParser::elm_Unknown:
-        {
-            Element *unknown = new Element;
-            unknown->type = childType;
-            parser->parseElementAttributes(unknown);
-            if (!isEmptyElement) {
-                parser->parseEndElement();
-            }
-            switch (unknownParentType) {
-                case XmlParser::elm_Outputs:
-                    outputs.push_back(unknown);
-                    break;
-                case XmlParser::elm_Derivatives:
-                    derivatives.push_back(unknown);
-                    break;
-                case XmlParser::elm_DiscreteStates:
-                    discreteStates.push_back(unknown);
-                    break;
-                case XmlParser::elm_InitialUnknowns:
-                    initialUnknowns.push_back(unknown);
-                    break;
-                default: {
-                    throw XmlParserException(
-                    "Element '%s' must be inside of '%s' | '%s' | '%s' | '%s'.",
-                    XmlParser::elmNames[XmlParser::elm_Unknown],
-                    XmlParser::elmNames[XmlParser::elm_Outputs],
-                    XmlParser::elmNames[XmlParser::elm_Derivatives],
-                    XmlParser::elmNames[XmlParser::elm_DiscreteStates],
-                    XmlParser::elmNames[XmlParser::elm_InitialUnknowns]);
-}
-            }
-            break;
-        }
-    default:
-        {
-            throw XmlParserException(
-                "Expected '%s' | '%s' | '%s' | '%s' | '%s' element inside '%s'. Found instead: '%s'.",
-                XmlParser::elmNames[XmlParser::elm_Outputs],
-                XmlParser::elmNames[XmlParser::elm_Derivatives],
-                XmlParser::elmNames[XmlParser::elm_DiscreteStates],
-                XmlParser::elmNames[XmlParser::elm_InitialUnknowns],
-                XmlParser::elmNames[XmlParser::elm_Unknown],
-                XmlParser::elmNames[type],
-                childName);
-        }
-    }
-}
-void ModelStructure::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-    printListOfElements(childIndent, outputs);
-    printListOfElements(childIndent, derivatives);
-    printListOfElements(childIndent, discreteStates);
-    printListOfElements(childIndent, initialUnknowns);
-}
-
-
-ModelDescription::ModelDescription() {
-    modelExchange = NULL;
-    coSimulation = NULL;
-    defaultExperiment = NULL;
-    modelStructure = NULL;
-}
-ModelDescription::~ModelDescription() {
-    deleteListOfElements(unitDefinitions);
-    deleteListOfElements(typeDefinitions);
-    if (coSimulation) delete coSimulation;
-    if (modelExchange) delete modelExchange;
-    deleteListOfElements(logCategories);
-    if (defaultExperiment) delete defaultExperiment;
-    deleteListOfElements(vendorAnnotations);
-    deleteListOfElements(modelVariables);
-    if (modelStructure) delete modelStructure;
-}
-void ModelDescription::handleElement(XmlParser *parser, const char *childName, int isEmptyElement) {
-    XmlParser::Elm childType = parser->checkElement(childName);
-    switch (childType) {
-    case XmlParser::elm_CoSimulation:
-        {
-            coSimulation = new Component;
-            coSimulation->type = childType;
-            parser->parseElementAttributes(coSimulation);
-            if (!isEmptyElement) {
-                parser->parseChildElements(coSimulation);
-            }
-            break;
-        }
-    case XmlParser::elm_ModelExchange:
-        {
-            modelExchange = new Component;
-            modelExchange->type = childType;
-            parser->parseElementAttributes(modelExchange);
-            if (!isEmptyElement) {
-                parser->parseChildElements(modelExchange);
-            }
-            break;
-        }
-    case XmlParser::elm_UnitDefinitions:
-        {
-            // no attributes expected; this class handles the Category
-            if (!isEmptyElement) parser->parseChildElements(this);
-            break;
-        }
-    case XmlParser::elm_Unit:
-        {
-            Unit *unit = new Unit;
-            unit->type = childType;
-            parser->parseElementAttributes(unit);
-            if (!isEmptyElement) {
-                parser->parseChildElements(unit);
-            }
-            unitDefinitions.push_back(unit);
-            break;
-        }
-    case XmlParser::elm_TypeDefinitions:
-        {
-            // no attributes expected; this class handles also the SimpleType
-            if (!isEmptyElement) parser->parseChildElements(this);
-            break;
-        }
-    case XmlParser::elm_SimpleType:
-        {
-            SimpleType *type = new SimpleType;
-            type->type = childType;
-            parser->parseElementAttributes(type);
-            if (!isEmptyElement) {
-                parser->parseChildElements(type);
-            }
-            typeDefinitions.push_back(type);
-            break;
-        }
-    case XmlParser::elm_DefaultExperiment:
-        {
-            defaultExperiment = new Element;
-            defaultExperiment->type = childType;
-            parser->parseElementAttributes(defaultExperiment);
-            if (!isEmptyElement) {
-                parser->parseEndElement();
-            }
-            break;
-        }
-    case XmlParser::elm_LogCategories:
-        {
-            // no attributes expected; this class handles also the Category
-            if (!isEmptyElement) parser->parseChildElements(this);
-            break;
-        }
-    case XmlParser::elm_Category:
-        {
-            Element *category = new Element;
-            category->type = childType;
-            parser->parseElementAttributes(category);
-            if (!isEmptyElement) {
-                parser->parseEndElement();
-            }
-            logCategories.push_back(category);
-            break;
-        }
-    case XmlParser::elm_VendorAnnotations:
-        {
-            // no attributes expected; this class handles also the Tool
-            if (!isEmptyElement) parser->parseChildElements(this);
-            break;
-        }
-    case XmlParser::elm_Tool:
-        {
-            Element *tool = new Element;
-            tool->type = childType;
-            parser->parseElementAttributes(tool, false);
-            if (!isEmptyElement) {
-                parser->parseSkipChildElement();
-            }
-            vendorAnnotations.push_back(tool);
-            break;
-        }
-    case XmlParser::elm_ModelVariables:
-        {
-            // no attributes expected; this class handles also the ScalarVariable
-            if (!isEmptyElement) parser->parseChildElements(this);
-            break;
-        }
-    case XmlParser::elm_ScalarVariable:
-        {
-            ScalarVariable *variable = new ScalarVariable;
-            variable->type = childType;
-            parser->parseElementAttributes(variable);
-            if (!isEmptyElement) {
-                parser->parseChildElements(variable);
-            }
-            modelVariables.push_back(variable);
-            break;
-        }
-    case XmlParser::elm_ModelStructure:
-        {
-            modelStructure = new ModelStructure;
-            modelStructure->type = childType;
-            parser->parseElementAttributes(modelStructure);
-            if (!isEmptyElement) {
-                parser->parseChildElements(modelStructure);
-            }
-            break;
-        }
-    default:
-        throw XmlParserException("Element '%s' is not expected inside of '%s' | '%s' | '%s' | '%s'.",
-            childName,
-            XmlParser::elmNames[type]);
-    }
-}
-
-void ModelDescription::printElement(int indent) {
-    Element::printElement(indent);
-    int childIndent = indent + 1;
-
-    if (coSimulation) coSimulation->printElement(childIndent);
-    if (modelExchange) modelExchange->printElement(childIndent);
-    for (std::vector<Unit *>::const_iterator it = unitDefinitions.begin(); it != unitDefinitions.end(); ++it) {
-        (*it)->printElement(childIndent);
-    }
-    for (std::vector<SimpleType *>::const_iterator it = typeDefinitions.begin(); it != typeDefinitions.end(); ++it) {
-        (*it)->printElement(childIndent);
-    }
-    for (std::vector<Element *>::const_iterator it = logCategories.begin(); it != logCategories.end(); ++it) {
-        (*it)->printElement(childIndent);
-    }
-    if (defaultExperiment) defaultExperiment->printElement(childIndent);
-    for (std::vector<Element *>::const_iterator it = vendorAnnotations.begin(); it != vendorAnnotations.end(); ++it) {
-        (*it)->printElement(childIndent);
-    }
-    for (std::vector<ScalarVariable *>::const_iterator it = modelVariables.begin(); it != modelVariables.end(); ++it) {
-        (*it)->printElement(childIndent);
-    }
-    if (modelStructure) modelStructure->printElement(childIndent);
-}
-
-SimpleType *ModelDescription::getSimpleType(const char *name) {
-    for (std::vector<SimpleType *>::const_iterator it = typeDefinitions.begin(); it != typeDefinitions.end(); ++it) {
-        const char *typeName = (*it)->getAttributeValue(XmlParser::att_name);
-        if (typeName && 0 == strcmp(typeName, name)) {
-            return (*it);
-        }
-    }
-    return NULL;
-}
-
-ScalarVariable *ModelDescription::getVariable(const char *name) {
-    if (!name) return NULL;
-    for (std::vector<ScalarVariable *>::const_iterator it = modelVariables.begin(); it != modelVariables.end(); ++it) {
-        const char *varName = (*it)->getAttributeValue(XmlParser::att_name);
-        if (varName && 0 == strcmp(name, varName)) {
-            return (*it);
-        }
-    }
-    return NULL;
-}
-
-// Enumeration and Integer have the same base type while
-// Real, String, Boolean define own base types.
-static int sameBaseType(XmlParser::Elm  t1, XmlParser::Elm  t2){
-    return t1 == t2 ||
-           t1 == XmlParser::elm_Enumeration && t2 == XmlParser::elm_Integer ||
-           t2 == XmlParser::elm_Enumeration && t1 == XmlParser::elm_Integer;
-}
-
-ScalarVariable *ModelDescription::getVariable(fmi2ValueReference vr, XmlParser::Elm type) {
-    for (std::vector<ScalarVariable *>::const_iterator it = modelVariables.begin(); it != modelVariables.end(); ++it) {
-        if (vr == (*it)->getValueReference() && sameBaseType(type, (*it)->typeSpec->type)) {
-            return (*it);
-        }
-    }
-    return NULL;
-}
-
-const char *ModelDescription::getDescriptionForVariable(ScalarVariable *sv) {
-    const char *desc = sv->getAttributeValue(XmlParser::att_description);
-    // found description
-    if (desc) return desc;
-    // look for description of declared type:
-    const char *typeName = sv->typeSpec->getAttributeValue(XmlParser::att_declaredType);
-    if (typeName) {
-        SimpleType *type = getSimpleType(typeName);
-        if (type) return type->getAttributeValue(XmlParser::att_description);
-    }
-    return NULL;
-}
-
-const char *ModelDescription::getAttributeFromTypeOrDeclaredType(ScalarVariable *sv, XmlParser::Att a) {
-    const char *stringValue = sv->typeSpec->getAttributeValue(a);
-    if (stringValue) return stringValue;
-    // look for stringValue inside declared type:
-    const char *typeName = sv->typeSpec->getAttributeValue(XmlParser::att_declaredType);
-    if (typeName) {
-        SimpleType *type = getSimpleType(typeName);
-        if (type) return type->getAttributeValue(a);
-    }
-    return NULL;
-}

+ 0 - 160
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlElement.h

@@ -1,160 +0,0 @@
-/*
- * Copyright QTronic GmbH. All rights reserved.
- */
-
-/* ---------------------------------------------------------------------------*
- * XmlElement.h
- * Contains elements classes that describe content of model description of a
- * FMI 2.0 model. All elements have Element as parent class. Elements have
- * attributes and other specific content.
- *
- * Author: Adrian Tirea
- * ---------------------------------------------------------------------------*/
-
-#ifndef XML_ELEMENT_H
-#define XML_ELEMENT_H
-
-#include <map>
-#include <vector>
-#include "XmlParser.h"
-
-class Element {
- public:
-    XmlParser::Elm type;  // element type
-    std::map<XmlParser::Att, char*> attributes;  // map with key one of XmlParser::Att
-
- public:
-    virtual ~Element();
-    virtual void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    virtual void printElement(int indent);
-    const char *getAttributeValue(XmlParser::Att att);  // value or NULL if not present
-    int getAttributeInt(XmlParser::Att att, XmlParser::ValueStatus *vs);
-    unsigned int getAttributeUInt(XmlParser::Att att, XmlParser::ValueStatus *vs);
-    double getAttributeDouble(XmlParser::Att att, XmlParser::ValueStatus *vs);
-    bool getAttributeBool(XmlParser::Att att, XmlParser::ValueStatus *vs);
-
-    template <typename T> void printListOfElements(int indent, const std::vector<T *> &list);
-    template <typename T> void deleteListOfElements(const std::vector<T *> &list);
-};
-
-
-class ListElement : public Element {
- public:
-    std::vector<Element*> list;  // list of Element
-
- public:
-    ~ListElement();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-};
-
-
-class Unit : public Element {
- public:
-    std::vector<Element *> displayUnits;  // list of DisplayUnit
-    Element *baseUnit;                    // null or BaseUnit
-
- public:
-    Unit();
-    ~Unit();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-};
-
-
-class SimpleType : public Element {
- public:
-    Element *typeSpec;  // one of RealType, IntegerType etc.
-
- public:
-    SimpleType();
-    ~SimpleType();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-};
-
-
-class Component : public Element {
- public:
-    std::vector<Element *> files;  // list of File. Only meaningful for source code FMUs (not .dll).
-
- public:
-    ~Component();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-};
-
-
-class ScalarVariable : public Element {
- public :
-    Element *typeSpec;                   // one of Real, Integer, etc
-    std::vector<Element *> annotations;  // list of Annotations
-    // int modelIdx;                     // only used in fmu10
-
- public:
-    ScalarVariable();
-    ~ScalarVariable();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-    // get the valueReference of current variable. This attribute is mandatory for a variable.
-    fmi2ValueReference getValueReference();
-    // returns one of constant, fixed, tunable, discrete, continuous.
-    // If value is missing, the default continuous is returned.
-    // If unknown value, return enu_BAD_DEFINED.
-    XmlParser::Enu getVariability();
-    // returns one of parameter, calculatedParameter, input, output, local, independent.
-    // If value is missing, the default local is returned.
-    // If unknown value, return enu_BAD_DEFINED.
-    XmlParser::Enu getCausality();
-};
-
-
-class ModelStructure : public Element {
- private:
-    XmlParser::Elm unknownParentType;  // used in handleElement to know in which list next Unknown belongs.
-
- public:
-    std::vector<Element *> outputs;            // list of Unknown
-    std::vector<Element *> derivatives;        // list of Unknown
-    std::vector<Element *> discreteStates;     // list of Unknown
-    std::vector<Element *> initialUnknowns;    // list of Unknown
-
- public:
-    ModelStructure();
-    ~ModelStructure();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-};
-
-class ModelDescription : public Element {
- public:
-    std::vector<Unit *> unitDefinitions;        // list of Units
-    std::vector<SimpleType *> typeDefinitions;  // list of Types
-    Component *modelExchange;                   // NULL or ModelExchange
-    Component *coSimulation;                    // NULL or CoSimulation
-                                                // At least one of CoSimulation, ModelExchange must be present.
-    std::vector<Element *> logCategories;       // list of Category
-    Element *defaultExperiment;                 // NULL or DefaultExperiment
-    std::vector<Element *> vendorAnnotations;   // list of Tools
-    std::vector<ScalarVariable *> modelVariables;  // list of ScalarVariable
-    ModelStructure *modelStructure;             // not NULL ModelStructure
-
- public:
-    ModelDescription();
-    ~ModelDescription();
-    void handleElement(XmlParser *parser, const char *childName, int isEmptyElement);
-    void printElement(int indent);
-    // get the SimpleType definition by name, if any. NULL if not found.
-    SimpleType *getSimpleType(const char *name);
-    // get the ScalarVariable by name, if any. NULL if not found.
-    ScalarVariable *getVariable(const char *name);
-    // get the ScalarVariable by vr and type. NULL if not found.
-    ScalarVariable *getVariable(fmi2ValueReference vr, XmlParser::Elm type);
-    // get description from variable, if not present look for type definition description.
-    const char *getDescriptionForVariable(ScalarVariable *sv);
-    // get attribute from type, if not present look for it inside declared type.
-    // Attributes example: 'min', 'max', 'quantity'.
-    const char *getAttributeFromTypeOrDeclaredType(ScalarVariable *sv, XmlParser::Att a);
-};
-
-#endif  // XML_ELEMENT_H

+ 0 - 314
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParser.cpp

@@ -1,314 +0,0 @@
-/*
- * Copyright QTronic GmbH. All rights reserved.
- */
-
-/* ---------------------------------------------------------------------------*
- * XmlParser.cpp
- * Parser implementation for xml model description file of a FMI 2.0 model.
- * The result of parsing is a ModelDescription object that can be queried to
- * get necessary information. The parsing is based on libxml2.lib.
- *
- * Author: Adrian Tirea
- * ---------------------------------------------------------------------------*/
-
-#include "XmlParser.h"
-#include <utility>
-#include <vector>
-#include "XmlElement.h"
-#include "XmlParserException.h"
-
-
-#ifdef STANDALONE_XML_PARSER
-#define logThis(n, ...) printf(__VA_ARGS__); printf("\n")
-#define checkStrdup(str) strdup(str)
-#else
-#include "GlobalIncludes.h"
-#include "logging.h"  // logThis
-#include "minutil.h"  // checkStrdup
-#endif  // STANDALONE_XML_PARSER
-
-/* Helper functions to check validity of xml. */
-static int checkAttribute(const char* att);
-
-const char *XmlParser::elmNames[SIZEOF_ELM] = {
-    "fmiModelDescription", "ModelExchange", "CoSimulation", "SourceFiles", "File",
-    "UnitDefinitions", "Unit", "BaseUnit", "DisplayUnit", "TypeDefinitions",
-    "SimpleType", "Real", "Integer", "Boolean", "String",
-    "Enumeration", "Item", "LogCategories", "Category", "DefaultExperiment",
-    "VendorAnnotations", "Tool", "ModelVariables", "ScalarVariable", "Annotations",
-    "ModelStructure", "Outputs", "Derivatives", "DiscreteStates", "InitialUnknowns",
-    "Unknown"
-};
-
-const char *XmlParser::attNames[SIZEOF_ATT] = {
-    "fmiVersion", "modelName", "guid", "description", "author",
-    "version", "copyright", "license", "generationTool", "generationDateAndTime",
-    "variableNamingConvention", "numberOfEventIndicators", "name", "kg", "m",
-    "s", "A", "K", "mol", "cd",
-    "rad", "factor", "offset", "quantity", "unit",
-    "displayUnit", "relativeQuantity", "min", "max", "nominal",
-    "unbounded", "value", "startTime", "stopTime", "tolerance",
-    "stepSize", "valueReference", "causality", "variability", "initial",
-    "previous", "canHandleMultipleSetPerTimeInstant", "declaredType", "start", "derivative",
-    "reinit", "index", "dependencies", "dependenciesKind", "modelIdentifier",
-    "needsExecutionTool", "completedIntegratorStepNotNeeded", "canBeInstantiatedOnlyOncePerProcess",
-        "canNotUseMemoryManagementFunctions", "canGetAndSetFMUstate",
-    "canSerializeFMUstate", "providesDirectionalDerivative", "canHandleVariableCommunicationStepSize",
-        "canInterpolateInputs", "maxOutputDerivativeOrder",
-    "canRunAsynchronuously",
-
-    // not conform with the FMI 2.0 doc.  // TODO : remove when used models become mature.
-    "xmlns:xsi",                       // Dymola examples from 2014 FD01
-    "providesDirectionalDerivatives",  // Dymola examples from 2014 FD01
-    "canHandleEvents"                  // Dymola examples from 2014 FD01
-};
-
-const char *XmlParser::enuNames[SIZEOF_ENU] = {
-    "flat", "structured", "dependent", "constant", "fixed",
-    "tunable", "discrete", "parameter", "calculatedParameter", "input",
-    "output", "local", "independent", "continuous", "exact",
-    "approx", "calculated"
-};
-
-XmlParser::XmlParser(char *xmlPath) {
-    this->xmlPath = (char *)checkStrdup(xmlPath);
-    xmlReader = NULL;
-}
-
-XmlParser::~XmlParser() {
-    free(xmlPath);
-    xmlCleanupParser();
-}
-
-ModelDescription *XmlParser::parse() {
-    xmlReader = xmlReaderForFile(xmlPath, NULL, 0);
-    ModelDescription *md = NULL;
-    if (xmlReader != NULL) {
-        try {
-            if (readNextInXml()) {
-                // I expect that first element is fmiModelDescription.
-                if (0 != strcmp((char *)xmlTextReaderConstLocalName(xmlReader), elmNames[elm_fmiModelDescription])) {
-                    throw XmlParserException("Expected '%s' element. Found instead: '%s'.",
-                        elmNames[elm_fmiModelDescription],
-                        xmlTextReaderConstLocalName(xmlReader));
-                }
-
-                md = new ModelDescription;
-                md->type = elm_fmiModelDescription;
-                parseElementAttributes((Element *)md);
-                parseChildElements(md);
-            } else {
-                throw XmlParserException("Syntax error parsing xml file '%s'", xmlPath);
-            }
-        } catch (XmlParserException& e) {
-            logThis(ERROR_ERROR, e.what());
-            md = NULL;
-        } catch (std::bad_alloc& ) {
-            logThis(ERROR_FATAL, "Out of memory");
-            md = NULL;
-        }
-        xmlFreeTextReader(xmlReader);
-    } else {
-        logThis(ERROR_ERROR, "Unable to open '%s'", xmlPath);
-    }
-
-    return validate(md);
-}
-
-void XmlParser::parseElementAttributes(Element *element, bool ignoreUnknownAttributes) {
-    while (xmlTextReaderMoveToNextAttribute(xmlReader)) {
-        xmlChar *name = xmlTextReaderName(xmlReader);
-        xmlChar *value = xmlTextReaderValue(xmlReader);
-        try {
-            XmlParser::Att key = checkAttribute((char *)name);
-            char *theValue = value ? (char *)checkStrdup((char *)value) : NULL;
-            element->attributes.insert(std::pair<XmlParser::Att, char *>(key, theValue));
-        } catch (XmlParserException &ex) {
-            if (ignoreUnknownAttributes) {
-                xmlFree(name);
-                xmlFree(value);
-                throw;
-            }
-        }
-        xmlFree(name);
-        xmlFree(value);
-    }
-}
-
-void XmlParser::parseElementAttributes(Element *element) {
-    parseElementAttributes(element, true);
-}
-
-void XmlParser::parseChildElements(Element *el) {
-    int elementIsEmpty = xmlTextReaderIsEmptyElement(xmlReader);
-    if (elementIsEmpty == -1) {
-        throw XmlParserException("Error parsing xml file '%s'", xmlPath);
-    } else if (elementIsEmpty == 1) {
-        return;
-    }
-
-    bool ret = readNextInXml();
-    while (ret  && xmlTextReaderNodeType(xmlReader) != XML_READER_TYPE_END_ELEMENT) {
-        if (xmlTextReaderNodeType(xmlReader) == XML_READER_TYPE_ELEMENT) {
-            const char *localName = (char *)xmlTextReaderConstLocalName(xmlReader);
-            int depthBefore = xmlTextReaderDepth(xmlReader);
-            int isEmptyElement = xmlTextReaderIsEmptyElement(xmlReader);
-            el->handleElement(this, localName, isEmptyElement);
-            if (!isEmptyElement) {
-                int depthAfter = xmlTextReaderDepth(xmlReader);
-                if (depthBefore != depthAfter) {
-                    throw XmlParserException("Parser error. Depth wrong after parsing sub-tree for %s.", localName);
-                }
-            }
-        }
-        ret = readNextInXml();
-    }
-    if (!ret) {
-        throw XmlParserException("Error parsing xml file '%s'", xmlPath);
-    }
-}
-
-void XmlParser::parseEndElement() {
-    bool ret = readNextInXml();
-    while (ret  && xmlTextReaderNodeType(xmlReader) != XML_READER_TYPE_END_ELEMENT) {
-        ret = readNextInXml();
-    }
-    if (!ret) {
-        throw XmlParserException("Error parsing xml file '%s'", xmlPath);
-    }
-}
-
-void XmlParser::parseSkipChildElement() {
-    int ret = xmlTextReaderNext(xmlReader);
-    if (ret == -1) {
-        throw XmlParserException("Error parsing xml file '%s'", xmlPath);
-    }
-}
-
-bool XmlParser::readNextInXml() {
-    int ret;
-    do {
-        ret = xmlTextReaderRead(xmlReader);
-    } while (ret == 1 && xmlTextReaderNodeType(xmlReader) == XML_READER_TYPE_COMMENT);
-
-    if (ret != 1) {
-        return false;
-    }
-    return true;
-}
-
-/* -------------------------------------------------------------------------* 
- * Helper functions to check validity of xml.
- * -------------------------------------------------------------------------*/
-
-// Returns the index of name in the array.
-// Throw exception if name not found (invalid).
-static int checkName(const char *name, const char *kind, const char *array[], int n) {
-    for (int i = 0; i < n; i++) {
-        if (!strcmp(name, array[i])) {
-            return i;
-        }
-    }
-    throw XmlParserException("Illegal %s %s", kind, name);
-}
-
-XmlParser::Att XmlParser::checkAttribute(const char *att) {
-    return (XmlParser::Att)checkName(att, "attribute", XmlParser::attNames, XmlParser::SIZEOF_ATT);
-}
-
-XmlParser::Elm XmlParser::checkElement(const char *elm) {
-    return (XmlParser::Elm)checkName(elm, "element", XmlParser::elmNames, XmlParser::SIZEOF_ELM);
-}
-
-XmlParser::Enu XmlParser::checkEnumValue(const char *enu) {
-    return (XmlParser::Enu)checkName(enu, "enum value", XmlParser::enuNames, XmlParser::SIZEOF_ENU);
-}
-
-ModelDescription *XmlParser::validate(ModelDescription *md) {
-    if (md == NULL) return NULL;
-    int errors = 0;
-    // check modelDescription required attributes
-    if (!(md->getAttributeValue(XmlParser::att_fmiVersion)
-        && md->getAttributeValue(XmlParser::att_modelName)
-        && md->getAttributeValue(XmlParser::att_guid))) {
-            logThis(ERROR_ERROR, "Model description miss required attributes in file %s", xmlPath);
-            return NULL;
-    }
-
-    if (!(md->coSimulation || md->modelExchange)) {
-        logThis(ERROR_ERROR, "Model description must have a co-simulation or model exchange component in file %s",
-            xmlPath);
-            return NULL;
-    }
-
-    // check model variables
-    for (std::vector<ScalarVariable *>::const_iterator it = md->modelVariables.begin(); it != md->modelVariables.end();
-            ++it) {
-        const char *varName = (*it)->getAttributeValue(XmlParser::att_name);
-        if (!varName) {
-            logThis(ERROR_ERROR, "Scalar variable miss required %s attribute in modelDescription.xml",
-                XmlParser::attNames[XmlParser::att_name]);
-            errors++;
-            continue;
-        }
-        XmlParser::ValueStatus vs;
-        (*it)->getAttributeUInt(XmlParser::att_valueReference, &vs);
-        if (vs == XmlParser::valueMissing) {
-            logThis(ERROR_ERROR, "Scalar variable %s miss required %s attribute in modelDescription.xml",
-                varName, XmlParser::attNames[XmlParser::att_valueReference]);
-            errors++;
-            continue;
-        }
-        if (vs == XmlParser::valueIllegal) {
-            logThis(ERROR_ERROR, "Scalar variable %s has illegal format for %s attribute in modelDescription.xml",
-                varName, XmlParser::attNames[XmlParser::att_valueReference]);
-            errors++;
-            continue;
-        }
-
-        if (!(*it)->typeSpec) {
-            logThis(ERROR_ERROR, "Scalar variable %s miss type specification in modelDescription.xml",
-                varName);
-            errors++;
-            continue;
-        }
-        if ((*it)->typeSpec->type == XmlParser::elm_Enumeration) {
-            const char *typeName = (*it)->typeSpec->getAttributeValue(XmlParser::att_declaredType);
-            if (!typeName) {
-                logThis(ERROR_ERROR, "Scalar variable %s with enum type specification miss required %s attribute in "
-                        "modelDescription.xml", varName, XmlParser::attNames[XmlParser::att_declaredType]);
-                errors++;
-                continue;
-            }
-            if (!md->getSimpleType(typeName)) {
-                logThis(ERROR_ERROR, "Declared type %s of variable %s not found in modelDescription.xml",
-                     typeName, varName);
-                errors++;
-                continue;
-            }
-        }
-    }
-
-    if (errors > 0) {
-        logThis(ERROR_ERROR, "Found %d error in file %s", errors, xmlPath);
-        return NULL;
-    }
-    return md;
-}
-
-// #define TEST
-#ifdef TEST
-int main() {
-    // { char c='c'; while(c!='g') scanf("%c", &c); } // to debug: wait for the g key
-
-    XmlParser *parser =
-        new XmlParser("c:\\_data\\fmi-fmu\\fmi-fmuVS\\fmi-fmuVS\\modelDescriptionDymola - ManuallyModifiedCopy.xml");
-    ModelDescription *md = parser->parse();
-    if (md) md->printElement(0);
-    delete parser;
-    if (md) delete md;
-
-    dumpMemoryLeaks();
-    return 0;
-}
-#endif  // TEST

+ 0 - 126
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParser.h

@@ -1,126 +0,0 @@
-/*
- * Copyright QTronic GmbH. All rights reserved.
- */
-
-/* ---------------------------------------------------------------------------*
- * XmlParser.h
- * Parser for xml model description file of a FMI 2.0 model.
- * The result of parsing is a ModelDescription object that can be queried to
- * get necessary information. The parsing is based on libxml2.lib.
- *
- * Author: Adrian Tirea
- * ---------------------------------------------------------------------------*/
-
-#ifndef XML_PARSER_H
-#define XML_PARSER_H
-
-#include <libxml/xmlreader.h>
-
-#pragma comment(lib, "libxml2.lib")
-#pragma comment(lib, "wsock32.lib")
-
-#ifndef fmi2TypesPlatform_h
-// same as in FMI 2.0 specification
-typedef unsigned int fmi2ValueReference;
-#endif
-
-class Element;
-class ModelDescription;
-
-class XmlParser {
- public:
-    // Elements
-    static const int SIZEOF_ELM = 31;
-    static const char *elmNames[SIZEOF_ELM];
-    enum Elm {
-        elm_BAD_DEFINED = -1,
-        elm_fmiModelDescription, elm_ModelExchange, elm_CoSimulation, elm_SourceFiles, elm_File,
-        elm_UnitDefinitions, elm_Unit, elm_BaseUnit, elm_DisplayUnit, elm_TypeDefinitions,
-        elm_SimpleType, elm_Real, elm_Integer, elm_Boolean, elm_String,
-        elm_Enumeration, elm_Item, elm_LogCategories, elm_Category, elm_DefaultExperiment,
-        elm_VendorAnnotations, elm_Tool, elm_ModelVariables, elm_ScalarVariable, elm_Annotations,
-        elm_ModelStructure, elm_Outputs, elm_Derivatives, elm_DiscreteStates, elm_InitialUnknowns,
-        elm_Unknown
-    };
-
-    // Attributes
-    static const int SIZEOF_ATT = 64;  // 61;
-    static const char *attNames[SIZEOF_ATT];
-    enum Att {
-        att_BAD_DEFINED = -1,
-        att_fmiVersion, att_modelName, att_guid, att_description, att_author,
-        att_version, att_copyright, att_license, att_generationTool, att_generationDateAndTime,
-        att_variableNamingConvention, att_numberOfEventIndicators, att_name, att_kg, att_m,
-        att_s, att_A, att_K, att_mol, att_cd,
-        att_rad, att_factor, att_offset, att_quantity, att_unit,
-        att_displayUnit, att_relativeQuantity, att_min, att_max, att_nominal,
-        att_unbounded, att_value, att_startTime, att_stopTime, att_tolerance,
-        att_stepSize, att_valueReference, att_causality, att_variability, att_initial,
-        att_previous, att_canHandleMultipleSetPerTimeInstant, att_declaredType, att_start, att_derivative,
-        att_reinit, att_index, att_dependencies, att_dependenciesKind, att_modelIdentifier,
-        att_needsExecutionTool, att_completedIntegratorStepNotNeeded, att_canBeInstantiatedOnlyOncePerProcess,
-            att_canNotUseMemoryManagementFunctions, att_canGetAndSetFMUstate,
-        att_canSerializeFMUstate, att_providesDirectionalDerivative, att_canHandleVariableCommunicationStepSize,
-            att_canInterpolateInputs, att_maxOutputDerivativeOrder,
-        att_canRunAsynchronuously,
-
-        att_xmlnsXsi, att_providesDirectionalDerivatives, att_canHandleEvents
-    };
-
-    // Enumeration values
-    static const int SIZEOF_ENU = 17;
-    static const char *enuNames[SIZEOF_ENU];
-    enum Enu {
-        enu_BAD_DEFINED = -1,
-        enu_flat, enu_structured, enu_dependent, enu_constant, enu_fixed,
-        enu_tunable, enu_discrete, enu_parameter, enu_calculatedParameter, enu_input,
-        enu_output, enu_local, enu_independent, enu_continuous, enu_exact,
-        enu_approx, enu_calculated
-    };
-
-    // Possible results when retrieving an attribute value from an element
-    enum ValueStatus {
-        valueMissing,
-        valueDefined,
-        valueIllegal
-    };
-
- private:
-    char *xmlPath;
-    xmlTextReaderPtr xmlReader;
-
- public:
-    // return the type of this element. Int value match the index in elmNames.
-    // throw XmlParserException if element is invalid.
-    static XmlParser::Elm checkElement(const char* elm);
-    // return the type of this attribute. Int value match the index in attNames.
-    // throw XmlParserException if attribute is invalid.
-    static XmlParser::Att checkAttribute(const char* att);
-    // return the type of this enum value. Int value match the index in enuNames.
-    // throw XmlParserException if enu is invalid.
-    static XmlParser::Enu checkEnumValue(const char* enu);
-
-    // Obs. the destructor calls xmlCleanupParser(). This is a single call for all parsers instantiated.
-    // Be carefully how you link XmlParser (i.e. multithreading, more parsers started at once).
-    explicit XmlParser(char *xmlPath);
-    ~XmlParser();
-    // return NULL on errors. Caller must free the result if not NULL.
-    ModelDescription *parse();
-
-    // throw XmlParserException if attribute invalid.
-    void parseElementAttributes(Element *element);
-    void parseElementAttributes(Element *element, bool ignoreUnknownAttributes);
-    void parseChildElements(Element *el);
-    void parseEndElement();
-    void parseSkipChildElement();
-
- private:
-    // advance reading in xml and skip comments if present.
-    bool readNextInXml();
-
-    // check some properties of model description (i.e. each variable has valueReference, ...)
-    // if valid return the input model description, else return NULL.
-    ModelDescription *validate(ModelDescription *md);
-};
-
-#endif  // XML_PARSER_H

+ 0 - 242
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParserCApi.cpp

@@ -1,242 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * XmlParserCApi.cpp
- * Expose functionality of XmlParser.cpp as a c API.
- * Call functions of this file to parse and get information from xml
- * model description file of a FMI 2.0 model.
- *
- * Author: Adrian Tirea
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-#include "XmlParserCApi.h"
-#include "XmlParser.h"
-#include "XmlElement.h"
-
-#ifdef STANDALONE_XML_PARSER
-#define logThis(n, ...) printf(__VA_ARGS__); printf("\n")
-#define checkStrdup(str) strdup(str)
-#else
-#include "logging.h"  // logThis
-#endif  // STANDALONE_XML_PARSER
-
-ModelDescription* parse(char* xmlPath) {
-    XmlParser parser(xmlPath);
-    return parser.parse();
-}
-void freeModelDescription(ModelDescription *md) {
-    if (md) delete md;
-}
-
-/* ModelDescription fields access*/
-int getUnitDefinitionsSize(ModelDescription *md) {
-    return md->unitDefinitions.size();
-}
-
-Unit *getUnitDefinition(ModelDescription *md, int index) {
-    return md->unitDefinitions.at(index);
-}
-
-int getTypeDefinitionsSize(ModelDescription *md) {
-    return md->typeDefinitions.size();
-}
-
-SimpleType *getTypeDefinition(ModelDescription *md, int index) {
-    return md->typeDefinitions.at(index);
-}
-
-Component *getModelExchange(ModelDescription *md) {
-    return md->modelExchange;
-}
-
-Component *getCoSimulation(ModelDescription *md) {
-    return md->coSimulation;
-}
-
-int getLogCategoriesSize(ModelDescription *md) {
-    return md->logCategories.size();
-}
-
-Element *getLogCategory(ModelDescription *md, int index) {
-    return md->logCategories.at(index);
-}
-
-Element *getDefaultExperiment(ModelDescription *md) {
-    return md->defaultExperiment;
-}
-
-int getVendorAnnotationsSize(ModelDescription *md) {
-    return md->vendorAnnotations.size();
-}
-
-Element *getVendorAnnotation(ModelDescription *md, int index) {
-    return md->vendorAnnotations.at(index);
-}
-
-int getScalarVariableSize(ModelDescription *md) {
-    return md->modelVariables.size();
-}
-
-ScalarVariable *getScalarVariable(ModelDescription *md, int index) {
-    return md->modelVariables.at(index);
-}
-
-ModelStructure  *getModelStructure (ModelDescription *md) {
-    return md->modelStructure;
-}
-
-SimpleType *getSimpleType(ModelDescription *md, const char *name) {
-    return md->getSimpleType(name);
-}
-
-ScalarVariable *getVariable(ModelDescription *md, const char *name) {
-    return md->getVariable(name);
-}
-
-const char *getDescriptionForVariable(ModelDescription *md, ScalarVariable *sv) {
-    return md->getDescriptionForVariable(sv);
-}
-
-/* ModelStructure fields access */
-int getOutputs(ModelStructure *ms) {
-    return ms->outputs.size();
-}
-
-Element *getOutput(ModelStructure *ms, int index) {
-    return ms->outputs.at(index);
-}
-
-int getDerivativesSize(ModelStructure *ms) {
-    return ms->derivatives.size();
-}
-
-Element *getDerivative(ModelStructure *ms, int index) {
-    return ms->derivatives.at(index);
-}
-
-int getDiscreteStates(ModelStructure *ms) {
-    return ms->discreteStates.size();
-}
-
-Element *getDiscreteState(ModelStructure *ms, int index) {
-    return ms->discreteStates.at(index);
-}
-
-int getInitialUnknowns(ModelStructure *ms) {
-    return ms->initialUnknowns.size();
-}
-
-Element *getInitialUnknown(ModelStructure *ms, int index) {
-    return ms->initialUnknowns.at(index);
-}
-
-/* ScalarVariable field access */
-Element *getTypeSpec(ScalarVariable *sv) {
-    return sv->typeSpec;
-}
-
-int getAnnotationsSize(ScalarVariable *sv) {
-    return sv->annotations.size();
-}
-
-Element *getAnnotation(ScalarVariable *sv, int index) {
-    return sv->annotations.at(index);
-}
-
-fmi2ValueReference getValueReference(ScalarVariable *sv) {
-    return sv->getValueReference();
-}
-// returns one of constant, fixed, tunable, discrete, continuous.
-// If value is missing, the default continuous is returned.
-// If unknown value, return enu_BAD_DEFINED.
-Enu getVariability(ScalarVariable *sv) {
-    return (Enu)sv->getVariability();
-}
-// returns one of parameter, calculatedParameter, input, output, local, independent.
-// If value is missing, the default local is returned.
-// If unknown value, return enu_BAD_DEFINED.
-Enu getCausality(ScalarVariable *sv) {
-    return (Enu)sv->getCausality();
-}
-
-/* Component field access */
-int getFilesSize(Component *c) {
-    return c->files.size();
-}
-
-Element *getFile(Component *c, int index) {
-    return c->files.at(index);
-}
-
-/* SimpleType field access */
-Element *getTypeSpecDef(SimpleType *st) {
-    return st->typeSpec;
-}
-
-/* Unit field access */
-Element *getBaseUnit(Unit *u) {
-    return u->baseUnit;
-}
-
-int getDisplayUnitsSize(Unit *u) {
-    return u->displayUnits.size();
-}
-
-Element *getDisplayUnit(Unit *u, int index) {
-    return u->displayUnits.at(index);
-}
-
-/* ListElement field access */
-int getListSize(ListElement *le) {
-    return le->list.size();
-}
-
-Element *getElementFromList(ListElement *le, int index) {
-    return le->list.at(index);
-}
-
-/* Element functions */
-Elm getElementType(Element *el) {
-    return (Elm)el->type;
-}
-
-const char *getElementTypeName(Element *el) {
-    return XmlParser::elmNames[el->type];
-}
-
-const char **getAttributesAsArray(Element *el, int *n) {
-    *n = el->attributes.size();
-    const char **result = (const char **)calloc(2 * (*n), sizeof(char *));
-    if (!result) {
-        logThis(ERROR_FATAL, "Out of memory");
-        n = 0;
-        return NULL;
-    }
-    int i = 0;
-    for (std::map<XmlParser::Att, char *>::iterator it = el->attributes.begin(); it != el->attributes.end(); ++it ) {
-        result[i] = (const char*)XmlParser::attNames[it->first];
-        result[i + 1] = it->second;
-        i = i + 2;
-    }
-    return result;
-}
-
-const char *getAttributeValue(Element *el, Att att) {
-    return el->getAttributeValue((XmlParser::Att)att);
-}
-
-int getAttributeInt(Element *el, Att att, ValueStatus *vs) {
-    return el->getAttributeInt((XmlParser::Att)att, (XmlParser::ValueStatus *)vs);
-}
-
-unsigned int getAttributeUInt(Element *el, Att att, ValueStatus *vs) {
-    return el->getAttributeUInt((XmlParser::Att)att, (XmlParser::ValueStatus *)vs);
-}
-
-double getAttributeDouble(Element *el, Att att, ValueStatus *vs) {
-    return el->getAttributeDouble((XmlParser::Att)att, (XmlParser::ValueStatus *)vs);
-}
-
-int getAttributeBool(Element *el, Att att, ValueStatus *vs) {
-    if (el->getAttributeBool((XmlParser::Att)att, (XmlParser::ValueStatus *)vs)) return 1;
-    return 0;
-}

+ 0 - 203
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/src/shared/parser/XmlParserCApi.h

@@ -1,203 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * XmlParserCApi.cpp
- * Expose functionality of XmlParser.cpp as a c API.
- * Call functions of this file to parse and get information from xml
- * model description file of a FMI 2.0 model.
- *
- * Author: Adrian Tirea
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-#ifndef XML_PARSER_C_API_H
-#define XML_PARSER_C_API_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef fmi2TypesPlatform_h
-// same as in FMI 2.0 specification
-typedef unsigned int fmi2ValueReference;
-#endif
-
-// elements from ModelDescription
-typedef struct ModelDescription ModelDescription;
-typedef struct ModelStructure ModelStructure;
-typedef struct ScalarVariable ScalarVariable;
-typedef struct Component Component;
-typedef struct SimpleType SimpleType;
-typedef struct Unit Unit;
-typedef struct ListElement ListElement;
-typedef struct Element Element;
-
-// Elements names used in ModelDescription.xml
-typedef enum {
-    elm_BAD_DEFINED = -1,
-    elm_fmiModelDescription, elm_ModelExchange, elm_CoSimulation, elm_SourceFiles, elm_File,
-    elm_UnitDefinitions, elm_Unit, elm_BaseUnit, elm_DisplayUnit, elm_TypeDefinitions,
-    elm_SimpleType, elm_Real, elm_Integer, elm_Boolean, elm_String,
-    elm_Enumeration, elm_Item, elm_LogCategories, elm_Category, elm_DefaultExperiment,
-    elm_VendorAnnotations, elm_Tool, elm_ModelVariables, elm_ScalarVariable, elm_Annotations,
-    elm_ModelStructure, elm_Outputs, elm_Derivatives, elm_DiscreteStates, elm_InitialUnknowns,
-    elm_Unknown
-} Elm;
-
-// Attributes names used in ModelDescription.xml
-typedef enum {
-    att_BAD_DEFINED = -1,
-    att_fmiVersion, att_modelName, att_guid, att_description, att_author,
-    att_version, att_copyright, att_license, att_generationTool, att_generationDateAndTime,
-    att_variableNamingConvention, att_numberOfEventIndicators, att_name, att_kg, att_m,
-    att_s, att_A, att_K, att_mol, att_cd,
-    att_rad, att_factor, att_offset, att_quantity, att_unit,
-    att_displayUnit, att_relativeQuantity, att_min, att_max, att_nominal,
-    att_unbounded, att_value, att_startTime, att_stopTime, att_tolerance,
-    att_stepSize, att_valueReference, att_causality, att_variability, att_initial,
-    att_previous, att_canHandleMultipleSetPerTimeInstant, att_declaredType, att_start, att_derivative,
-    att_reinit, att_index, att_dependencies, att_dependenciesKind, att_modelIdentifier,
-    att_needsExecutionTool, att_completedIntegratorStepNotNeeded, att_canBeInstantiatedOnlyOncePerProcess, att_canNotUseMemoryManagementFunctions, att_canGetAndSetFMUstate,
-    att_canSerializeFMUstate, att_providesDirectionalDerivative, att_canHandleVariableCommunicationStepSize, att_canInterpolateInputs, att_maxOutputDerivativeOrder,
-    att_canRunAsynchronuously
-} Att;
-
-// Enumerated values names used in ModelDescription.xml
-typedef enum {
-    enu_BAD_DEFINED = -1,
-    enu_flat, enu_structured, enu_dependent, enu_constant, enu_fixed,
-    enu_tunable, enu_discrete, enu_parameter, enu_calculatedParameter, enu_input,
-    enu_output, enu_local, enu_independent, enu_continuous, enu_exact,
-    enu_approx, enu_calculated
-} Enu;
-
-typedef enum {
-    valueMissing,
-    valueDefined,
-    valueIllegal
-} ValueStatus;
-
-// Returns NULL to indicate failure
-// Otherwise, return the root node md of the AST. From the result of this
-// function user can access all other elements from ModelDescription.xml.
-// The receiver must call freeModelDescription(md) to release AST memory.
-ModelDescription* parse(char* xmlPath);
-void freeModelDescription(ModelDescription *md);
-
-
-/* ModelDescription functions */
-// get number of unit definitions
-int getUnitDefinitionsSize(ModelDescription *md);
-// get unit definition at index
-Unit *getUnitDefinition(ModelDescription *md, int index);
-// get number of type definitions
-int getTypeDefinitionsSize(ModelDescription *md);
-// get type definition at index
-SimpleType *getTypeDefinition(ModelDescription *md, int index);
-// Null or component for ModelExchange
-Component *getModelExchange(ModelDescription *md);
-// Null or component for CoSimulation
-Component *getCoSimulation(ModelDescription *md);
-// get number of log categories
-int getLogCategoriesSize(ModelDescription *md);
-// get log category at index
-Element *getLogCategory(ModelDescription *md, int index);
-// Null or DefaultExperiment
-Element *getDefaultExperiment(ModelDescription *md);
-// get number of vendor annotations
-int getVendorAnnotationsSize(ModelDescription *md);
-// get vendor annotation at index
-Element *getVendorAnnotation(ModelDescription *md, int index);
-// get number of scalar variables
-int getScalarVariableSize(ModelDescription *md);
-// get scalar variable at index
-ScalarVariable *getScalarVariable(ModelDescription *md, int index);
-// Null or ModelStructure
-ModelStructure  *getModelStructure (ModelDescription *md);
-
-// get the SimpleType definition by name, if any. NULL if not found.
-SimpleType *getSimpleType(ModelDescription *md, const char *name);
-// get the ScalarVariable by name, if any. NULL if not found.
-ScalarVariable *getVariable(ModelDescription *md, const char *name);
-// get description from variable, if not present look for type definition description.
-const char *getDescriptionForVariable(ModelDescription *md, ScalarVariable *sv);
-
-/* ModelStructure functions */
-// get number of outputs
-int getOutputsSize(ModelStructure *ms);
-// get output at index
-Element *getOutput(ModelStructure *ms, int index);
-// get number of derivatives
-int getDerivativesSize(ModelStructure *ms);
-// get derivative at index
-Element *getDerivative(ModelStructure *ms, int index);
-// get number of discrete states
-int getDiscreteStatesSize(ModelStructure *ms);