sim_support.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* -------------------------------------------------------------------------
  2. * sim_support.h
  3. * Functions used by the FMU simulations fmusim_me and fmusim_cs.
  4. * Copyright QTronic GmbH. All rights reserved.
  5. * -------------------------------------------------------------------------*/
  6. #ifndef __SIM_SUPPORT_H
  7. #define __SIM_SUPPORT_H
  8. #include "fmi2.h"
  9. // Used 7z options, version 4.57:
  10. // -x Extracts files from an archive with their full paths in the current dir, or in an output dir if specified
  11. // -aoa Overwrite All existing files without prompt
  12. // -o Specifies a destination directory where files are to be extracted
  13. #define UNZIP_CMD "7z x -aoa -o"
  14. #define XML_FILE "modelDescription.xml"
  15. #define RESULT_FILE "result.csv"
  16. #define BUFSIZE 4096
  17. #ifdef _WIN64
  18. #define DLL_DIR "binaries\\win64\\"
  19. #else
  20. #define DLL_DIR "binaries\\win32\\"
  21. #endif
  22. #define RESOURCES_DIR "resources\\"
  23. // return codes of the 7z command line tool
  24. #define SEVEN_ZIP_NO_ERROR 0 // success
  25. #define SEVEN_ZIP_WARNING 1 // e.g., one or more files were locked during zip
  26. #define SEVEN_ZIP_ERROR 2
  27. #define SEVEN_ZIP_COMMAND_LINE_ERROR 7
  28. #define SEVEN_ZIP_OUT_OF_MEMORY 8
  29. #define SEVEN_ZIP_STOPPED_BY_USER 255
  30. void fmuLogger(fmi2Component c, fmi2String instanceName, fmi2Status status, fmi2String category, fmi2String message, ...);
  31. int unzip(const char *zipPath, const char *outPath);
  32. void parseArguments(int argc, char *argv[], const char **fmuFileName, double *tEnd, double *h,
  33. int *loggingOn, char *csv_separator, int *nCategories, char **logCategories[]);
  34. void loadFMU(const char *fmuFileName);
  35. int loadDll(const char* dllPath, FMU *fmu, const char* preamble);
  36. void deleteUnzippedFiles();
  37. void outputRow(FMU *fmu, fmi2Component c, double time, FILE* file, char separator, fmi2Boolean header);
  38. int error(const char *message);
  39. void printHelp(const char *fmusim);
  40. char *getTempResourcesLocation(); // caller has to free the result
  41. #endif