Claudio Gomes hace 6 años
padre
commit
2a41d61d14
Se han modificado 55 ficheros con 0 adiciones y 3306 borrados
  1. 0 57
      examples/mass_spring_damper/fmusdk/fmu10/bin/License.txt
  2. 0 27
      examples/mass_spring_damper/fmusdk/fmu10/src/build_all.bat
  3. 0 69
      examples/mass_spring_damper/fmusdk/fmu10/src/build_fmusim_cs.bat
  4. 0 69
      examples/mass_spring_damper/fmusdk/fmu10/src/build_fmusim_me.bat
  5. 0 93
      examples/mass_spring_damper/fmusdk/fmu10/src/co_simulation/fmi_cs.h
  6. 0 135
      examples/mass_spring_damper/fmusdk/fmu10/src/co_simulation/main.c
  7. 0 104
      examples/mass_spring_damper/fmusdk/fmu10/src/model_exchange/fmi_me.h
  8. 0 244
      examples/mass_spring_damper/fmusdk/fmu10/src/model_exchange/main.c
  9. 0 72
      examples/mass_spring_damper/fmusdk/fmu10/src/models/Makefile
  10. 0 3
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/Makefile
  11. 0 116
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/bouncingBall.c
  12. 0 55
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/index.html
  13. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/model.png
  14. 0 38
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/modelDescription_cs.xml
  15. 0 31
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/modelDescription_me.xml
  16. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/plot_h.PNG
  17. 0 59
      examples/mass_spring_damper/fmusdk/fmu10/src/models/build_fmu
  18. 0 94
      examples/mass_spring_damper/fmusdk/fmu10/src/models/build_fmu.bat
  19. 0 3
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/Makefile
  20. 0 64
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/dq.c
  21. 0 33
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/index.html
  22. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/model.png
  23. 0 27
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/modelDescription_cs.xml
  24. 0 20
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/modelDescription_me.xml
  25. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/plot_x.PNG
  26. 0 800
      examples/mass_spring_damper/fmusdk/fmu10/src/models/fmuTemplate.c
  27. 0 59
      examples/mass_spring_damper/fmusdk/fmu10/src/models/fmuTemplate.h
  28. 0 3
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/Makefile
  29. 0 55
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/inc.c
  30. 0 22
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/index.html
  31. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/model.png
  32. 0 13
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/modelDescription.xml
  33. 0 21
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/modelDescription_cs.xml
  34. 0 14
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/modelDescription_me.xml
  35. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/plot_counter.PNG
  36. 0 3
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/Makefile
  37. 0 23
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/index.html
  38. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/model.png
  39. 0 42
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/modelDescription_cs.xml
  40. 0 35
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/modelDescription_me.xml
  41. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/values.PNG
  42. 0 84
      examples/mass_spring_damper/fmusdk/fmu10/src/models/values/values.c
  43. 0 3
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/Makefile
  44. 0 27
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/index.html
  45. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/model.png
  46. 0 33
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/modelDescription_cs.xml
  47. 0 26
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/modelDescription_me.xml
  48. BIN
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/plot_states.png
  49. 0 74
      examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/vanDerPol.c
  50. 0 288
      examples/mass_spring_damper/fmusdk/fmu20/src/model_exchange/main.c
  51. 0 60
      examples/mass_spring_damper/fmusdk/fmu20/src/models/bouncingBall/modelDescription_me.xml
  52. 0 46
      examples/mass_spring_damper/fmusdk/fmu20/src/models/dq/modelDescription_me.xml
  53. 0 35
      examples/mass_spring_damper/fmusdk/fmu20/src/models/inc/modelDescription_me.xml
  54. 0 71
      examples/mass_spring_damper/fmusdk/fmu20/src/models/values/modelDescription_me.xml
  55. 0 56
      examples/mass_spring_damper/fmusdk/fmu20/src/models/vanDerPol/modelDescription_me.xml

+ 0 - 57
examples/mass_spring_damper/fmusdk/fmu10/bin/License.txt

@@ -1,57 +0,0 @@
-  7-Zip
-  ~~~~~
-  License for use and distribution
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-  7-Zip Copyright (C) 1999-2007 Igor Pavlov.
-
-  Licenses for files are:
-
-    1) 7z.dll: GNU LGPL + unRAR restriction
-    2) All other files:  GNU LGPL
-
-  The GNU LGPL + unRAR restriction means that you must follow both 
-  GNU LGPL rules and unRAR restriction rules.
-
-
-  Note: 
-    You can use 7-Zip on any computer, including a computer in a commercial 
-    organization. You don't need to register or pay for 7-Zip.
-
-
-  GNU LGPL information
-  --------------------
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-  unRAR restriction
-  -----------------
-
-    The decompression engine for RAR archives was developed using source 
-    code of unRAR program.
-    All copyrights to original unRAR code are owned by Alexander Roshal.
-
-    The license for original unRAR code has the following restriction:
-
-      The unRAR sources cannot be used to re-create the RAR compression algorithm, 
-      which is proprietary. Distribution of modified unRAR sources in separate form 
-      or as a part of other software is permitted, provided that it is clearly
-      stated in the documentation and source comments that the code may
-      not be used to develop a RAR (WinRAR) compatible archiver.
-
-
-  --
-  Igor Pavlov

+ 0 - 27
examples/mass_spring_damper/fmusdk/fmu10/src/build_all.bat

@@ -1,27 +0,0 @@
-@echo off 
-
-rem ------------------------------------------------------------
-rem This batch builds both simulators and all FMUs of the FmuSDK
-rem Copyright QTronic GmbH. All rights reserved
-rem ------------------------------------------------------------
-
-rem First argument %1 should be empty for win32, and '-win64' for win64 build.
-call build_fmusim_me %1
-call build_fmusim_cs %1
-echo -----------------------------------------------------------
-echo Making the FMUs of the FmuSDK ...
-pushd models
-
-call build_fmu me dq  %1
-call build_fmu me inc %1
-call build_fmu me values %1
-call build_fmu me vanDerPol %1
-call build_fmu me bouncingBall %1
-
-call build_fmu cs dq %1
-call build_fmu cs inc %1
-call build_fmu cs values %1
-call build_fmu cs vanDerPol %1
-call build_fmu cs bouncingBall %1
-
-popd

+ 0 - 69
examples/mass_spring_damper/fmusdk/fmu10/src/build_fmusim_cs.bat

@@ -1,69 +0,0 @@
-@echo off 
-rem ------------------------------------------------------------
-rem This batch builds the FMU simulator fmusim_cs.exe
-rem Usage: build_fmusim_cs.bat (-win64)
-rem Copyright QTronic GmbH. All rights reserved
-rem ------------------------------------------------------------
-
-setlocal
-
-echo -----------------------------------------------------------
-echo building fmusim_cs.exe - FMI for Co-Simulation 1.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 FMI_PLATFORM=win64) else (set FMI_PLATFORM=win32)
-if not exist ..\bin\%FMI_PLATFORM% mkdir ..\bin\%FMI_PLATFORM%
-
-rem setup the compiler
-if %FMI_PLATFORM%==win64 (
-if defined VS140COMNTOOLS (call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS120COMNTOOLS (call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS110COMNTOOLS (call "%VS110COMNTOOLS%\..\..\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 VS120COMNTOOLS (call "%VS120COMNTOOLS%\vsvars32.bat") else ^
-if defined VS110COMNTOOLS (call "%VS110COMNTOOLS%\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=main.c ..\shared\xmlVersionParser.c ..\shared\parser\xml_parser.c ..\shared\parser\stack.c ..\shared\sim_support.c
-set INC=/I../shared/include /I../shared/parser /I../shared /I.
-set OPTIONS=/DSTANDALONE_XML_PARSER /nologo /DFMI_COSIMULATION /DLIBXML_STATIC
-
-rem create fmusim_cs.exe in the fmusim_cs dir
-pushd co_simulation
-cl %SRC% %INC% %OPTIONS% /Fefmusim_cs.exe /link libexpatMT.lib /LIBPATH:..\shared\parser\%FMI_PLATFORM%
-del *.obj
-popd
-if not exist co_simulation\fmusim_cs.exe goto compileError
-move /Y co_simulation\fmusim_cs.exe ..\bin\%FMI_PLATFORM%
-goto done
-
-:noCompiler
-echo No Microsoft Visual C compiler found
-
-:compileError
-echo build of fmusim_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

+ 0 - 69
examples/mass_spring_damper/fmusdk/fmu10/src/build_fmusim_me.bat

@@ -1,69 +0,0 @@
-@echo off 
-rem ------------------------------------------------------------
-rem This batch builds the FMU simulator fmusim_me.exe
-rem Usage: build_fmusim_me.bat (-win64)
-rem Copyright QTronic GmbH. All rights reserved
-rem ------------------------------------------------------------
-
-setlocal
-
-echo -----------------------------------------------------------
-echo building fmusim_me.exe - FMI for Model Exchange 1.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 FMI_PLATFORM=win64) else (set FMI_PLATFORM=win32)
-if not exist ..\bin\%FMI_PLATFORM% mkdir ..\bin\%FMI_PLATFORM%
-
-rem setup the compiler
-if %FMI_PLATFORM%==win64 (
-if defined VS140COMNTOOLS (call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS120COMNTOOLS (call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS110COMNTOOLS (call "%VS110COMNTOOLS%\..\..\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 VS120COMNTOOLS (call "%VS120COMNTOOLS%\vsvars32.bat") else ^
-if defined VS110COMNTOOLS (call "%VS110COMNTOOLS%\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=main.c ..\shared\xmlVersionParser.c ..\shared\parser\xml_parser.c ..\shared\parser\stack.c ..\shared\sim_support.c
-set INC=/I..\shared\include /I..\shared\parser /I..\shared /I.
-set OPTIONS=/nologo /DSTANDALONE_XML_PARSER /DLIBXML_STATIC
-
-rem create fmusim_me.exe in the fmusim_me dir
-pushd model_exchange
-cl %SRC% %INC% %OPTIONS% /Fefmusim_me.exe /link libexpatMT.lib /LIBPATH:..\shared\parser\%FMI_PLATFORM%
-del *.obj
-popd
-if not exist model_exchange\fmusim_me.exe goto compileError
-move /Y model_exchange\fmusim_me.exe ..\bin\%FMI_PLATFORM%
-goto done
-
-:noCompiler
-echo No Microsoft Visual C compiler found
-
-:compileError
-echo build of fmusim_me.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

+ 0 - 93
examples/mass_spring_damper/fmusdk/fmu10/src/co_simulation/fmi_cs.h

@@ -1,93 +0,0 @@
-/* -------------------------------------------------------------------------
- * fmi_cs.h
- * Function types for all function of the "FMI for Co-Simulation 1.0"
- * and a struct with the corresponding function pointers.
- * Copyright QTronic GmbH. All rights reserved.
- * -------------------------------------------------------------------------*/
-
-#ifndef FMI_CS_H
-#define FMI_CS_H
-
-#ifdef _MSC_VER
-#include <windows.h>
-#define WINDOWS 1
-#if (_MSC_VER >= 1900)
-#pragma comment(lib, "legacy_stdio_definitions.lib")
-#endif /* _MSC_VER >= 1900 */
-#else /* _MSC_VER */
-#include <errno.h>
-#define WINDOWS 0
-#define TRUE 1
-#define FALSE 0
-#define min(a,b) (a>b ? b : a)
-#define HANDLE void *
-/* See http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html */
-#include <dlfcn.h>
-#endif /* _MSC_VER */
-
-#include "fmiFunctions.h"
-#include "xml_parser.h"
-
-typedef const char* (*fGetTypesPlatform)();
-typedef const char* (*fGetVersion)();
-typedef fmiStatus (*fSetDebugLogging)    (fmiComponent c, fmiBoolean loggingOn);
-typedef fmiStatus (*fSetReal)   (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiReal    value[]);
-typedef fmiStatus (*fSetInteger)(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiInteger value[]);
-typedef fmiStatus (*fSetBoolean)(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiBoolean value[]);
-typedef fmiStatus (*fSetString) (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiString  value[]);
-typedef fmiStatus (*fGetReal)   (fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiReal    value[]);
-typedef fmiStatus (*fGetInteger)(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiInteger value[]);
-typedef fmiStatus (*fGetBoolean)(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiBoolean value[]);
-typedef fmiStatus (*fGetString) (fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiString  value[]);
-typedef fmiComponent (*fInstantiateSlave)  (fmiString  instanceName, fmiString  fmuGUID, fmiString  fmuLocation,
-        fmiString  mimeType, fmiReal timeout, fmiBoolean visible, fmiBoolean interactive, 
-        fmiCallbackFunctions functions, fmiBoolean loggingOn);
-typedef fmiStatus (*fInitializeSlave)(fmiComponent c, fmiReal tStart, fmiBoolean StopTimeDefined, fmiReal tStop);
-typedef fmiStatus (*fTerminateSlave)   (fmiComponent c);
-typedef fmiStatus (*fResetSlave)       (fmiComponent c);
-typedef void      (*fFreeSlaveInstance)(fmiComponent c);
-typedef fmiStatus (*fSetRealInputDerivatives)(fmiComponent c, const  fmiValueReference vr[], size_t nvr,
-        const fmiInteger order[], const  fmiReal value[]);
-typedef fmiStatus (*fGetRealOutputDerivatives)(fmiComponent c, const fmiValueReference vr[], size_t  nvr,
-        const fmiInteger order[], fmiReal value[]);
-typedef fmiStatus (*fCancelStep)(fmiComponent c);
-typedef fmiStatus (*fDoStep)(fmiComponent c, fmiReal currentCommunicationPoint, 
-        fmiReal communicationStepSize, fmiBoolean newStep);
-typedef fmiStatus (*fGetStatus)       (fmiComponent c, const fmiStatusKind s, fmiStatus*  value);
-typedef fmiStatus (*fGetRealStatus)   (fmiComponent c, const fmiStatusKind s, fmiReal*    value);
-typedef fmiStatus (*fGetIntegerStatus)(fmiComponent c, const fmiStatusKind s, fmiInteger* value);
-typedef fmiStatus (*fGetBooleanStatus)(fmiComponent c, const fmiStatusKind s, fmiBoolean* value);
-typedef fmiStatus (*fGetStringStatus) (fmiComponent c, const fmiStatusKind s, fmiString*  value);
-
-typedef struct {
-    ModelDescription* modelDescription;
-    HANDLE dllHandle;
-    fGetTypesPlatform getTypesPlatform;
-    fGetVersion getVersion;
-    fSetDebugLogging setDebugLogging;
-    fSetReal setReal;
-    fSetInteger setInteger;
-    fSetBoolean setBoolean;
-    fSetString setString;
-    fGetReal getReal;
-    fGetInteger getInteger;
-    fGetBoolean getBoolean;
-    fGetString getString;
-    fInstantiateSlave instantiateSlave;
-    fInitializeSlave initializeSlave;
-    fTerminateSlave terminateSlave;
-    fResetSlave resetSlave;
-    fFreeSlaveInstance freeSlaveInstance;
-    fGetRealOutputDerivatives getRealOutputDerivatives;
-    fSetRealInputDerivatives setRealInputDerivatives;
-    fDoStep doStep;
-    fCancelStep cancelStep;
-    fGetStatus getStatus;
-    fGetRealStatus getRealStatus;
-    fGetIntegerStatus getIntegerStatus;
-    fGetBooleanStatus getBooleanStatus;
-    fGetStringStatus getStringStatus;
-} FMU;
-
-#endif // FMI_CS_H
-

+ 0 - 135
examples/mass_spring_damper/fmusdk/fmu10/src/co_simulation/main.c

@@ -1,135 +0,0 @@
-/* -------------------------------------------------------------------------
- * main.c
- * Implements simulation of a single FMU instance
- * that implements the "FMI for Co-Simulation 1.0" interface.
- * Command syntax: see printHelp()
- * Simulates the given FMU from t = 0 .. tEnd with fixed step size h and
- * writes the computed solution to file 'result.csv'.
- * The CSV file (comma-separated values) may e.g. be plotted using 
- * OpenOffice Calc or Microsoft Excel. 
- * This progamm demonstrates basic use of an FMU.
- * Real applications may use advanced master algorithms to cosimulate 
- * many FMUs, limit the numerical error using error estimation
- * and back-stepping, provide graphical plotting utilities, debug support,
- * and user control of parameter and start values, or perform a clean
- * error handling (e.g. call freeSlaveInstance when a call to the fmu
- * returns with error). All this is missing here.
- *
- * Revision history
- *  22.08.2011 initial version released in FMU SDK 1.0.2
- *
- * Free libraries and tools used to implement this simulator:
- *  - header files from the FMU specification
- *  - eXpat 2.0.1 XML parser, see http://expat.sourceforge.net
- *  - 7z.exe 4.57 zip and unzip tool, see http://www.7-zip.org
- * Author: Jakob Mauss
- * Copyright QTronic GmbH. All rights reserved.
- * -------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "fmi_cs.h"
-#include "sim_support.h"
-
-FMU fmu; // the fmu to simulate
-
-// simulate the given FMU from tStart = 0 to tEnd.
-static int simulate(FMU* fmu, double tEnd, double h, fmiBoolean loggingOn, char separator) {
-    double time;
-    double tStart = 0;               // start time
-    const char* guid;                // global unique id of the fmu
-    fmiComponent c;                  // instance of the fmu 
-    fmiStatus fmiFlag;               // return code of the fmu functions
-    char* fmuLocation = getTempFmuLocation(); // path to the fmu as URL, "file://C:\QTronic\sales"
-    const char* mimeType = "application/x-fmu-sharedlibrary"; // denotes tool in case of tool coupling
-    fmiReal timeout = 1000;          // wait period in milli seconds, 0 for unlimited wait period"
-    fmiBoolean visible = fmiFalse;   // no simulator user interface
-    fmiBoolean interactive = fmiFalse; // simulation run without user interaction
-    fmiCallbackFunctions callbacks;  // called by the model during simulation
-    ModelDescription* md;            // handle to the parsed XML file
-    int nSteps = 0;
-    double hh = h;
-    FILE* file;
-
-    // instantiate the fmu
-    md = fmu->modelDescription;
-    guid = getString(md, att_guid);
-    callbacks.logger = fmuLogger;
-    callbacks.allocateMemory = calloc;
-    callbacks.freeMemory = free;
-    callbacks.stepFinished = NULL; // fmiDoStep has to be carried out synchronously
-    c = fmu->instantiateSlave(getModelIdentifier(md), guid, fmuLocation, mimeType,
-                              timeout, visible, interactive, callbacks, loggingOn);
-    free(fmuLocation);
-    if (!c) return error("could not instantiate model");
-
-    // open result file
-    if (!(file=fopen(RESULT_FILE, "w"))) {
-        printf("could not write %s because:\n", RESULT_FILE);
-        printf("    %s\n", strerror(errno));
-        return 0; // failure
-    }
-
-    // StopTimeDefined=fmiFalse means: ignore value of tEnd
-    fmiFlag = fmu->initializeSlave(c, tStart, fmiTrue, tEnd);
-    if (fmiFlag > fmiWarning)  return error("could not initialize model");
-    
-    // output solution for time t0
-    outputRow(fmu, c, tStart, file, separator, fmiTrue);  // output column names
-    outputRow(fmu, c, tStart, file, separator, fmiFalse); // output values
-
-    // enter the simulation loop
-    time = tStart;
-    while (time < tEnd) {
-        // check not to pass over end time
-        if (h > tEnd - time) {
-            hh = tEnd - time;
-        }
-        fmiFlag = fmu->doStep(c, time, hh, fmiTrue);
-        if (fmiFlag != fmiOK)  return error("could not complete simulation of the model");
-        time += hh;
-        outputRow(fmu, c, time, file, separator, fmiFalse); // output values for this step
-        nSteps++;
-    }
-
-    // end simulation
-    fmiFlag = fmu->terminateSlave(c);
-    fmu->freeSlaveInstance(c);
-    fclose(file);
-
-    // print simulation summary 
-    printf("Simulation from %g to %g terminated successful\n", tStart, tEnd);
-    printf("  steps ............ %d\n", nSteps);
-    printf("  fixed step size .. %g\n", h);
-    return 1; // success
-}
-
-int main(int argc, char *argv[]) {
-    const char* fmuFileName;
-
-    // parse command line arguments and load the FMU
-    double tEnd = 1.0;
-    double h=0.1;
-    int loggingOn = 0;
-    char csv_separator = ',';
-    parseArguments(argc, argv, &fmuFileName, &tEnd, &h, &loggingOn, &csv_separator);
-    loadFMU(fmuFileName);
-
-    // run the simulation
-    printf("FMU Simulator: run '%s' from t=0..%g with step size h=%g, loggingOn=%d, csv separator='%c'\n",
-            fmuFileName, tEnd, h, loggingOn, csv_separator);
-    simulate(&fmu, tEnd, h, loggingOn, csv_separator);
-    printf("CSV file '%s' written\n", RESULT_FILE);
-
-    // release FMU 
-#if WINDOWS
-    FreeLibrary(fmu.dllHandle);
-#else /* WINDOWS */
-    dlclose(fmu.dllHandle);
-#endif /* WINDOWS */
-    freeElement(fmu.modelDescription);
-    deleteUnzippedFiles();
-    return EXIT_SUCCESS;
-}
-

+ 0 - 104
examples/mass_spring_damper/fmusdk/fmu10/src/model_exchange/fmi_me.h

@@ -1,104 +0,0 @@
-/* -------------------------------------------------------------------------
- * fmi_me.h
- * Function types for all function of the "FMI for Model Exchange 1.0"
- * and a struct with the corresponding function pointers.
- * Copyright QTronic GmbH. All rights reserved.
- * -------------------------------------------------------------------------*/
-
-#ifndef FMI_ME_H
-#define FMI_ME_H
-
-#ifdef _MSC_VER
-#include <windows.h>
-#define WINDOWS 1
-#if (_MSC_VER >= 1900)
-#pragma comment(lib, "legacy_stdio_definitions.lib")
-#endif /* _MSC_VER >= 1900 */
-#else /* _MSC_VER */
-#include <errno.h>
-#define WINDOWS 0
-#define TRUE 1
-#define FALSE 0
-#define min(a,b) (a>b ? b : a)
-#define HANDLE void *
-/* See http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html */
-#include <dlfcn.h>
-#endif /* _MSC_VER */
-
-#include "fmiModelFunctions.h"
-#include "xml_parser.h"
-
-typedef const char* (*fGetModelTypesPlatform)();
-typedef const char* (*fGetVersion)();
-typedef fmiComponent (*fInstantiateModel)(fmiString instanceName, fmiString GUID,
-                                        fmiCallbackFunctions functions, fmiBoolean loggingOn);
-typedef void      (*fFreeModelInstance)  (fmiComponent c);
-typedef fmiStatus (*fSetDebugLogging)    (fmiComponent c, fmiBoolean loggingOn);
-typedef fmiStatus (*fSetTime)            (fmiComponent c, fmiReal time);
-typedef fmiStatus (*fSetContinuousStates)(fmiComponent c, const fmiReal x[], size_t nx);
-typedef fmiStatus (*fCompletedIntegratorStep)(fmiComponent c, fmiBoolean* callEventUpdate);
-typedef fmiStatus (*fSetReal)   (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiReal    value[]);
-typedef fmiStatus (*fSetInteger)(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiInteger value[]);
-typedef fmiStatus (*fSetBoolean)(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiBoolean value[]);
-typedef fmiStatus (*fSetString) (fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiString  value[]);
-typedef fmiStatus (*fInitialize)(fmiComponent c, fmiBoolean toleranceControlled, 
-                               fmiReal relativeTolerance, fmiEventInfo* eventInfo);
-typedef fmiStatus (*fGetDerivatives)    (fmiComponent c, fmiReal derivatives[]    , size_t nx);
-typedef fmiStatus (*fGetEventIndicators)(fmiComponent c, fmiReal eventIndicators[], size_t ni);
-typedef fmiStatus (*fGetReal)   (fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiReal    value[]);
-typedef fmiStatus (*fGetInteger)(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiInteger value[]);
-typedef fmiStatus (*fGetBoolean)(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiBoolean value[]);
-typedef fmiStatus (*fGetString) (fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiString  value[]);
-typedef fmiStatus (*fEventUpdate)               (fmiComponent c, fmiBoolean intermediateResults, fmiEventInfo* eventInfo);
-typedef fmiStatus (*fGetContinuousStates)       (fmiComponent c, fmiReal states[], size_t nx);
-typedef fmiStatus (*fGetNominalContinuousStates)(fmiComponent c, fmiReal x_nominal[], size_t nx);
-typedef fmiStatus (*fGetStateValueReferences)   (fmiComponent c, fmiValueReference vrx[], size_t nx);
-typedef fmiStatus (*fTerminate)                 (fmiComponent c);    
-
-typedef struct {
-    ModelDescription* modelDescription;
-    HANDLE dllHandle;
-    fGetModelTypesPlatform getModelTypesPlatform;
-    fGetVersion getVersion;
-    fInstantiateModel instantiateModel;
-    fFreeModelInstance freeModelInstance;
-    fSetDebugLogging setDebugLogging;
-    fSetTime setTime;
-    fSetContinuousStates setContinuousStates;
-    fCompletedIntegratorStep completedIntegratorStep;
-    fSetReal setReal;
-    fSetInteger setInteger;
-    fSetBoolean setBoolean;
-    fSetString setString;
-    fInitialize initialize;
-    fGetDerivatives getDerivatives;
-    fGetEventIndicators getEventIndicators;
-    fGetReal getReal;
-    fGetInteger getInteger;
-    fGetBoolean getBoolean;
-    fGetString getString;
-    fEventUpdate eventUpdate;
-    fGetContinuousStates getContinuousStates;
-    fGetNominalContinuousStates getNominalContinuousStates;
-    fGetStateValueReferences getStateValueReferences;
-    fTerminate terminate; 
-/*
-    fInstantiateSlave instantiateSlave;
-    fInitializeSlave initializeSlave;
-    fTerminateSlave terminateSlave;
-    fResetSlave resetSlave;
-    fFreeSlaveInstance freeSlaveInstance;
-    fGetRealOutputDerivatives getRealOutputDerivatives;
-    fSetRealInputDerivatives setRealInputDerivatives;
-    fDoStep doStep;
-    fCancelStep cancelStep;
-    fGetStatus getStatus;
-    fGetRealStatus getRealStatus;
-    fGetIntegerStatus getIntegerStatus;
-    fGetBooleanStatus getBooleanStatus;
-    fGetStringStatus getStringStatus;
-*/
-} FMU;
-
-#endif // FMI_ME_H
-

+ 0 - 244
examples/mass_spring_damper/fmusdk/fmu10/src/model_exchange/main.c

@@ -1,244 +0,0 @@
-/* ------------------------------------------------------------------------- 
- * main.c
- * Implements simulation of a single FMU instance using the forward Euler
- * method for numerical integration.
- * Command syntax: see printHelp()
- * Simulates the given FMU from t = 0 .. tEnd with fixed step size h and
- * writes the computed solution to file 'result.csv'.
- * The CSV file (comma-separated values) may e.g. be plotted using
- * OpenOffice Calc or Microsoft Excel.
- * This program demonstrates basic use of an FMU.
- * Real applications may use advanced numerical solvers instead, means to 
- * exactly locate state events in time, graphical plotting utilities, support
- * for co-execution of many FMUs, stepping and debug support, user control
- * of parameter and start values etc. 
- * All this is missing here.
- *
- * Revision history
- *  07.02.2010 initial version released in FMU SDK 1.0
- *  05.03.2010 bug fix: removed strerror(GetLastError()) from error messages
- *  11.06.2010 bug fix: replaced win32 API call to OpenFile in getFmuPath
- *    which restricted path length to FMU to 128 chars. New limit is MAX_PATH.
- *  15.07.2010 fixed wrong label in xml parser: deault instead of default
- *  13.12.2010 added check for undefined 'declared type' to xml parser
- *  31.07.2011 bug fix: added missing freeModelInstance(c)
- *  31.07.2011 bug fix: added missing terminate(c)
- *  30.08.2012 fixed access violation in xmlParser after reporting unknown attribute name
- *
- * Free libraries and tools used to implement this simulator:
- *  - header files from the FMU specification
- *  - eXpat 2.0.1 XML parser, see http://expat.sourceforge.net
- *  - 7z.exe 4.57 zip and unzip tool, see http://www.7-zip.org
- * Author: Jakob Mauss
- * Copyright QTronic GmbH. All rights reserved.
- * -------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h> //strerror()
-#include "fmi_me.h"
-#include "sim_support.h"
-
-FMU fmu; // the fmu to simulate
-
-// simulate the given FMU using the forward euler method.
-// time events are processed by reducing step size to exactly hit tNext.
-// state events are checked and fired only at the end of an Euler step. 
-// the simulator may therefore miss state events and fires state events typically too late.
-static int simulate(FMU* fmu, double tEnd, double h, fmiBoolean loggingOn, char separator) {
-    int i, n;
-    double dt, tPre;
-    fmiBoolean timeEvent, stateEvent, stepEvent;
-    double time;  
-    int nx;                          // number of state variables
-    int nz;                          // number of state event indicators
-    double *x;                       // continuous states
-    double *xdot;                    // the crresponding derivatives in same order
-    double *z = NULL;                // state event indicators
-    double *prez = NULL;             // previous values of state event indicators
-    fmiEventInfo eventInfo;          // updated by calls to initialize and eventUpdate
-    ModelDescription* md;            // handle to the parsed XML file
-    const char* guid;                // global unique id of the fmu
-    fmiCallbackFunctions callbacks;  // called by the model during simulation
-    fmiComponent c;                  // instance of the fmu 
-    fmiStatus fmiFlag;               // return code of the fmu functions
-    fmiReal t0 = 0;                  // start time
-    fmiBoolean toleranceControlled = fmiFalse;
-    int nSteps = 0;
-    int nTimeEvents = 0;
-    int nStepEvents = 0;
-    int nStateEvents = 0;
-    FILE* file;
-
-    // instantiate the fmu
-    md = fmu->modelDescription;
-    guid = getString(md, att_guid);
-    callbacks.logger = fmuLogger;
-    callbacks.allocateMemory = calloc;
-    callbacks.freeMemory = free;
-    c = fmu->instantiateModel(getModelIdentifier(md), guid, callbacks, loggingOn);
-    if (!c) return error("could not instantiate model");
-
-    // allocate memory 
-    nx = getNumberOfStates(md);
-    nz = getNumberOfEventIndicators(md);
-    x    = (double *) calloc(nx, sizeof(double));
-    xdot = (double *) calloc(nx, sizeof(double));
-    if (nz>0) {
-        z    =  (double *) calloc(nz, sizeof(double));
-        prez =  (double *) calloc(nz, sizeof(double));
-    }
-    if ((!x || !xdot) || (nz>0 && (!z || !prez))) return error("out of memory");
-
-    // open result file
-    if (!(file=fopen(RESULT_FILE, "w"))) {
-        printf("could not write %s because:\n", RESULT_FILE);
-        printf("    %s\n", strerror(errno));
-        free(x);
-        free(xdot);
-        free(z);
-        free(prez);
-
-        return 0; // failure
-    }
-
-    // set the start time and initialize
-    time = t0;
-    fmiFlag =  fmu->setTime(c, t0);
-    if (fmiFlag > fmiWarning) return error("could not set time");
-    fmiFlag =  fmu->initialize(c, toleranceControlled, t0, &eventInfo);
-    if (fmiFlag > fmiWarning)  return error("could not initialize model");
-    if (eventInfo.terminateSimulation) {
-        printf("model requested termination at init");
-        tEnd = time;
-    }
-
-    // output solution for time t0
-    outputRow(fmu, c, t0, file, separator, fmiTrue);  // output column names
-    outputRow(fmu, c, t0, file, separator, fmiFalse); // output values
-
-    // enter the simulation loop
-    while (time < tEnd) {
-     // get current state and derivatives
-     fmiFlag = fmu->getContinuousStates(c, x, nx);
-     if (fmiFlag > fmiWarning) return error("could not retrieve states");
-     fmiFlag = fmu->getDerivatives(c, xdot, nx);
-     if (fmiFlag > fmiWarning) return error("could not retrieve derivatives");
-
-     // advance time
-     tPre = time;
-     time = min(time+h, tEnd);
-     timeEvent = eventInfo.upcomingTimeEvent && eventInfo.nextEventTime < time;
-     if (timeEvent) time = eventInfo.nextEventTime;
-     dt = time - tPre; 
-     fmiFlag = fmu->setTime(c, time);
-     if (fmiFlag > fmiWarning) error("could not set time");
-
-     // perform one step
-     for (i=0; i<nx; i++) x[i] += dt*xdot[i]; // forward Euler method
-     fmiFlag = fmu->setContinuousStates(c, x, nx);
-     if (fmiFlag > fmiWarning) return error("could not set states");
-     if (loggingOn) printf("Step %d to t=%.16g\n", nSteps, time);
-
-     // Check for step event, e.g. dynamic state selection
-     fmiFlag = fmu->completedIntegratorStep(c, &stepEvent);
-     if (fmiFlag > fmiWarning) return error("could not complete integrator step");
-
-     // Check for state event
-     for (i=0; i<nz; i++) prez[i] = z[i]; 
-     fmiFlag = fmu->getEventIndicators(c, z, nz);
-     if (fmiFlag > fmiWarning) return error("could not retrieve event indicators");
-     stateEvent = FALSE;
-     for (i=0; i<nz; i++) 
-         stateEvent = stateEvent || (prez[i] * z[i] < 0);
-
-     // handle events
-     if (timeEvent || stateEvent || stepEvent) {
-
-        if (timeEvent) {
-            nTimeEvents++;
-            if (loggingOn) printf("time event at t=%.16g\n", time);
-        }
-        if (stateEvent) {
-            nStateEvents++;
-            if (loggingOn) for (i=0; i<nz; i++)
-                printf("state event %s z[%d] at t=%.16g\n", 
-                        (prez[i]>0 && z[i]<0) ? "-\\-" : "-/-", i, time);
-        }
-        if (stepEvent) {
-            nStepEvents++;
-            if (loggingOn) printf("step event at t=%.16g\n", time);
-        }
-
-        // event iteration in one step, ignoring intermediate results
-        fmiFlag = fmu->eventUpdate(c, fmiFalse, &eventInfo);
-        if (fmiFlag > fmiWarning) return error("could not perform event update");
-        
-        // terminate simulation, if requested by the model
-        if (eventInfo.terminateSimulation) {
-            printf("model requested termination at t=%.16g\n", time);
-            break; // success
-        }
-
-        // check for change of value of states
-        if (eventInfo.stateValuesChanged && loggingOn) {
-            printf("state values changed at t=%.16g\n", time);
-        }
-        
-        // check for selection of new state variables
-        if (eventInfo.stateValueReferencesChanged && loggingOn) {
-            printf("new state variables selected at t=%.16g\n", time);
-        }
-
-     } // if event
-     outputRow(fmu, c, time, file, separator, fmiFalse); // output values for this step
-     nSteps++;
-  } // while
-
-  // cleanup
-  if(! eventInfo.terminateSimulation) fmu->terminate(c);
-  fmu->freeModelInstance(c);
-  fclose(file);
-  if (x!=NULL) free(x);
-  if (xdot!= NULL) free(xdot);
-  if (z!= NULL) free(z);
-  if (prez!= NULL) free(prez);
-
-  // print simulation summary 
-  printf("Simulation from %g to %g terminated successful\n", t0, tEnd);
-  printf("  steps ............ %d\n", nSteps);
-  printf("  fixed step size .. %g\n", h);
-  printf("  time events ...... %d\n", nTimeEvents);
-  printf("  state events ..... %d\n", nStateEvents);
-  printf("  step events ...... %d\n", nStepEvents);
-
-  return 1; // success
-}
-
-int main(int argc, char *argv[]) {
-    const char* fmuFileName;
-
-    // parse command line arguments and load the FMU
-    double tEnd = 1.0;
-    double h=0.1;
-    int loggingOn = 0;
-    char csv_separator = ',';
-    parseArguments(argc, argv, &fmuFileName, &tEnd, &h, &loggingOn, &csv_separator);
-    loadFMU(fmuFileName);
-
-    // run the simulation
-    printf("FMU Simulator: run '%s' from t=0..%g with step size h=%g, loggingOn=%d, csv separator='%c'\n",
-            fmuFileName, tEnd, h, loggingOn, csv_separator);
-    simulate(&fmu, tEnd, h, loggingOn, csv_separator);
-    printf("CSV file '%s' written\n", RESULT_FILE);
-
-    // release FMU 
-#if WINDOWS
-    FreeLibrary(fmu.dllHandle);
-#else /* WINDOWS */
-    dlclose(fmu.dllHandle);
-#endif /* WINDOWS */
-    freeElement(fmu.modelDescription);
-    deleteUnzippedFiles();
-    return EXIT_SUCCESS;
-}

+ 0 - 72
examples/mass_spring_damper/fmusdk/fmu10/src/models/Makefile

@@ -1,72 +0,0 @@
-# Build the .fmu files for both co-simulation and model-exchange.
-#
-# The build_fmu script calls make with the appropriate makefile variables set.
-
-# The architecture: linux32, linux64, darwin32, darwin64
-ARCH = darwin64
-
-# Either cs for co-simuluation or me for model exchange.
-CSORME = cs
-CSORME_INCLUDE = -DFMI_COSIMULATION -I../../co_simulation/include
-#CSORME = me
-#CSORME_INCLUDE = -I../../model_exchange/include
-
-# The suffix for shared libraries.
-# dylib for Mac OS X, so for Linux
-SHARED_LIBRARY_SUFFIX = dylib
-#SHARED_LIBRARY_SUFFIX = so
-
-# Empty for Mac OS X, -fPIC for Linux
-PIC =
-#PIC = -fPIC
-
-# Build the .fmu files for both co-simulation and model-exchange
-all:
-	chmod 777 build_fmu
-	./build_fmu me bouncingBall
-	./build_fmu me dq
-	./build_fmu me inc
-	./build_fmu me values
-	./build_fmu me vanDerPol
-	./build_fmu cs bouncingBall
-	./build_fmu cs dq
-	./build_fmu cs inc
-	./build_fmu cs values
-	./build_fmu cs vanDerPol
-
-# CBITSFLAGS is set to -m32 to build linux32 fmus
-
-%.o: %.c
-	echo `pwd`
-	$(CC) -g -c $(CBITSFLAGS) $(PIC) -Wall $(CSORME_INCLUDE) $(CFLAGS) $< -o $@
-
-%.so: %.o
-	$(CC) $(CBITSFLAGS) -shared -Wl,-soname,$@ -o $@ $<
-
-%.dylib: %.o
-	$(CC) -dynamiclib -o $@ $<
-
-%.fmu: %.$(SHARED_LIBRARY_SUFFIX)
-	rm -rf fmu
-	mkdir -p fmu/binaries/$(ARCH) fmu/sources fmu/documentation
-	cp $< fmu/binaries/$(ARCH)
-	-cp *.c fmu/sources
-	rsync -av --ignore-missing-args ./*.h ./fmu/sources
-	-cp *.html *.png fmu/documentation
-	cp modelDescription_$(CSORME).xml fmu/modelDescription.xml
-	cp model.png fmu
-	@if [ ! -d ../../../fmu/$(CSORME) ]; then \
-		echo "mkdir -p ../../../fmu/$(CSORME)"; \
-		mkdir -p ../../../fmu/$(CSORME); \
-	fi
-	(cd fmu; zip -q -r ../../../../fmu/$(CSORME)/$@ *)
-
-clean:
-	(cd bouncingBall; make dirclean)
-	(cd dq; make dirclean)
-	(cd inc; make dirclean)
-	(cd values; make dirclean)
-	(cd vanDerPol; make dirclean)
-
-dirclean:
-	rm -rf *.so *.dylib *.o *.fmu *~ fmu

+ 0 - 3
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/Makefile

@@ -1,3 +0,0 @@
-CFLAGS = -I..
-
-include ../Makefile

+ 0 - 116
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/bouncingBall.c

@@ -1,116 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Sample implementation of an FMU - a bouncing ball. 
- * This demonstrates the use of state events and reinit of states.
- * Equations:
- *  der(h) = v;
- *  der(v) = -g;
- *  when h<0 then v := -e * v;  
- *  where
- *    h      height [m], used as state, start = 1
- *    v      velocity of ball [m/s], used as state
- *    der(h) velocity of ball [m/s] 
- *    der(v) acceleration of ball [m/s2] 
- *    g      acceleration of gravity [m/s2], a parameter, start = 9.81
- *    e      a dimensionless parameter, start = 0.7
- *
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-// define class name and unique id
-#define MODEL_IDENTIFIER bouncingBall
-#define MODEL_GUID "{8c4e810f-3df3-4a00-8276-176fa3c9f003}"
-
-// define model size
-#define NUMBER_OF_REALS 6
-#define NUMBER_OF_INTEGERS 0
-#define NUMBER_OF_BOOLEANS 0
-#define NUMBER_OF_STRINGS 0
-#define NUMBER_OF_STATES 2
-#define NUMBER_OF_EVENT_INDICATORS 1
-
-// include fmu header files, typedefs and macros
-#include "fmuTemplate.h"
-
-// define all model variables and their value references
-// conventions used here:
-// - if x is a variable, then macro x_ is its variable reference
-// - the vr of a variable is its index in array  r, i, b or s
-// - if k is the vr of a real state, then k+1 is the vr of its derivative
-#define h_      0
-#define der_h_  1
-#define v_      2
-#define der_v_  3
-#define g_      4
-#define e_      5
-
-// define initial state vector as vector of value references
-#define STATES { h_, v_ }
-
-// called by fmiInstantiateModel
-// Set values for all variables that define a start value
-// Settings used unless changed by fmiSetX before fmiInitialize
-void setStartValues(ModelInstance *comp) {
-    r(h_)     =  1;
-    r(v_)     =  0;
-    r(der_v_) = -9.81;
-    r(g_)     =  9.81;
-    r(e_)     =  0.7;
-    pos(0) = r(h_) > 0;
-}
-
-// called by fmiGetReal, fmiGetContinuousStates and fmiGetDerivatives
-fmiReal getReal(ModelInstance* comp, fmiValueReference vr){
-    switch (vr) {
-        case h_     : return r(h_);
-        case der_h_ : return r(v_);
-        case v_     : return r(v_);
-        case der_v_ : return r(der_v_);
-        case g_     : return r(g_);
-        case e_     : return r(e_);
-        default: return 0;
-    }
-}
-
-// called by fmiInitialize() after setting eventInfo to defaults
-// Used to set the first time event, if any.
-void initialize(ModelInstance* comp, fmiEventInfo* eventInfo) {
-    r(der_v_) = -r(g_);
-}
-
-// offset for event indicator, adds hysteresis and prevents z=0 at restart
-#define EPS_INDICATORS 1e-14
-
-fmiReal getEventIndicator(ModelInstance* comp, int z) {
-    switch (z) {
-        case 0 : return r(h_) + (pos(0) ? EPS_INDICATORS : -EPS_INDICATORS);
-        default: return 0;
-    }
-}
-
-// Used to set the next time event, if any.
-void eventUpdate(ModelInstance* comp, fmiEventInfo* eventInfo) {
-
-	eventInfo->iterationConverged = fmiTrue;
-	eventInfo->stateValueReferencesChanged = fmiFalse;
-	eventInfo->stateValuesChanged = fmiFalse;
-	eventInfo->terminateSimulation = fmiFalse;
-	eventInfo->upcomingTimeEvent = fmiFalse;
-
-	pos(0) = r(h_) > 0;
-	
-	if (!pos(0)) {
-
-		r(h_) = 0;
-		r(v_) = - r(e_) * r(v_);
-
-		// avoid fall-through effect. The ball will not jump high enough, so v and der_v is set to 0 at this surface impact.
-		if (r(v_) < 1e-3) {
-			r(der_v_) = 0;  // turn off gravity.
-		}
-
-		eventInfo->stateValuesChanged = fmiTrue;
-	}
- }
-
-// include code that implements the FMI based on the above definitions
-#include "fmuTemplate.c"

+ 0 - 55
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/index.html

@@ -1,55 +0,0 @@
-<html>
-<head>
-    <title>Documentation for bouncingBall.fmu</title>
-<style type="text/css">
-  html { font-family: Verdana, Arial, Helvetica, sans-serif; }
-  h1   { color: #000066; }
-</style>
-</head>
-<body>
-<h1>bouncingBall.fmu</h1>
-The bouncingBall implements the following equation: 
-<ul>
-<li> der(h) = v;
-<li> der(v) = -g;
-<li> when h<0 then v := -e* v
-</ul>
-with start values h=1, e=0.7, g = 9.81 and
-<ul>
-<li> h: height [m], used as state
-<li> v: velocity of ball [m/s], used as state
-<li> der(h): velocity of ball [m/s]
-<li> der(v): acceleration of ball [m/s2]
-<li> g: acceleration of gravity [m/s2], a parameter
-<li> e: a dimensionless parameter
-</ul>
-
-<br>
-<img src="plot_h.png">
-<br>
-The figure shows the solution computed with Silver 
-for height h of the ball for the start values given above.
-
-<p>
-The chain of events during simulation is as follows
-<ol>
-<li> initially h>0 and pos(0)=true </li>
-<li> continuous integration until a state event is detected, i.e.
-     until h + EPS_INDICATORS = 0.
-     At this time h < 0, the EPS_INDICATORS adds hysteresis.</li>
-<li> the simulator calls eventUpdate once which reverses the speed direction
-     v of the ball: v = -e * v, and sets pos(0)=false</li>
-<li> continuous integration until state event is detected, i.e.
-     until h - EPS_INDICATORS = 0.
-     At this time h > 0, the EPS_INDICATORS adds hysteresis.</li>
-<li> the simulator calls  eventUpdate once more which sets pos(0)=true.</li>
-<li> goto 2</li>
-</ol>
-The above description refers to the variables used 
-in file <code>bouncingBall.c</code>.
-
-<h2><a name="license">License conditions</a></h2>
-The FMU is provided by QTronic under the
-<a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a>.
-</body>
-</html>

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/model.png


+ 0 - 38
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/modelDescription_cs.xml

@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="bouncingBall"
-  modelIdentifier="bouncingBall"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f003}"
-  numberOfContinuousStates="2"
-  numberOfEventIndicators="1">
-<ModelVariables>
-  <ScalarVariable name="h" valueReference="0" description="height, used as state">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(h)" valueReference="1" description="velocity of ball">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="v" valueReference="2" description="velocity of ball, used as state">
-     <Real/>
-  </ScalarVariable>
-  <ScalarVariable name="der(v)" valueReference="3" description="acceleration of ball">
-     <Real/>
-  </ScalarVariable>
-  <ScalarVariable name="g" valueReference="4" description="acceleration of gravity"
-                  variability="parameter">
-     <Real start="9.81" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="e" valueReference="5" description="dimensionless parameter"
-                  variability="parameter">
-     <Real start="0.7" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-<Implementation>
-  <CoSimulation_StandAlone>
-    <Capabilities
-      canHandleVariableCommunicationStepSize="true"
-      canHandleEvents="true"/>
-  </CoSimulation_StandAlone>
-</Implementation>
-</fmiModelDescription>

+ 0 - 31
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/modelDescription_me.xml

@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="bouncingBall"
-  modelIdentifier="bouncingBall"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f003}"
-  numberOfContinuousStates="2"
-  numberOfEventIndicators="1">
-<ModelVariables>
-  <ScalarVariable name="h" valueReference="0" description="height, used as state">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(h)" valueReference="1" description="velocity of ball">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="v" valueReference="2" description="velocity of ball, used as state">
-     <Real/>
-  </ScalarVariable>
-  <ScalarVariable name="der(v)" valueReference="3" description="acceleration of ball">
-     <Real/>
-  </ScalarVariable>
-  <ScalarVariable name="g" valueReference="4" description="acceleration of gravity"
-                  variability="parameter">
-     <Real start="9.81" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="e" valueReference="5" description="dimensionless parameter"
-                  variability="parameter">
-     <Real start="0.7" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-</fmiModelDescription>

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/bouncingBall/plot_h.PNG


+ 0 - 59
examples/mass_spring_damper/fmusdk/fmu10/src/models/build_fmu

@@ -1,59 +0,0 @@
-#!/bin/sh
-# Build a model exchange or co-simulation fmu
-# Usage: build_fmu cs|me directory
-
-if [ $# -ne 2 ]; then
-   echo "Usage: $0 cs|me directory"
-   exit 2
-fi
-
-csOrMe=$1
-directory=$2
-
-# Error checking
-if [ "$csOrMe" != "me" -a "$csOrMe" != "cs" ]; then
-   echo "$0: first argument must be either 'me' or 'cs', not $csOrMe"
-   exit 3
-fi
-
-if [ ! -d $directory ]; then
-   echo "$0: directory $directory does not exist"
-   exit 4
-fi
-
-if [ "$csOrMe" = "cs" ]; then
-   csOrMeInclude="-DFMI_COSIMULATION -I../../co_simulation/include"
-else
-   csOrMeInclude=-I../../model_exchange/include
-fi
-
-case "`uname -s`" in
-     CYGWIN*) arch=win
-     	      sharedLibrarySuffix=dll;;
-     Darwin)  arch=darwin
-     	      sharedLibrarySuffix=dylib;;
-     Linux)   arch=linux
-     	      pic=-fPIC
-     	      sharedLibrarySuffix=so;;
-esac     
-
-# Number of bits, default to 64
-bits=64
-case "`uname -m`" in
-     *64)      bits=64;;
-     *32)      bits=32;;
-     *i[3-6]86) bits=32;;
-esac
-
-# Uncomment the next line to force building 32-bit
-#bits=32
-# See also ../Makefile
-
-if [ $arch = linux -a $bits = 32 ]; then
-    CBITSFLAGS=-m32
-fi
-
-set -x
-(cd $directory; \
-    make dirclean; \
-    make ARCH=${arch}${bits} CBITSFLAGS=${CBITSFLAGS} CSORME=${csOrMe} CSORME_INCLUDE="${csOrMeInclude}" PIC=${pic} SHARED_LIBRARY_SUFFIX=${sharedLibrarySuffix} $directory.fmu)

+ 0 - 94
examples/mass_spring_damper/fmusdk/fmu10/src/models/build_fmu.bat

@@ -1,94 +0,0 @@
-@echo off 
-rem ------------------------------------------------------------
-rem This batch builds an FMU of the FMU SDK
-rem Usage: build_fmu (me|cs) <fmu_dir_name> 
-rem Copyright QTronic GmbH. All rights reserved
-rem ------------------------------------------------------------
-
-setlocal
-
-echo -----------------------------------------------------------
-if %1==cs (^
-echo building FMU %2 - FMI for Co-Simulation 1.0) else ^
-echo building FMU %2 - FMI for Model Exchange 1.0
-
-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 "%3"=="-win64" (set FMI_PLATFORM=win64) else (set FMI_PLATFORM=win32)
-
-rem setup the compiler
-if %FMI_PLATFORM%==win64 (
-if defined VS140COMNTOOLS (call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS120COMNTOOLS (call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64) else ^
-if defined VS110COMNTOOLS (call "%VS110COMNTOOLS%\..\..\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 VS120COMNTOOLS (call "%VS120COMNTOOLS%\vsvars32.bat") else ^
-if defined VS110COMNTOOLS (call "%VS110COMNTOOLS%\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
-)
-
-rem create the %2.dll in the temp dir
-if not exist temp mkdir temp 
-pushd temp
-if exist *.dll del /Q *.dll
-
-if %1==cs (set DEF=/DFMI_COSIMULATION) else set DEF=
-cl /LD /nologo %DEF% ..\%2\%2.c /I ..\. /I ..\..\shared\include
-if not exist %2.dll goto compileError
-
-rem create FMU dir structure with root 'fmu'
-set BIN_DIR=fmu\binaries\%FMI_PLATFORM%
-set SRC_DIR=fmu\sources
-set DOC_DIR=fmu\documentation
-if not exist %BIN_DIR% mkdir %BIN_DIR%
-if not exist %SRC_DIR% mkdir %SRC_DIR%
-if not exist %DOC_DIR% mkdir %DOC_DIR%
-move /Y %2.dll %BIN_DIR%
-if exist ..\%2\*~ del /Q ..\%2\*~
-copy ..\%2\%2.c %SRC_DIR%
-copy ..\%2\modelDescription_%1.xml fmu\modelDescription.xml
-copy ..\%2\model.png fmu
-copy ..\fmuTemplate.c %SRC_DIR%
-copy ..\fmuTemplate.h %SRC_DIR%
-copy ..\%2\*.html %DOC_DIR%
-copy ..\%2\*.png  %DOC_DIR%
-del %DOC_DIR%\model.png
-
-rem zip the directory tree and move to fmu directory 
-cd fmu
-set FMU_FILE=..\..\..\..\fmu\%1\%FMI_PLATFORM%\%2.fmu
-if exist %FMU_FILE% del %FMU_FILE%
-..\..\..\..\bin\7z.exe a -tzip %FMU_FILE% ^
-  modelDescription.xml model.png binaries sources documentation
-goto cleanup
-
-:noCompiler
-echo No Microsoft Visual C compiler found
-
-:compileError
-echo build of %2 failed
-
-:cleanup
-popd
-if exist temp rmdir /S /Q temp
-
-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

+ 0 - 3
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/Makefile

@@ -1,3 +0,0 @@
-CFLAGS = -I..
-
-include ../Makefile

+ 0 - 64
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/dq.c

@@ -1,64 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Sample implementation of an FMU - the Dahlquist test equation.
- *
- *   der(x) = - k * x and x(0) = 1. 
- *   Analytical solution: x(t) = exp(-k*t).
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-// define class name and unique id
-#define MODEL_IDENTIFIER dq
-#define MODEL_GUID "{8c4e810f-3df3-4a00-8276-176fa3c9f000}"
-
-// define model size
-#define NUMBER_OF_REALS 3
-#define NUMBER_OF_INTEGERS 0
-#define NUMBER_OF_BOOLEANS 0
-#define NUMBER_OF_STRINGS 0
-#define NUMBER_OF_STATES 1
-#define NUMBER_OF_EVENT_INDICATORS 0
-
-// include fmu header files, typedefs and macros
-#include "fmuTemplate.h"
-
-// define all model variables and their value references
-// conventions used here:
-// - if x is a variable, then macro x_ is its variable reference
-// - the vr of a variable is its index in array  r, i, b or s
-// - if k is the vr of a real state, then k+1 is the vr of its derivative
-#define x_     0
-#define der_x_ 1
-#define k_     2
-
-// define state vector as vector of value references
-#define STATES { x_ }
-
-// called by fmiInstantiateModel
-// Set values for all variables that define a start value
-// Settings used unless changed by fmiSetX before fmiInitialize
-void setStartValues(ModelInstance *comp) {
-    r(x_) = 1;
-    r(k_) = 1;
-}
-
-// called by fmiInitialize() after setting eventInfo to defaults
-// Used to set the first time event, if any.
-void initialize(ModelInstance* comp, fmiEventInfo* eventInfo) {
-}
-
-// called by fmiGetReal, fmiGetContinuousStates and fmiGetDerivatives
-fmiReal getReal(ModelInstance* comp, fmiValueReference vr){
-    switch (vr) {
-        case x_     : return r(x_);
-        case der_x_ : return - r(k_) * r(x_);
-        case k_     : return r(k_);
-        default: return 0;
-    }
-}
-
-// Used to set the next time event, if any.
-void eventUpdate(fmiComponent comp, fmiEventInfo* eventInfo) {
-} 
-
-// include code that implements the FMI based on the above definitions
-#include "fmuTemplate.c"

+ 0 - 33
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/index.html

@@ -1,33 +0,0 @@
-<html>
-<head>
-<title>Documentation for dq.fmu</title>
-<style type="text/css">
-  html { font-family: Verdana, Arial, Helvetica, sans-serif; }
-  h1   { color: #000066; }
-</style>
-</head>
-<body>
-<h1>dq.fmu</h1>
-This FMU implements the equation 
-<ul>
-<li> der(x) = -k * x </li>
-</ul>
-The analytical solution of this system is 
-<ul>
-<li> x(t) = exp(-k*t) </li>
-</ul>
-The above equation is also known as 
-<a href="http://en.wikipedia.org/wiki/Germund_Dahlquist" target="_blank">Dahlquist</a> 
-test equation.
-<br/>
-<img src="plot_x.png">
-<br/>
-The figure shows the solution for x computed with Silver 
-for start values k = 1 and x = 1.
-
-<h2><a name="license">License conditions</a></h2>
-The FMU is provided by QTronic under the
-<a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a>.
-</body>
-</html>
-

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/model.png


+ 0 - 27
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/modelDescription_cs.xml

@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="dq"
-  modelIdentifier="dq"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f000}"
-  numberOfContinuousStates="1"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="x" valueReference="0" description="the only state">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x)" valueReference="1">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="k" valueReference="2" variability="parameter">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-<Implementation>
-  <CoSimulation_StandAlone>
-    <Capabilities
-      canHandleVariableCommunicationStepSize="true"
-      canHandleEvents="true"/>
-  </CoSimulation_StandAlone>
-</Implementation>
-</fmiModelDescription>

+ 0 - 20
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/modelDescription_me.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="dq"
-  modelIdentifier="dq"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f000}"
-  numberOfContinuousStates="1"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="x" valueReference="0" description="the only state">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x)" valueReference="1">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="k" valueReference="2" variability="parameter">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-</fmiModelDescription>

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/dq/plot_x.PNG


+ 0 - 800
examples/mass_spring_damper/fmusdk/fmu10/src/models/fmuTemplate.c

@@ -1,800 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Implementation of the FMI interface based on functions and macros to
- * be defined by the includer of this file. 
- * If FMI_COSIMULATION is defined, this implements "FMI for Co-Simulation 1.0",
- * otherwise "FMI for Model Exchange 1.0".
- * The "FMI for Co-Simulation 1.0", implementation assumes that exactly the 
- * following capability flags are set to fmiTrue:
- *    canHandleVariableCommunicationStepSize, i.e. fmiDoStep step size can vary
- *    canHandleEvents, i.e. fmiDoStep step size can be zero
- * and all other capability flags are set to default, i.e. to fmiFalse or 0.
- *
- * Revision history
- *  07.02.2010 initial version for "Model Exchange 1.0" released in FMU SDK 1.0
- *  05.03.2010 bug fix: fmiSetString now copies the passed string argument
- *     and fmiFreeModelInstance frees all string copies
- *  11.12.2010 replaced calloc by functions.allocateMemory in fmiInstantiateModel
- *  04.08.2011 added support for "FMI for Co-Simulation 1.0"
- *  02.08.2013 fixed a bug in instantiateModel reported by Markus Ende, TH Nuernberg
- *  02.04.2014 better time event handling
- *  02.06.2014 copy instanceName and GUID at instantiation
- *
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// array of value references of states
-#if NUMBER_OF_STATES>0
-fmiValueReference vrStates[NUMBER_OF_STATES] = STATES; 
-#endif
-
-#ifndef max
-#define max(a,b) ((a)>(b) ? (a) : (b))
-#endif
-
-#ifndef DT_EVENT_DETECT
-#define DT_EVENT_DETECT 1e-10
-#endif
-
-// ---------------------------------------------------------------------------
-// Private helpers used below to validate function arguments
-// ---------------------------------------------------------------------------
-
-static fmiBoolean invalidNumber(ModelInstance* comp, const char* f, const char* arg, int n, int nExpected){
-    if (n != nExpected) {
-        comp->state = modelError;
-        comp->functions.logger(comp, comp->instanceName, fmiError, "error", 
-                "%s: Invalid argument %s = %d. Expected %d.", f, arg, n, nExpected);
-        return fmiTrue;
-    }
-    return fmiFalse;
-}
-
-static fmiBoolean invalidState(ModelInstance* comp, const char* f, int statesExpected){
-    if (!comp) 
-        return fmiTrue;
-    if (!(comp->state & statesExpected)) {
-        comp->state = modelError;
-        comp->functions.logger(comp, comp->instanceName, fmiError, "error",
-                "%s: Illegal call sequence.", f);
-        return fmiTrue;
-    }
-    return fmiFalse;
-}
-
-static fmiBoolean nullPointer(ModelInstance* comp, const char* f, const char* arg, const void* p){
-    if (!p) {
-        comp->state = modelError;
-        comp->functions.logger(comp, comp->instanceName, fmiError, "error",
-                "%s: Invalid argument %s = NULL.", f, arg);
-        return fmiTrue;
-    }
-    return fmiFalse;
-}
-
-static fmiBoolean vrOutOfRange(ModelInstance* comp, const char* f, fmiValueReference vr, int end) {
-    if (vr >= end) {
-        comp->functions.logger(comp, comp->instanceName, fmiError, "error",
-                "%s: Illegal value reference %u.", f, vr);
-        comp->state = modelError;
-        return fmiTrue;
-    }
-    return fmiFalse;
-}  
-
-// ---------------------------------------------------------------------------
-// Private helpers used below to implement functions
-// ---------------------------------------------------------------------------
-
-fmiStatus setString(fmiComponent comp, fmiValueReference vr, fmiString value){
-    return fmiSetString(comp, &vr, 1, &value);
-}
-
-// fname is fmiInstantiateModel or fmiInstantiateSlave
-static fmiComponent instantiateModel(char* fname, fmiString instanceName, fmiString GUID,
-        fmiCallbackFunctions functions, fmiBoolean loggingOn) {
-    ModelInstance* comp;
-    if (!functions.logger) 
-        return NULL; // we cannot even log this problem
-    if (!instanceName || strlen(instanceName)==0) { 
-        functions.logger(NULL, "?", fmiError, "error",
-                "%s: Missing instance name.", fname);
-        return NULL;
-    }
-    if (!GUID || strlen(GUID)==0) {
-        functions.logger(NULL, instanceName, fmiError, "error",
-                "%s: Missing GUID.", fname);
-        return NULL;
-    }
-    if (!functions.allocateMemory || !functions.freeMemory){
-        functions.logger(NULL, instanceName, fmiError, "error",
-                "%s: Missing callback function.", fname);
-        return NULL;
-    }
-    if (strcmp(GUID, MODEL_GUID)) {
-        functions.logger(NULL, instanceName, fmiError, "error",
-                "%s: Wrong GUID %s. Expected %s.", fname, GUID, MODEL_GUID);
-        return NULL;
-    }
-    comp = (ModelInstance *)functions.allocateMemory(1, sizeof(ModelInstance));
-    if (comp) {
-        comp->r = (fmiReal *)functions.allocateMemory(NUMBER_OF_REALS,    sizeof(fmiReal));
-        comp->i = (fmiInteger *)functions.allocateMemory(NUMBER_OF_INTEGERS, sizeof(fmiInteger));
-        comp->b = (fmiBoolean *)functions.allocateMemory(NUMBER_OF_BOOLEANS, sizeof(fmiBoolean));
-        comp->s = (fmiString *)functions.allocateMemory(NUMBER_OF_STRINGS,  sizeof(fmiString));
-        comp->isPositive = (fmiBoolean *)functions.allocateMemory(NUMBER_OF_EVENT_INDICATORS, sizeof(fmiBoolean));
-        comp->instanceName = (char *)functions.allocateMemory(1 + strlen(instanceName), sizeof(char));
-        comp->GUID = (char *)functions.allocateMemory(1 + strlen(GUID), sizeof(char));
-    }
-    if (!comp || !comp->r || !comp->i || !comp->b || !comp->s || !comp->isPositive
-        || !comp->instanceName || !comp->GUID) {
-        functions.logger(NULL, instanceName, fmiError, "error",
-                "%s: Out of memory.", fname);
-        return NULL;
-    }
-    if (loggingOn) functions.logger(NULL, instanceName, fmiOK, "log",
-            "%s: GUID=%s", fname, GUID);
-
-    strcpy((char *)comp->instanceName, (char *)instanceName);
-    strcpy((char *)comp->GUID, (char *)GUID);
-    comp->functions = functions;
-    comp->loggingOn = loggingOn;
-    comp->state = modelInstantiated;
-    setStartValues(comp); // to be implemented by the includer of this file
-    return comp;
-}
-
-// fname is fmiInitialize or fmiInitializeSlave
-static fmiStatus init(char* fname, fmiComponent c, fmiBoolean toleranceControlled, fmiReal relativeTolerance,
-    fmiEventInfo* eventInfo) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, fname, modelInstantiated))
-         return fmiError;
-    if (nullPointer(comp, fname, "eventInfo", eventInfo))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log", 
-        "%s: toleranceControlled=%d relativeTolerance=%g", 
-        fname, toleranceControlled, relativeTolerance);
-    eventInfo->iterationConverged  = fmiTrue;
-    eventInfo->stateValueReferencesChanged = fmiFalse;
-    eventInfo->stateValuesChanged  = fmiFalse;
-    eventInfo->terminateSimulation = fmiFalse;
-    eventInfo->upcomingTimeEvent   = fmiFalse;
-    initialize(comp, eventInfo); // to be implemented by the includer of this file
-    comp->state = modelInitialized;
-    return fmiOK;
-}
-
-// fname is fmiTerminate or fmiTerminateSlave
-static fmiStatus terminate(char* fname, fmiComponent c){
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, fname, modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log", fname);
-    comp->state = modelTerminated;
-    return fmiOK;
-}
-
-// fname is freeModelInstance of freeSlaveInstance
-void freeInstance(char* fname, fmiComponent c) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (!comp) return;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log", fname);
-    if (comp->r) comp->functions.freeMemory(comp->r);
-    if (comp->i) comp->functions.freeMemory(comp->i);
-    if (comp->b) comp->functions.freeMemory(comp->b);
-    if (comp->s) {
-        int i;
-        for (i=0; i<NUMBER_OF_STRINGS; i++){
-            if (comp->s[i]) comp->functions.freeMemory((void *)comp->s[i]);
-        }
-        comp->functions.freeMemory((void *)comp->s);
-    }
-    if (comp->isPositive) comp->functions.freeMemory(comp->isPositive);
-    if (comp->instanceName) comp->functions.freeMemory((void *)comp->instanceName);
-    if (comp->GUID) comp->functions.freeMemory((void *)comp->GUID);
-    comp->functions.freeMemory(comp);
-}
-
-// ---------------------------------------------------------------------------
-// FMI functions: class methods not depending of a specific model instance
-// ---------------------------------------------------------------------------
-
-const char* fmiGetVersion() {
-    return fmiVersion;
-}
-
-// ---------------------------------------------------------------------------
-// FMI functions: for FMI Model Exchange 1.0 and for FMI Co-Simulation 1.0
-// logging control, setters and getters for Real, Integer, Boolean, String
-// ---------------------------------------------------------------------------
-
-fmiStatus fmiSetDebugLogging(fmiComponent c, fmiBoolean loggingOn) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiSetDebugLogging", not_modelError))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetDebugLogging: loggingOn=%d", loggingOn);
-    comp->loggingOn = loggingOn;
-    return fmiOK;
-}
-
-fmiStatus fmiSetReal(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiReal value[]){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiSetReal", modelInstantiated|modelInitialized))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetReal", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetReal", "value[]", value))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetReal: nvr = %d", nvr);
-    // no check whether setting the value is allowed in the current state
-    for (i=0; i<nvr; i++) {
-       if (vrOutOfRange(comp, "fmiSetReal", vr[i], NUMBER_OF_REALS))
-           return fmiError;
-       if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetReal: #r%d# = %.16g", vr[i], value[i]);
-       comp->r[vr[i]] = value[i];
-    }
-    return fmiOK;
-}
-
-fmiStatus fmiSetInteger(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiInteger value[]){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiSetInteger", modelInstantiated|modelInitialized))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetInteger", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetInteger", "value[]", value))
-         return fmiError;
-    if (comp->loggingOn)
-        comp->functions.logger(c, comp->instanceName, fmiOK, "log", "fmiSetInteger: nvr = %d",  nvr);
-    for (i=0; i<nvr; i++) {
-       if (vrOutOfRange(comp, "fmiSetInteger", vr[i], NUMBER_OF_INTEGERS))
-           return fmiError;
-       if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetInteger: #i%d# = %d", vr[i], value[i]);
-        comp->i[vr[i]] = value[i]; 
-    }
-    return fmiOK;
-}
-
-fmiStatus fmiSetBoolean(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiBoolean value[]){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiSetBoolean", modelInstantiated|modelInitialized))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetBoolean", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetBoolean", "value[]", value))
-         return fmiError;
-    if (comp->loggingOn)
-        comp->functions.logger(c, comp->instanceName, fmiOK, "log", "fmiSetBoolean: nvr = %d",  nvr);
-    for (i=0; i<nvr; i++) {
-        if (vrOutOfRange(comp, "fmiSetBoolean", vr[i], NUMBER_OF_BOOLEANS))
-            return fmiError;
-       if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetBoolean: #b%d# = %s", vr[i], value[i] ? "true" : "false");
-        comp->b[vr[i]] = value[i]; 
-    }
-    return fmiOK;
-}
-
-fmiStatus fmiSetString(fmiComponent c, const fmiValueReference vr[], size_t nvr, const fmiString value[]){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiSetString", modelInstantiated|modelInitialized))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetString", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiSetString", "value[]", value))
-         return fmiError;
-    if (comp->loggingOn)
-        comp->functions.logger(c, comp->instanceName, fmiOK, "log", "fmiSetString: nvr = %d",  nvr);
-    for (i=0; i<nvr; i++) {
-        char *string = (char *)comp->s[vr[i]];
-        if (vrOutOfRange(comp, "fmiSetString", vr[i], NUMBER_OF_STRINGS))
-            return fmiError;
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetString: #s%d# = '%s'", vr[i], value[i]);
-        if (value[i] == NULL) {
-            if (string) comp->functions.freeMemory(string);
-            comp->s[vr[i]] = NULL;
-            comp->functions.logger(comp, comp->instanceName, fmiWarning, "warning",
-                            "fmiSetString: string argument value[%d] = NULL.", i);
-        } else {
-            if (string==NULL || strlen(string) < strlen(value[i])) {
-                if (string) comp->functions.freeMemory(string);
-                comp->s[vr[i]] = (char *)comp->functions.allocateMemory(1+strlen(value[i]), sizeof(char));
-                if (!comp->s[vr[i]]) {
-                    comp->state = modelError;
-                    comp->functions.logger(NULL, comp->instanceName, fmiError, "error", "fmiSetString: Out of memory.");
-                    return fmiError;
-                }
-            }
-            strcpy((char *)comp->s[vr[i]], (char *)value[i]);
-        }
-    }
-    return fmiOK;
-}
-
-fmiStatus fmiGetReal(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiReal value[]) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetReal", not_modelError))
-        return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetReal", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetReal", "value[]", value))
-         return fmiError;
-#if NUMBER_OF_REALS>0
-    for (i=0; i<nvr; i++) {
-        if (vrOutOfRange(comp, "fmiGetReal", vr[i], NUMBER_OF_REALS))
-            return fmiError;
-        value[i] = getReal(comp, vr[i]); // to be implemented by the includer of this file
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-                "fmiGetReal: #r%u# = %.16g", vr[i], value[i]);
-    }
-#endif
-    return fmiOK;
-}
-
-fmiStatus fmiGetInteger(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiInteger value[]) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetInteger", not_modelError))
-        return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetInteger", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetInteger", "value[]", value))
-         return fmiError;
-    for (i=0; i<nvr; i++) {
-        if (vrOutOfRange(comp, "fmiGetInteger", vr[i], NUMBER_OF_INTEGERS))
-           return fmiError;
-        value[i] = comp->i[vr[i]];
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-                "fmiGetInteger: #i%u# = %d", vr[i], value[i]);
-    }
-    return fmiOK;
-}
-
-fmiStatus fmiGetBoolean(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiBoolean value[]) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetBoolean", not_modelError))
-        return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetBoolean", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetBoolean", "value[]", value))
-         return fmiError;
-    for (i=0; i<nvr; i++) {
-        if (vrOutOfRange(comp, "fmiGetBoolean", vr[i], NUMBER_OF_BOOLEANS))
-           return fmiError;
-        value[i] = comp->b[vr[i]];
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-                "fmiGetBoolean: #b%u# = %s", vr[i], value[i]? "true" : "false");
-    }
-    return fmiOK;
-}
-
-fmiStatus fmiGetString(fmiComponent c, const fmiValueReference vr[], size_t nvr, fmiString  value[]) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetString", not_modelError))
-        return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetString", "vr[]", vr))
-         return fmiError;
-    if (nvr>0 && nullPointer(comp, "fmiGetString", "value[]", value))
-         return fmiError;
-    for (i=0; i<nvr; i++) {
-        if (vrOutOfRange(comp, "fmiGetString", vr[i], NUMBER_OF_STRINGS))
-           return fmiError;
-        value[i] = comp->s[vr[i]];
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-                "fmiGetString: #s%u# = '%s'", vr[i], value[i]);
-    }
-    return fmiOK;
-}
-
-#ifdef FMI_COSIMULATION
-// ---------------------------------------------------------------------------
-// FMI functions: only for FMI Co-Simulation 1.0
-// ---------------------------------------------------------------------------
-
-const char* fmiGetTypesPlatform() {
-    return fmiPlatform;
-}
-
-fmiComponent fmiInstantiateSlave(fmiString  instanceName, fmiString GUID,
-    fmiString fmuLocation, fmiString mimeType, fmiReal timeout, fmiBoolean visible,
-    fmiBoolean interactive, fmiCallbackFunctions functions, fmiBoolean loggingOn) {
-    // ignoring arguments: fmuLocation, mimeType, timeout, visible, interactive
-    return instantiateModel("fmiInstantiateSlave", instanceName, GUID, functions, loggingOn);
-}
-
-fmiStatus fmiInitializeSlave(fmiComponent c, fmiReal tStart, fmiBoolean StopTimeDefined, fmiReal tStop) {
-    ModelInstance* comp = (ModelInstance *)c;
-    fmiBoolean toleranceControlled = fmiFalse;
-    fmiReal relativeTolerance = 0;
-    fmiStatus flag = fmiOK;
-    comp->eventInfo.iterationConverged = 0;
-    while (flag==fmiOK && !comp->eventInfo.iterationConverged) {
-        // ignoring arguments: tStart, StopTimeDefined, tStop
-        flag = init("fmiInitializeSlave", c, toleranceControlled, relativeTolerance, &comp->eventInfo);
-    }
-    return flag;
-}
-
-fmiStatus fmiTerminateSlave(fmiComponent c) {
-    return terminate("fmiTerminateSlave", c);
-}
-
-fmiStatus fmiResetSlave(fmiComponent c) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiResetSlave", modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log", "fmiResetSlave");
-    comp->state = modelInstantiated;
-    setStartValues(comp); // to be implemented by the includer of this file
-    return fmiOK;
-}
-
-void fmiFreeSlaveInstance(fmiComponent c) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiFreeSlaveInstance", modelTerminated))
-         return;
-    freeInstance("fmiFreeSlaveInstance", c);
-}
-
-fmiStatus fmiSetRealInputDerivatives(fmiComponent c, const fmiValueReference vr[], size_t nvr,
-    const fmiInteger order[], const fmiReal value[]) {
-    ModelInstance* comp = (ModelInstance *)c;
-    fmiCallbackLogger log = comp->functions.logger;
-    if (invalidState(comp, "fmiSetRealInputDerivatives", modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) log(c, comp->instanceName, fmiOK, "log", "fmiSetRealInputDerivatives: nvr= %d", nvr);
-    log(c, comp->instanceName, fmiError, "warning", "fmiSetRealInputDerivatives: ignoring function call."
-      " This model cannot interpolate inputs: canInterpolateInputs=\"fmiFalse\"");
-    return fmiWarning;
-}
-
-fmiStatus fmiGetRealOutputDerivatives(fmiComponent c, const fmiValueReference vr[], size_t nvr,
-    const fmiInteger order[], fmiReal value[]) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    fmiCallbackLogger log = comp->functions.logger;
-    if (invalidState(comp, "fmiGetRealOutputDerivatives", modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) log(c, comp->instanceName, fmiOK, "log", "fmiGetRealOutputDerivatives: nvr= %d", nvr);
-    log(c, comp->instanceName, fmiError, "warning", "fmiGetRealOutputDerivatives: ignoring function call."
-      " This model cannot compute derivatives of outputs: MaxOutputDerivativeOrder=\"0\"");
-    for (i=0; i<nvr; i++) value[i] = 0;
-    return fmiWarning;
-}
-
-fmiStatus fmiCancelStep(fmiComponent c) {
-    ModelInstance* comp = (ModelInstance *)c;
-    fmiCallbackLogger log = comp->functions.logger;
-    if (invalidState(comp, "fmiCancelStep", modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) log(c, comp->instanceName, fmiOK, "log", "fmiCancelStep");
-    log(c, comp->instanceName, fmiError, "error", 
-        "fmiCancelStep: Can be called when fmiDoStep returned fmiPending."
-        " This is not the case."); 
-    return fmiError;
-}
-
-fmiStatus fmiDoStep(fmiComponent c, fmiReal currentCommunicationPoint,
-    fmiReal communicationStepSize, fmiBoolean newStep) {
-    ModelInstance* comp = (ModelInstance *)c;
-    fmiCallbackLogger log = comp->functions.logger;
-    double h = communicationStepSize / 10;
-    int k,i;
-    const int n = 10; // how many Euler steps to perform for one do step
-    double prevState[max(NUMBER_OF_STATES, 1)];
-    double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
-    int stateEvent = 0;
-
-    if (invalidState(comp, "fmiDoStep", modelInitialized))
-         return fmiError;
-
-    if (comp->loggingOn) log(c, comp->instanceName, fmiOK, "log", "fmiDoStep: "
-       "currentCommunicationPoint = %g, " 
-       "communicationStepSize = %g, " 
-       "newStep = fmi%s",
-       currentCommunicationPoint, communicationStepSize, newStep ? "True" : "False");
-    
-    // Treat also case of zero step, i.e. during an event iteration
-    if (communicationStepSize == 0) {
-        return fmiOK;
-    }
-
-#if NUMBER_OF_EVENT_INDICATORS>0
-    // initialize previous event indicators with current values
-    for (i=0; i<NUMBER_OF_EVENT_INDICATORS; i++) {
-        prevEventIndicators[i] = getEventIndicator(comp, i);
-    }
-#endif
-
-    // break the step into n steps and do forward Euler.
-    comp->time = currentCommunicationPoint;
-    for (k=0; k<n; k++) {
-        comp->time += h;
-
-#if NUMBER_OF_STATES>0
-        for (i=0; i<NUMBER_OF_STATES; i++) {
-            prevState[i] = r(vrStates[i]);
-        }
-        for (i=0; i<NUMBER_OF_STATES; i++) {
-            fmiValueReference vr = vrStates[i];
-            r(vr) += h * getReal(comp, vr+1); // forward Euler step
-        }
-#endif
-
-#if NUMBER_OF_EVENT_INDICATORS>0
-        // check for state event
-        for (i=0; i<NUMBER_OF_EVENT_INDICATORS; i++) {
-            double ei = getEventIndicator(comp, i);
-            if (ei * prevEventIndicators[i] < 0) {
-                if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log", 
-                    "fmiDoStep: state event at %g, z%d crosses zero -%c-", comp->time, i, ei<0 ? '\\' : '/');
-                stateEvent++;
-            }
-            prevEventIndicators[i] = ei;
-        }
-        if (stateEvent) {
-            eventUpdate(comp, &comp->eventInfo);
-            stateEvent = 0;
-        } 
-#endif
-        // check for time event
-        if (comp->eventInfo.upcomingTimeEvent && (comp->time - comp->eventInfo.nextEventTime > -DT_EVENT_DETECT)) {
-            if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-                "fmiDoStep: time event detected at %g", comp->time);
-            eventUpdate(comp, &comp->eventInfo);
-        }
-
-        // terminate simulation, if requested by the model
-        if (comp->eventInfo.terminateSimulation) {
-            comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-              "fmiDoStep: model requested termination at t=%g", comp->time);
-            return fmiError; // enforce termination of the simulation loop
-        }
-    }
-    return fmiOK;
-}
-
-static fmiStatus getStatus(char* fname, fmiComponent c, const fmiStatusKind s) {
-    const char* statusKind[3] = {"fmiDoStepStatus","fmiPendingStatus","fmiLastSuccessfulTime"};
-    ModelInstance* comp = (ModelInstance *)c;
-    fmiCallbackLogger log = comp->functions.logger;
-    if (invalidState(comp, fname, modelInstantiated|modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) log(c, comp->instanceName, fmiOK, "log", "$s: fmiStatusKind = %s", fname, statusKind[s]);
-    switch(s) {
-        case fmiDoStepStatus:  log(c, comp->instanceName, fmiError, "error",
-           "%s: Can be called with fmiDoStepStatus when fmiDoStep returned fmiPending."
-           " This is not the case.", fname);
-           break;
-        case fmiPendingStatus:  log(c, comp->instanceName, fmiError, "error", 
-           "%s: Can be called with fmiPendingStatus when fmiDoStep returned fmiPending."
-           " This is not the case.", fname); 
-           break;
-        case fmiLastSuccessfulTime:  log(c, comp->instanceName, fmiError, "error",
-           "%s: Can be called with fmiLastSuccessfulTime when fmiDoStep returned fmiDiscard."
-           " This is not the case.", fname); 
-           break;
-    }
-    return fmiError;
-}
-
-fmiStatus fmiGetStatus(fmiComponent c, const fmiStatusKind s, fmiStatus* value) {
-    return getStatus("fmiGetStatus", c, s);
-}
-
-fmiStatus fmiGetRealStatus(fmiComponent c, const fmiStatusKind s, fmiReal* value){
-    return getStatus("fmiGetRealStatus", c, s);
-}
-
-fmiStatus fmiGetIntegerStatus(fmiComponent c, const fmiStatusKind s, fmiInteger* value){
-    return getStatus("fmiGetIntegerStatus", c, s);
-}
-
-fmiStatus fmiGetBooleanStatus(fmiComponent c, const fmiStatusKind s, fmiBoolean* value){
-    return getStatus("fmiGetBooleanStatus", c, s);
-}
-
-fmiStatus fmiGetStringStatus(fmiComponent c, const fmiStatusKind s, fmiString*  value){
-    return getStatus("fmiGetStringStatus", c, s);
-}
-
-#else
-// ---------------------------------------------------------------------------
-// FMI functions: only for Model Exchange 1.0
-// ---------------------------------------------------------------------------
-
-const char* fmiGetModelTypesPlatform() {
-    return fmiModelTypesPlatform;
-}
-
-fmiComponent fmiInstantiateModel(fmiString instanceName, fmiString GUID, 
-        fmiCallbackFunctions functions, fmiBoolean loggingOn) {
-    return instantiateModel("fmiInstantiateModel", instanceName, GUID, functions, loggingOn);
-}
-
-fmiStatus fmiInitialize(fmiComponent c, fmiBoolean toleranceControlled, fmiReal relativeTolerance,
-    fmiEventInfo* eventInfo) {
-    return init("fmiInitialize", c, toleranceControlled, relativeTolerance, eventInfo);
-}
-
-fmiStatus fmiSetTime(fmiComponent c, fmiReal time) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiSetTime", modelInstantiated|modelInitialized))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetTime: time=%.16g", time);
-    comp->time = time;
-    return fmiOK;
-}
-
-fmiStatus fmiSetContinuousStates(fmiComponent c, const fmiReal x[], size_t nx){
-    ModelInstance* comp = (ModelInstance *)c;
-    int i;
-    if (invalidState(comp, "fmiSetContinuousStates", modelInitialized))
-         return fmiError;
-    if (invalidNumber(comp, "fmiSetContinuousStates", "nx", nx, NUMBER_OF_STATES))
-        return fmiError;
-    if (nullPointer(comp, "fmiSetContinuousStates", "x[]", x))
-         return fmiError;
-#if NUMBER_OF_STATES>0
-    for (i=0; i<nx; i++) {
-        fmiValueReference vr = vrStates[i];
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiSetContinuousStates: #r%d#=%.16g", vr, x[i]);
-        assert(vr<NUMBER_OF_REALS);
-        comp->r[vr] = x[i];
-    }
-#endif
-    return fmiOK;
-}
-
-fmiStatus fmiEventUpdate(fmiComponent c, fmiBoolean intermediateResults, fmiEventInfo* eventInfo) {
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiEventUpdate", modelInitialized))
-        return fmiError;
-    if (nullPointer(comp, "fmiEventUpdate", "eventInfo", eventInfo))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-        "fmiEventUpdate: intermediateResults = %d", intermediateResults);
-    eventInfo->iterationConverged  = fmiTrue;
-    eventInfo->stateValueReferencesChanged = fmiFalse;
-    eventInfo->stateValuesChanged  = fmiFalse;
-    eventInfo->terminateSimulation = fmiFalse;
-    eventInfo->upcomingTimeEvent   = fmiFalse;
-    eventUpdate(comp, eventInfo); // to be implemented by the includer of this file
-    return fmiOK;
-}
-
-fmiStatus fmiCompletedIntegratorStep(fmiComponent c, fmiBoolean* callEventUpdate){
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiCompletedIntegratorStep", modelInitialized))
-         return fmiError;
-    if (nullPointer(comp, "fmiCompletedIntegratorStep", "callEventUpdate", callEventUpdate))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiCompletedIntegratorStep");
-    *callEventUpdate = fmiFalse;
-    return fmiOK;
-}
-
-fmiStatus fmiGetStateValueReferences(fmiComponent c, fmiValueReference vrx[], size_t nx){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetStateValueReferences", not_modelError))
-        return fmiError;
-    if (invalidNumber(comp, "fmiGetStateValueReferences", "nx", nx, NUMBER_OF_STATES))
-        return fmiError;
-    if (nullPointer(comp, "fmiGetStateValueReferences", "vrx[]", vrx))
-         return fmiError;
-#if NUMBER_OF_STATES>0
-    for (i=0; i<nx; i++) {
-        vrx[i] = vrStates[i];
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiGetStateValueReferences: vrx[%d] = %d", i, vrx[i]);
-    }
-#endif
-    return fmiOK;
-}
-
-fmiStatus fmiGetContinuousStates(fmiComponent c, fmiReal states[], size_t nx){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetContinuousStates", not_modelError))
-        return fmiError;
-    if (invalidNumber(comp, "fmiGetContinuousStates", "nx", nx, NUMBER_OF_STATES))
-        return fmiError;
-    if (nullPointer(comp, "fmiGetContinuousStates", "states[]", states))
-         return fmiError;
-#if NUMBER_OF_STATES>0
-    for (i=0; i<nx; i++) {
-        fmiValueReference vr = vrStates[i];
-        states[i] = getReal(comp, vr); // to be implemented by the includer of this file
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiGetContinuousStates: #r%u# = %.16g", vr, states[i]);
-    }
-#endif
-    return fmiOK;
-}
-
-fmiStatus fmiGetNominalContinuousStates(fmiComponent c, fmiReal x_nominal[], size_t nx){
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetNominalContinuousStates", not_modelError))
-        return fmiError;
-    if (invalidNumber(comp, "fmiGetNominalContinuousStates", "nx", nx, NUMBER_OF_STATES))
-        return fmiError;
-    if (nullPointer(comp, "fmiGetNominalContinuousStates", "x_nominal[]", x_nominal))
-         return fmiError;
-    if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-        "fmiGetNominalContinuousStates: x_nominal[0..%d] = 1.0", nx-1);
-    for (i=0; i<nx; i++) 
-        x_nominal[i] = 1;
-    return fmiOK;
-}
-
-fmiStatus fmiGetDerivatives(fmiComponent c, fmiReal derivatives[], size_t nx) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetDerivatives", not_modelError))
-         return fmiError;
-    if (invalidNumber(comp, "fmiGetDerivatives", "nx", nx, NUMBER_OF_STATES)) 
-        return fmiError;
-    if (nullPointer(comp, "fmiGetDerivatives", "derivatives[]", derivatives))
-         return fmiError;
-#if NUMBER_OF_STATES>0
-    for (i=0; i<nx; i++) {
-        fmiValueReference vr = vrStates[i] + 1;
-        derivatives[i] = getReal(comp, vr); // to be implemented by the includer of this file
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log",
-            "fmiGetDerivatives: #r%d# = %.16g", vr, derivatives[i]);
-    }
-#endif
-    return fmiOK;
-}
-
-fmiStatus fmiGetEventIndicators(fmiComponent c, fmiReal eventIndicators[], size_t ni) {
-    int i;
-    ModelInstance* comp = (ModelInstance *)c;
-    if (invalidState(comp, "fmiGetEventIndicators", not_modelError))
-        return fmiError;
-    if (invalidNumber(comp, "fmiGetEventIndicators", "ni", ni, NUMBER_OF_EVENT_INDICATORS)) 
-        return fmiError;
-#if NUMBER_OF_EVENT_INDICATORS>0
-    for (i=0; i<ni; i++) {
-        eventIndicators[i] = getEventIndicator(comp, i); // to be implemented by the includer of this file
-        if (comp->loggingOn) comp->functions.logger(c, comp->instanceName, fmiOK, "log", 
-            "fmiGetEventIndicators: z%d = %.16g", i, eventIndicators[i]);
-    }
-#endif
-    return fmiOK;
-}
-
-fmiStatus fmiTerminate(fmiComponent c){
-    return terminate("fmiTerminate", c);
-}
-
-void fmiFreeModelInstance(fmiComponent c) {
-    freeInstance("fmiFreeModelInstance", c);
-}
-
-#endif // Model Exchange 1.0
-
-#ifdef __cplusplus
-} // closing brace for extern "C"
-#endif

+ 0 - 59
examples/mass_spring_damper/fmusdk/fmu10/src/models/fmuTemplate.h

@@ -1,59 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * fmuTemplate.h
- * Definitions used in fmiModelFunctions.c and by the includer of this file
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef FMI_COSIMULATION
-#include "fmiFunctions.h"
-#else
-#include "fmiModelFunctions.h"
-#endif
-
-// macros used to define variables
-#define  r(vr) comp->r[vr]
-#define  i(vr) comp->i[vr]
-#define  b(vr) comp->b[vr]
-#define  s(vr) comp->s[vr]
-#define pos(z) comp->isPositive[z]
-#define copy(vr, value) setString(comp, vr, value)
-
-fmiStatus setString(fmiComponent comp, fmiValueReference vr, fmiString value);
-
-#define not_modelError (modelInstantiated|modelInitialized|modelTerminated)
-
-typedef enum {
-    modelInstantiated = 1<<0,
-    modelInitialized  = 1<<1,
-    modelTerminated   = 1<<2,
-    modelError        = 1<<3
-} ModelState;
-
-typedef struct {
-    fmiReal    *r;
-    fmiInteger *i;
-    fmiBoolean *b;
-    fmiString  *s;
-    fmiBoolean *isPositive;
-    fmiReal time;
-    fmiString instanceName;
-    fmiString GUID;
-    fmiCallbackFunctions functions;
-    fmiBoolean loggingOn;
-    ModelState state;
-#ifdef FMI_COSIMULATION
-    fmiEventInfo eventInfo;
-#endif
-} ModelInstance;
-
-#ifdef __cplusplus
-} // closing brace for extern "C"
-#endif

+ 0 - 3
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/Makefile

@@ -1,3 +0,0 @@
-CFLAGS = -I..
-
-include ../Makefile

+ 0 - 55
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/inc.c

@@ -1,55 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Sample implementation of an FMU - increments an int counter every second.
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-// define class name and unique id
-#define MODEL_IDENTIFIER inc
-#define MODEL_GUID "{8c4e810f-3df3-4a00-8276-176fa3c9f008}"
-
-// define model size
-#define NUMBER_OF_REALS 0
-#define NUMBER_OF_INTEGERS 1
-#define NUMBER_OF_BOOLEANS 0
-#define NUMBER_OF_STRINGS 0
-#define NUMBER_OF_STATES 0
-#define NUMBER_OF_EVENT_INDICATORS 0
-
-// include fmu header files, typedefs and macros
-#include "fmuTemplate.h"
-
-// define all model variables and their value references
-// conventions used here:
-// - if x is a variable, then macro x_ is its variable reference
-// - the vr of a variable is its index in array  r, i, b or s
-// - if k is the vr of a real state, then k+1 is the vr of its derivative
-#define counter_ 0
-
-// called by fmiInstantiateModel
-// Set values for all variables that define a start value
-// Settings used unless changed by fmiSetX before fmiInitialize
-void setStartValues(ModelInstance *comp) {
-    i(counter_) = 1;
-}
-
-// called by fmiInitialize() after setting eventInfo to defaults
-// Used to set the first time event, if any.
-void initialize(ModelInstance* comp, fmiEventInfo* eventInfo) {
-    eventInfo->upcomingTimeEvent   = fmiTrue;
-    eventInfo->nextEventTime       = 1 + comp->time;
-}
-
-// called by fmiEventUpdate() after setting eventInfo to defaults
-// Used to set the next time event, if any.
-void eventUpdate(ModelInstance* comp, fmiEventInfo* eventInfo) {
-    i(counter_) += 1;
-    if (i(counter_) == 13) 
-        eventInfo->terminateSimulation = fmiTrue;
-    else {
-        eventInfo->upcomingTimeEvent   = fmiTrue;
-        eventInfo->nextEventTime       = 1 + comp->time;
-    }
-} 
-
-// include code that implements the FMI based on the above definitions
-#include "fmuTemplate.c"

+ 0 - 22
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/index.html

@@ -1,22 +0,0 @@
-<html>
-<head>
-    <title>Documentation for inc.fmu</title>
-<style type="text/css">
-  html { font-family: Verdana, Arial, Helvetica, sans-serif; }
-  h1   { color: #000066; }
-</style>
-</head>
-<body>
-<h1>inc.fmu</h1>
-This FMU generates time events to increment an integer counter every second and terminates simulation at t=12 sec.
-<br/>    
-<img src="plot_counter.PNG">
-<br/>
-The figure shows the solution computed with Silver.
-
-<h2><a name="license">License conditions</a></h2>
-The FMU is provided by QTronic under the
-<a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a>.
-</body>
-</html>
-

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/model.png


+ 0 - 13
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/modelDescription.xml

@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="inc"
-  modelIdentifier="inc"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f008}"
-  numberOfContinuousStates="0"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="counter" valueReference="0" description="counts the seconds" causality = "output">
-     <Integer start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>

+ 0 - 21
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/modelDescription_cs.xml

@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="inc"
-  modelIdentifier="inc"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f008}"
-  numberOfContinuousStates="0"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="counter" valueReference="0" description="counts the seconds" causality = "output">
-     <Integer start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-<Implementation>
-  <CoSimulation_StandAlone>
-    <Capabilities
-      canHandleVariableCommunicationStepSize="true"
-      canHandleEvents="true"/>
-  </CoSimulation_StandAlone>
-</Implementation>
-</fmiModelDescription>

+ 0 - 14
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/modelDescription_me.xml

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="inc"
-  modelIdentifier="inc"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f008}"
-  numberOfContinuousStates="0"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="counter" valueReference="0" description="counts the seconds" causality = "output">
-     <Integer start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-</fmiModelDescription>

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/inc/plot_counter.PNG


+ 0 - 3
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/Makefile

@@ -1,3 +0,0 @@
-CFLAGS = -I..
-
-include ../Makefile

+ 0 - 23
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/index.html

@@ -1,23 +0,0 @@
-<html>
-<head>
-    <title>Documentation for values.fmu</title>
-<style type="text/css">
-  html { font-family: Verdana, Arial, Helvetica, sans-serif; }
-  h1   { color: #000066; }
-</style>
-</head>
-<body>
-    <h1>values.fmu</h1>
-    This FMU demonstrates the use of all four scalar FMU data types 
-    and terminates simulation at t=12 sec.
-    <img src="values.PNG">
-<br>
-The figure shows the solution computed with fmusim using the command 
-<code>fmusim me fmu\me\values.fmu 12 12</code>.
-
-<h2><a name="license">License conditions</a></h2>
-The FMU is provided by QTronic under the
-<a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a>.
-</body>
-</html>
-

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/model.png


+ 0 - 42
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/modelDescription_cs.xml

@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="values"
-  modelIdentifier="values"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f004}"
-  numberOfContinuousStates="1"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="x" valueReference="0" description="used as continuous state">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x)" valueReference="1" description="time derivative of x">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="int_in" valueReference="0" description="integer input" causality = "input">
-     <Integer start="2"/>
-  </ScalarVariable>
-  <ScalarVariable name="int_out" valueReference="1" description="index in string array 'month'" causality = "output">
-     <Integer start="0" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="bool_in" valueReference="0" description="boolean input" causality = "input">
-     <Boolean start="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="bool_out" valueReference="1" description="boolean output" causality = "output">
-     <Boolean/>
-  </ScalarVariable>
-  <ScalarVariable name="string_in" valueReference="0" description="string input" causality = "input">
-     <String start="QTronic"/>
-  </ScalarVariable>
-  <ScalarVariable name="string_out" valueReference="1" description="the string month[int_out]" causality = "output">
-     <String/>
-  </ScalarVariable>
-</ModelVariables>
-<Implementation>
-  <CoSimulation_StandAlone>
-    <Capabilities
-      canHandleVariableCommunicationStepSize="true"
-      canHandleEvents="true"/>
-  </CoSimulation_StandAlone>
-</Implementation>
-</fmiModelDescription>

+ 0 - 35
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/modelDescription_me.xml

@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="values"
-  modelIdentifier="values"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f004}"
-  numberOfContinuousStates="1"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="x" valueReference="0" description="used as continuous state">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x)" valueReference="1" description="time derivative of x">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="int_in" valueReference="0" description="integer input" causality = "input">
-     <Integer start="2"/>
-  </ScalarVariable>
-  <ScalarVariable name="int_out" valueReference="1" description="index in string array 'month'" causality = "output">
-     <Integer start="0" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="bool_in" valueReference="0" description="boolean input" causality = "input">
-     <Boolean start="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="bool_out" valueReference="1" description="boolean output" causality = "output">
-     <Boolean/>
-  </ScalarVariable>
-  <ScalarVariable name="string_in" valueReference="0" description="string input" causality = "input">
-     <String start="QTronic"/>
-  </ScalarVariable>
-  <ScalarVariable name="string_out" valueReference="1" description="the string month[int_out]" causality = "output">
-     <String/>
-  </ScalarVariable>
-</ModelVariables>
-</fmiModelDescription>

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/values.PNG


+ 0 - 84
examples/mass_spring_damper/fmusdk/fmu10/src/models/values/values.c

@@ -1,84 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Sample implementation of an FMU.
- * This demonstrates the use of all FMU variable types.
- * Copyright QTronic GmbH. All rights reserved.
- * ---------------------------------------------------------------------------*/
-
-// define class name and unique id
-#define MODEL_IDENTIFIER values
-#define MODEL_GUID "{8c4e810f-3df3-4a00-8276-176fa3c9f004}"
-
-// define model size
-#define NUMBER_OF_REALS 2
-#define NUMBER_OF_INTEGERS 2
-#define NUMBER_OF_BOOLEANS 2
-#define NUMBER_OF_STRINGS 2
-#define NUMBER_OF_STATES 1
-#define NUMBER_OF_EVENT_INDICATORS 0
-
-// include fmu header files, typedefs and macros
-#include "fmuTemplate.h"
-
-// define all model variables and their value references
-// conventions used here:
-// - if x is a variable, then macro x_ is its variable reference
-// - the vr of a variable is its index in array  r, i, b or s
-// - if k is the vr of a real state, then k+1 is the vr of its derivative
-#define x_          0
-#define der_x_      1
-#define int_in_     0
-#define int_out_    1
-#define bool_in_    0
-#define bool_out_   1
-#define string_in_  0
-#define string_out_ 1
-
-// define state vector as vector of value references
-#define STATES { x_ }
-
-const char* month[] = {
-    "jan","feb","march","april","may","june","july",
-    "august","sept","october","november","december"
-};
-
-// called by fmiInstantiateModel
-// Set values for all variables that define a start value
-// Settings used unless changed by fmiSetX before fmiInitialize
-void setStartValues(ModelInstance *comp) {
-    r(x_) = 1;
-    i(int_in_) = 2;
-    i(int_out_) = 0;
-    b(bool_in_) = fmiTrue;
-    b(bool_out_) = fmiFalse;
-    copy(string_in_, "QTronic");
-    copy(string_out_, month[0]);
-}
-
-// called by fmiInitialize() after setting eventInfo to defaults
-// Used to set the first time event, if any.
-void initialize(ModelInstance* comp, fmiEventInfo* eventInfo) {
-    eventInfo->upcomingTimeEvent   = fmiTrue;
-    eventInfo->nextEventTime       = 1 + comp->time;
-}
-
-// called by fmiGetReal, fmiGetContinuousStates and fmiGetDerivatives
-fmiReal getReal(ModelInstance* comp, fmiValueReference vr){
-    switch (vr) {
-        case x_     : return   r(x_);
-        case der_x_ : return - r(x_);
-        default: return 0;
-    }
-}
-
-// called by fmiEventUpdate() after setting eventInfo to defaults
-void eventUpdate(ModelInstance* comp, fmiEventInfo* eventInfo) {
-    eventInfo->upcomingTimeEvent   = fmiTrue;
-    eventInfo->nextEventTime       = 1 + comp->time;
-    i(int_out_) += 1;
-    b(bool_out_) = !b(bool_out_);
-    if (i(int_out_)<12) copy(string_out_, month[i(int_out_)]);
-    else eventInfo->terminateSimulation = fmiTrue;
-}
-
-// include code that implements the FMI based on the above definitions
-#include "fmuTemplate.c"

+ 0 - 3
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/Makefile

@@ -1,3 +0,0 @@
-CFLAGS = -I..
-
-include ../Makefile

+ 0 - 27
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/index.html

@@ -1,27 +0,0 @@
-<html>
-<head>
-<title>Documentation for vanDerPol.fmu</title>
-<style type="text/css">
-  html { font-family: Verdana, Arial, Helvetica, sans-serif; }
-  h1   { color: #000066; }
-</style>
-</head>
-<body>
-<h1>vanDerPol.fmu</h1>
-This FMU implements the famous
-<a href="http://en.wikipedia.org/wiki/Van_der_Pol_oscillator" target="_blank">Van der Pol oscillator</a>.
-<ul>
-<li> der(x0) = x1 </li>
-<li> der(x1) = mu * ((1 - x0 * x0) * x1) - x0</li>
-</ul>
-<img src="plot_states.png">
-<br/>
-The figure shows the solution computed with Silver 
-for start values x0 = 2, x1 = 0, mu = 1.
-
-<h2><a name="license">License conditions</a></h2>
-The FMU is provided by QTronic under the
-<a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a>.
-</body>
-</html>
-

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/model.png


+ 0 - 33
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/modelDescription_cs.xml

@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="van der Pol oscillator"
-  modelIdentifier="vanDerPol"
-  guid="{8c4e810f-3da3-4a00-8276-176fa3c9f000}"
-  numberOfContinuousStates="2"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="x0" valueReference="0" description="the first state">
-     <Real start="2" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x0)" valueReference="1">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="x1" valueReference="2" description="the second state">
-     <Real start="0" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x1)" valueReference="3">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="mu" valueReference="4" variability="parameter">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-<Implementation>
-  <CoSimulation_StandAlone>
-    <Capabilities
-      canHandleVariableCommunicationStepSize="true"
-      canHandleEvents="true"/>
-  </CoSimulation_StandAlone>
-</Implementation>
-</fmiModelDescription>

+ 0 - 26
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/modelDescription_me.xml

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="1.0"
-  modelName="van der Pol oscillator"
-  modelIdentifier="vanDerPol"
-  guid="{8c4e810f-3da3-4a00-8276-176fa3c9f000}"
-  numberOfContinuousStates="2"
-  numberOfEventIndicators="0">
-<ModelVariables>
-  <ScalarVariable name="x0" valueReference="0" description="the first state">
-     <Real start="2" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x0)" valueReference="1">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="x1" valueReference="2" description="the second state">
-     <Real start="0" fixed="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x1)" valueReference="3">
-     <Real/>
-  </ScalarVariable> 
-  <ScalarVariable name="mu" valueReference="4" variability="parameter">
-     <Real start="1" fixed="true"/>
-  </ScalarVariable>
-</ModelVariables>
-</fmiModelDescription>

BIN
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/plot_states.png


+ 0 - 74
examples/mass_spring_damper/fmusdk/fmu10/src/models/vanDerPol/vanDerPol.c

@@ -1,74 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Copyright QTronic GmbH. All rights reserved.
- * Sample implementation of an FMU - the Van der Pol oscillator.
- * See http://en.wikipedia.org/wiki/Van_der_Pol_oscillator
- *  
- *   der(x0) = x1
- *   der(x1) = mu * ((1 - x0 ^ 2) * x1) - x0;
- *
- *   start values: x0=2, x1=0, mue=1
- * ---------------------------------------------------------------------------*/
-
-// define class name and unique id
-#define MODEL_IDENTIFIER vanDerPol
-#define MODEL_GUID "{8c4e810f-3da3-4a00-8276-176fa3c9f000}"
-
-// define model size
-#define NUMBER_OF_REALS 5
-#define NUMBER_OF_INTEGERS 0
-#define NUMBER_OF_BOOLEANS 0
-#define NUMBER_OF_STRINGS 0
-#define NUMBER_OF_STATES 2
-#define NUMBER_OF_EVENT_INDICATORS 0
-
-// include fmu header files, typedefs and macros
-#include "fmuTemplate.h"
-
-// define all model variables and their value references
-// conventions used here:
-// - if x is a variable, then macro x_ is its variable reference
-// - the vr of a variable is its index in array  r, i, b or s
-// - if k is the vr of a real state, then k+1 is the vr of its derivative
-#define x0_     0
-#define der_x0_ 1
-#define x1_     2
-#define der_x1_ 3
-#define mu_     4
-
-// define state vector as vector of value references
-#define STATES { x0_, x1_ }
-
-// called by fmiInstantiateModel
-// Set values for all variables that define a start value
-// Settings used unless changed by fmiSetX before fmiInitialize
-void setStartValues(ModelInstance *comp) {
-    r(x0_) = 2;
-    r(x1_) = 0;
-    r(mu_) = 1;
-}
-
-// called by fmiInitialize() after setting eventInfo to defaults
-// Used to set the first time event, if any.
-void initialize(ModelInstance* comp, fmiEventInfo* eventInfo) {
-}
-
-// called by fmiGetReal, fmiGetContinuousStates and fmiGetDerivatives
-fmiReal getReal(ModelInstance* comp, fmiValueReference vr){
-    switch (vr) {
-        case x0_     : return r(x0_);
-        case x1_     : return r(x1_);
-        case der_x0_ : return r(x1_);
-        case der_x1_ : return r(mu_) * ((1.0-r(x0_)*r(x0_))*r(x1_)) - r(x0_);
-        case mu_     : return r(mu_);
-        default: return 0;
-    }
-}
-
-// Used to set the next time event, if any.
-void eventUpdate(fmiComponent comp, fmiEventInfo* eventInfo) {
-} 
-
-// include code that implements the FMI based on the above definitions
-#include "fmuTemplate.c"
-
-

+ 0 - 288
examples/mass_spring_damper/fmusdk/fmu20/src/model_exchange/main.c

@@ -1,288 +0,0 @@
-/* ------------------------------------------------------------------------- 
- * main.c
- * Implements simulation of a single FMU instance using the forward Euler
- * method for numerical integration.
- * Command syntax: see printHelp()
- * Simulates the given FMU from t = 0 .. tEnd with fixed step size h and 
- * writes the computed solution to file 'result.csv'.
- * The CSV file (comma-separated values) may e.g. be plotted using 
- * OpenOffice Calc or Microsoft Excel. 
- * This program demonstrates basic use of an FMU.
- * Real applications may use advanced numerical solvers instead, means to 
- * exactly locate state events in time, graphical plotting utilities, support 
- * for co-execution of many FMUs, stepping and debug support, user control
- * of parameter and start values etc. 
- * All this is missing here.
- *
- * Revision history
- *  07.03.2014 initial version released in FMU SDK 2.0.0
- *
- * Free libraries and tools used to implement this simulator:
- *  - header files from the FMU specification
- *  - libxml2 XML parser, see http://xmlsoft.org
- *  - 7z.exe 4.57 zip and unzip tool, see http://www.7-zip.org
- * Author: Adrian Tirea
- * Copyright QTronic GmbH. All rights reserved.
- * -------------------------------------------------------------------------*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "fmi2.h"
-#include "sim_support.h"
-
-FMU fmu; // the fmu to simulate
-
-// simulate the given FMU using the forward euler method.
-// time events are processed by reducing step size to exactly hit tNext.
-// state events are checked and fired only at the end of an Euler step. 
-// the simulator may therefore miss state events and fires state events typically too late.
-static int simulate(FMU* fmu, double tEnd, double h, fmi2Boolean loggingOn, char separator,
-                    int nCategories, char **categories) {
-    int i;
-    double dt, tPre;
-    fmi2Boolean timeEvent, stateEvent, stepEvent, terminateSimulation;
-    double time;
-    int nx;                          // number of state variables
-    int nz;                          // number of state event indicators
-    double *x = NULL;                // continuous states
-    double *xdot = NULL;             // the corresponding derivatives in same order
-    double *z = NULL;                // state event indicators
-    double *prez = NULL;             // previous values of state event indicators
-    fmi2EventInfo eventInfo;         // updated by calls to initialize and eventUpdate
-    ModelDescription* md;            // handle to the parsed XML file
-    const char* guid;                // global unique id of the fmu
-    fmi2CallbackFunctions callbacks = {fmuLogger, calloc, free, NULL, fmu}; // called by the model during simulation
-    fmi2Component c;                 // instance of the fmu
-    fmi2Status fmi2Flag;             // return code of the fmu functions
-    fmi2Real tStart = 0;             // start time
-    fmi2Boolean toleranceDefined = fmi2False; // true if model description define tolerance
-    fmi2Real tolerance = 0;          // used in setting up the experiment
-    fmi2Boolean visible = fmi2False; // no simulator user interface
-    const char *instanceName;        // instance name
-    char *fmuResourceLocation = getTempResourcesLocation(); // path to the fmu resources as URL, "file://C:\QTronic\sales"
-    int nSteps = 0;
-    int nTimeEvents = 0;
-    int nStepEvents = 0;
-    int nStateEvents = 0;
-    FILE* file;
-    ValueStatus vs;
-
-    // instantiate the fmu
-    md = fmu->modelDescription;
-    guid = getAttributeValue((Element *)md, att_guid);
-    instanceName = getAttributeValue((Element *)getModelExchange(md), att_modelIdentifier);
-    c = fmu->instantiate(instanceName, fmi2ModelExchange, guid, fmuResourceLocation,
-                        &callbacks, visible, loggingOn);
-    free(fmuResourceLocation);
-    if (!c) return error("could not instantiate model");
-
-    if (nCategories > 0) {
-        fmi2Flag = fmu->setDebugLogging(c, fmi2True, nCategories, categories);
-        if (fmi2Flag > fmi2Warning) {
-            return error("could not initialize model; failed FMI set debug logging");
-        }
-    }
-
-    // allocate memory
-    nx = getDerivativesSize(getModelStructure(md)); // number of continuous states is number of derivatives
-                                                    // declared in model structure
-    nz = getAttributeInt((Element *)md, att_numberOfEventIndicators, &vs); // number of event indicators
-    x    = (double *) calloc(nx, sizeof(double));
-    xdot = (double *) calloc(nx, sizeof(double));
-    if (nz>0) {
-        z    =  (double *) calloc(nz, sizeof(double));
-        prez =  (double *) calloc(nz, sizeof(double));
-    }
-    if ((!x || !xdot) || (nz>0 && (!z || !prez))) return error("out of memory");
-
-    // open result file
-    if (!(file = fopen(RESULT_FILE, "w"))) {
-        printf("could not write %s because:\n", RESULT_FILE);
-        printf("    %s\n", strerror(errno));
-        free (x);
-        free(xdot);
-        free(z);
-        free(prez);
-        return 0; // failure
-    }
-
-    // setup the experiment, set the start time
-    time = tStart;
-    fmi2Flag = fmu->setupExperiment(c, toleranceDefined, tolerance, tStart, fmi2True, tEnd);
-    if (fmi2Flag > fmi2Warning) {
-        return error("could not initialize model; failed FMI setup experiment");
-    }
-
-    // initialize
-    fmi2Flag = fmu->enterInitializationMode(c);
-    if (fmi2Flag > fmi2Warning) {
-        return error("could not initialize model; failed FMI enter initialization mode");
-    }
-    fmi2Flag = fmu->exitInitializationMode(c);
-    if (fmi2Flag > fmi2Warning) {
-        return error("could not initialize model; failed FMI exit initialization mode");
-    }
-
-    // event iteration
-    eventInfo.newDiscreteStatesNeeded = fmi2True;
-    eventInfo.terminateSimulation = fmi2False;
-    while (eventInfo.newDiscreteStatesNeeded && !eventInfo.terminateSimulation) {
-        // update discrete states
-        fmi2Flag = fmu->newDiscreteStates(c, &eventInfo);
-        if (fmi2Flag > fmi2Warning) return error("could not set a new discrete state");
-    }
-
-    if (eventInfo.terminateSimulation) {
-        printf("model requested termination at t=%.16g\n", time);
-    } else {
-        // enter Continuous-Time Mode
-        fmu->enterContinuousTimeMode(c);
-        // output solution for time tStart
-        outputRow(fmu, c, tStart, file, separator, fmi2True);  // output column names
-        outputRow(fmu, c, tStart, file, separator, fmi2False); // output values
-
-        // enter the simulation loop
-        while (time < tEnd) {
-            // get current state and derivatives
-            fmi2Flag = fmu->getContinuousStates(c, x, nx);
-            if (fmi2Flag > fmi2Warning) return error("could not retrieve states");
-            fmi2Flag = fmu->getDerivatives(c, xdot, nx);
-            if (fmi2Flag > fmi2Warning) return error("could not retrieve derivatives");
-
-            // advance time
-            tPre = time;
-            time = min(time+h, tEnd);
-            timeEvent = eventInfo.nextEventTimeDefined && eventInfo.nextEventTime < time;
-            if (timeEvent) time = eventInfo.nextEventTime;
-            dt = time - tPre;
-            fmi2Flag = fmu->setTime(c, time);
-            if (fmi2Flag > fmi2Warning) error("could not set time");
-
-            // perform one step
-            for (i = 0; i < nx; i++) x[i] += dt * xdot[i]; // forward Euler method
-            fmi2Flag = fmu->setContinuousStates(c, x, nx);
-            if (fmi2Flag > fmi2Warning) return error("could not set states");
-            if (loggingOn) printf("Step %d to t=%.16g\n", nSteps, time);
-
-            // check for state event
-            for (i = 0; i < nz; i++) prez[i] = z[i];
-            fmi2Flag = fmu->getEventIndicators(c, z, nz);
-            if (fmi2Flag > fmi2Warning) return error("could not retrieve event indicators");
-            stateEvent = FALSE;
-            for (i=0; i<nz; i++)
-                stateEvent = stateEvent || (prez[i] * z[i] < 0);
-
-            // check for step event, e.g. dynamic state selection
-            fmi2Flag = fmu->completedIntegratorStep(c, fmi2True, &stepEvent, &terminateSimulation);
-            if (fmi2Flag > fmi2Warning) return error("could not complete intgrator step");
-            if (terminateSimulation) {
-                printf("model requested termination at t=%.16g\n", time);
-                break; // success
-            }
-
-            // handle events
-            if (timeEvent || stateEvent || stepEvent) {
-                fmu->enterEventMode(c);
-                if (timeEvent) {
-                    nTimeEvents++;
-                    if (loggingOn) printf("time event at t=%.16g\n", time);
-                }
-                if (stateEvent) {
-                    nStateEvents++;
-                    if (loggingOn) for (i=0; i<nz; i++)
-                        printf("state event %s z[%d] at t=%.16g\n",
-                               (prez[i]>0 && z[i]<0) ? "-\\-" : "-/-", i, time);
-                }
-                if (stepEvent) {
-                    nStepEvents++;
-                    if (loggingOn) printf("step event at t=%.16g\n", time);
-                }
-
-                // event iteration in one step, ignoring intermediate results
-                eventInfo.newDiscreteStatesNeeded = fmi2True;
-                eventInfo.terminateSimulation = fmi2False;
-                while (eventInfo.newDiscreteStatesNeeded && !eventInfo.terminateSimulation) {
-                    // update discrete states
-                    fmi2Flag = fmu->newDiscreteStates(c, &eventInfo);
-                    if (fmi2Flag > fmi2Warning) return error("could not set a new discrete state");
-
-                    // check for change of value of states
-                    if (eventInfo.valuesOfContinuousStatesChanged && loggingOn) {
-                        printf("continuous state values changed at t=%.16g\n", time);
-                    }
-                    if (eventInfo.nominalsOfContinuousStatesChanged && loggingOn){
-                        printf("nominals of continuous state changed  at t=%.16g\n", time);
-                    }
-                }
-                if (eventInfo.terminateSimulation) {
-                    printf("model requested termination at t=%.16g\n", time);
-                    break; // success
-                }
-
-                // enter Continuous-Time Mode
-                fmu->enterContinuousTimeMode(c);
-            } // if event
-            outputRow(fmu, c, time, file, separator, fmi2False); // output values for this step
-            nSteps++;
-        } // while
-    }
-    // cleanup
-    fmu->terminate(c);
-    fmu->freeInstance(c);
-    fclose(file);
-    if (x != NULL) free(x);
-    if (xdot != NULL) free(xdot);
-    if (z != NULL) free(z);
-    if (prez != NULL) free(prez);
-
-    // print simulation summary
-    printf("Simulation from %g to %g terminated successful\n", tStart, tEnd);
-    printf("  steps ............ %d\n", nSteps);
-    printf("  fixed step size .. %g\n", h);
-    printf("  time events ...... %d\n", nTimeEvents);
-    printf("  state events ..... %d\n", nStateEvents);
-    printf("  step events ...... %d\n", nStepEvents);
-
-    return 1; // success
-}
-
-int main(int argc, char *argv[]) {
-    const char* fmuFileName;
-    int i;
-
-    // parse command line arguments and load the FMU
-    // default arguments value
-    double tEnd = 1.0;
-    double h=0.1;
-    int loggingOn = 0;
-    char csv_separator = ',';
-    char **categories = NULL;
-    int nCategories = 0;
-
-    parseArguments(argc, argv, &fmuFileName, &tEnd, &h, &loggingOn, &csv_separator, &nCategories, &categories);
-    loadFMU(fmuFileName);
-
-        // run the simulation
-    printf("FMU Simulator: run '%s' from t=0..%g with step size h=%g, loggingOn=%d, csv separator='%c' ",
-            fmuFileName, tEnd, h, loggingOn, csv_separator);
-    printf("log categories={ ");
-    for (i = 0; i < nCategories; i++) printf("%s ", categories[i]);
-    printf("}\n");
-
-    simulate(&fmu, tEnd, h, loggingOn, csv_separator, nCategories, categories);
-    printf("CSV file '%s' written\n", RESULT_FILE);
-
-    // release FMU
-#if WINDOWS
-    FreeLibrary(fmu.dllHandle);
-#else /* WINDOWS */
-    dlclose(fmu.dllHandle);
-#endif /* WINDOWS */
-    freeModelDescription(fmu.modelDescription);
-    if (categories) free(categories);
-
-    // delete temp files obtained by unzipping the FMU
-    deleteUnzippedFiles();
-
-    return EXIT_SUCCESS;
-}

+ 0 - 60
examples/mass_spring_damper/fmusdk/fmu20/src/models/bouncingBall/modelDescription_me.xml

@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="2.0"
-  modelName="bouncingBall"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f003}"
-  numberOfEventIndicators="1">
-
-<ModelExchange
-  modelIdentifier="bouncingBall">
-  <SourceFiles>
-    <File name="bouncingBall.c"/>
-  </SourceFiles>
-</ModelExchange>
-
-<LogCategories>
-  <Category name="logAll"/>
-  <Category name="logError"/>
-  <Category name="logFmiCall"/>
-  <Category name="logEvent"/>
-</LogCategories>
-
-<ModelVariables>
-  <ScalarVariable name="h" valueReference="0" description="height, used as state"
-                  causality="local" variability="continuous" initial="exact">
-    <Real start="1"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(h)" valueReference="1" description="velocity of ball"
-                  causality="local" variability="continuous" initial="calculated">
-    <Real derivative="1"/>
-  </ScalarVariable>
-  <ScalarVariable name="v" valueReference="2" description="velocity of ball, used as state"
-                  causality="local" variability="continuous" initial="exact">
-    <Real start="0" reinit="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(v)" valueReference="3" description="acceleration of ball"
-                  causality="local" variability="continuous" initial="calculated">
-    <Real derivative="3"/>
-  </ScalarVariable>
-  <ScalarVariable name="g" valueReference="4" description="acceleration of gravity"
-                  causality="parameter" variability="fixed" initial="exact">
-    <Real start="9.81"/>
-  </ScalarVariable>
-  <ScalarVariable name="e" valueReference="5" description="dimensionless parameter"
-                  causality="parameter" variability="tunable" initial="exact">
-    <Real start="0.7" min="0.5" max="1"/>
-  </ScalarVariable>
-</ModelVariables>
-
-<ModelStructure>
-  <Derivatives>
-    <Unknown index="2" />
-    <Unknown index="4" />
-  </Derivatives>
-  <InitialUnknowns>
-    <Unknown index="2"/>
-    <Unknown index="4"/>
-  </InitialUnknowns>
-</ModelStructure>
-
-</fmiModelDescription>

+ 0 - 46
examples/mass_spring_damper/fmusdk/fmu20/src/models/dq/modelDescription_me.xml

@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="2.0"
-  modelName="dq"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f000}"
-  numberOfEventIndicators="0">
-
-<ModelExchange
-  modelIdentifier="dq">
-  <SourceFiles>
-    <File name="dq.c"/>
-  </SourceFiles>
-</ModelExchange>
-
-<LogCategories>
-  <Category name="logAll"/>
-  <Category name="logError"/>
-  <Category name="logFmiCall"/>
-  <Category name="logEvent"/>
-</LogCategories>
-
-<ModelVariables>
-  <ScalarVariable name="x" valueReference="0" description="the only state"
-                  causality="local" variability="continuous" initial="exact">
-    <Real start="1"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x)" valueReference="1"
-                  causality="local" variability="continuous" initial="calculated">
-    <Real derivative="1"/>
-  </ScalarVariable>
-  <ScalarVariable name="k" valueReference="2"
-                  causality="parameter" variability="fixed" initial="exact">
-    <Real start="1"/>
-  </ScalarVariable>
-</ModelVariables>
-
-<ModelStructure>
-  <Derivatives>
-    <Unknown index="2" />
-  </Derivatives>
-  <InitialUnknowns>
-    <Unknown index="2"/>
-  </InitialUnknowns>
-</ModelStructure>
-
-</fmiModelDescription>

+ 0 - 35
examples/mass_spring_damper/fmusdk/fmu20/src/models/inc/modelDescription_me.xml

@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="2.0"
-  modelName="inc"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f008}"
-  numberOfEventIndicators="0">
-
-<ModelExchange
-  modelIdentifier="inc">
-  <SourceFiles>
-    <File name="inc.c"/>
-  </SourceFiles>
-</ModelExchange>
-
-<LogCategories>
-  <Category name="logAll"/>
-  <Category name="logError"/>
-  <Category name="logFmiCall"/>
-  <Category name="logEvent"/>
-</LogCategories>
-
-<ModelVariables>
-  <ScalarVariable name="counter" valueReference="0" description="counts the seconds"
-                  causality="output" variability="discrete" initial="exact">
-     <Integer start="1"/>
-  </ScalarVariable>
-</ModelVariables>
-
-<ModelStructure>
-  <Outputs>
-    <Unknown index="1" />
-  </Outputs>
-</ModelStructure>
-
-</fmiModelDescription>

+ 0 - 71
examples/mass_spring_damper/fmusdk/fmu20/src/models/values/modelDescription_me.xml

@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="2.0"
-  modelName="values"
-  guid="{8c4e810f-3df3-4a00-8276-176fa3c9f004}"
-  numberOfEventIndicators="0">
-
-<ModelExchange
-  modelIdentifier="values">
-  <SourceFiles>
-    <File name="values.c"/>
-  </SourceFiles>
-</ModelExchange>
-
-<LogCategories>
-  <Category name="logAll"/>
-  <Category name="logError"/>
-  <Category name="logFmiCall"/>
-  <Category name="logEvent"/>
-</LogCategories>
-
-<ModelVariables>
-  <ScalarVariable name="x" valueReference="0" description="used as continuous state"
-                  causality="local" variability="continuous" initial="exact">
-    <Real start="1"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x)" valueReference="1" description="time derivative of x"
-                  causality="local" variability="continuous" initial="calculated">
-    <Real derivative="1"/>
-  </ScalarVariable>
-  <ScalarVariable name="int_in" valueReference="0" description="integer input"
-                  causality="input" variability="discrete">
-    <Integer start="2"/>
-  </ScalarVariable>
-  <ScalarVariable name="int_out" valueReference="1" description="index in string array 'month'"
-                  causality="output" variability="discrete" initial="exact">
-    <Integer start="0"/>
-  </ScalarVariable>
-  <ScalarVariable name="bool_in" valueReference="0" description="boolean input"
-                  causality="input" variability="discrete">
-    <Boolean start="true"/>
-  </ScalarVariable>
-  <ScalarVariable name="bool_out" valueReference="1" description="boolean output"
-                  causality="output" variability="discrete" initial="exact">
-    <Boolean start="false"/>
-  </ScalarVariable>
-  <ScalarVariable name="string_in" valueReference="0" description="string input"
-                  causality="input" variability="discrete">
-    <String start="QTronic"/>
-  </ScalarVariable>
-  <ScalarVariable name="string_out" valueReference="1" description="the string month[int_out]"
-                  causality="output" variability="discrete" initial="exact">
-    <String start="jan"/>
-  </ScalarVariable>
-</ModelVariables>
-
-<ModelStructure>
-  <Outputs>
-    <Unknown index="4" />
-    <Unknown index="6" />
-    <Unknown index="8" />
-  </Outputs>
-  <Derivatives>
-    <Unknown index="2" />
-  </Derivatives>
-  <InitialUnknowns>
-    <Unknown index="2"/>
-  </InitialUnknowns>
-</ModelStructure>
-
-</fmiModelDescription>

+ 0 - 56
examples/mass_spring_damper/fmusdk/fmu20/src/models/vanDerPol/modelDescription_me.xml

@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<fmiModelDescription
-  fmiVersion="2.0"
-  modelName="van der Pol oscillator"
-  guid="{8c4e810f-3da3-4a00-8276-176fa3c9f000}"
-  numberOfEventIndicators="0">
-
-<ModelExchange
-  modelIdentifier="vanDerPol">
-  <SourceFiles>
-    <File name="vanDerPol.c"/>
-  </SourceFiles>
-</ModelExchange>
-
-<LogCategories>
-  <Category name="logAll"/>
-  <Category name="logError"/>
-  <Category name="logFmiCall"/>
-  <Category name="logEvent"/>
-</LogCategories>
-
-<ModelVariables>
-  <ScalarVariable name="x0" valueReference="0" description="the first state"
-                  causality="local" variability="continuous" initial="exact">
-    <Real start="2"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x0)" valueReference="1"
-                  causality="local" variability="continuous" initial="calculated">
-    <Real derivative="1"/>
-  </ScalarVariable> 
-  <ScalarVariable name="x1" valueReference="2" description="the second state"
-                  causality="local" variability="continuous" initial="exact">
-    <Real start="0"/>
-  </ScalarVariable>
-  <ScalarVariable name="der(x1)" valueReference="3"
-                  causality="local" variability="continuous" initial="calculated">
-    <Real derivative="3"/>
-  </ScalarVariable> 
-  <ScalarVariable name="mu" valueReference="4" causality="parameter"
-                  variability="fixed" initial="exact">
-    <Real start="1"/>
-  </ScalarVariable>
-</ModelVariables>
-
-<ModelStructure>
-  <Derivatives>
-    <Unknown index="2" />
-    <Unknown index="4" />
-  </Derivatives>
-  <InitialUnknowns>
-    <Unknown index="2"/>
-    <Unknown index="4"/>
-  </InitialUnknowns>
-</ModelStructure>
-
-</fmiModelDescription>