Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added var stepping model, only accepts 1,2,3,4,5,6,7,8 all 1-E4 and l…
…oops
- Loading branch information
Showing
3 changed files
with
542 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
cmake_minimum_required (VERSION 2.8.5) | ||
project (var-stepper C CXX) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR on) | ||
|
||
add_definitions(-DLIBXML_STATIC -DFMI_COSIMULATION -DGUID1="{ddd}") | ||
|
||
include(CheckCXXCompilerFlag) | ||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) | ||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) | ||
if(COMPILER_SUPPORTS_CXX11) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
elseif(COMPILER_SUPPORTS_CXX0X) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | ||
else() | ||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") | ||
endif() | ||
|
||
|
||
IF(CMAKE_COMPILER_IS_GNUCC) | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0 -std=c11") | ||
ENDIF(CMAKE_COMPILER_IS_GNUCC) | ||
IF(CMAKE_COMPILER_IS_GNUCXX) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0 -std=c11") | ||
ENDIF(CMAKE_COMPILER_IS_GNUCXX) | ||
|
||
SET(CMAKE_VERBOSE_MAKEFILE ON) | ||
|
||
file(GLOB C_FILES sources/*.c) | ||
file(GLOB CPP_FILES sources/*.cpp) | ||
|
||
add_library(${PROJECT_NAME} SHARED ${C_FILES} ${CPP_FILES}) | ||
|
||
include_directories(sources ../includes/fmi) | ||
|
||
foreach(LETTER ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) | ||
|
||
if(EXISTS "${LETTER}/libstdc++.a") | ||
# message (STATUS "${LETTER}") | ||
set(STDCPP_LIBRARY "${LETTER}/libstdc++.a") | ||
else() | ||
# message (STATUS "${LETTER} ---- not these") | ||
endif() | ||
endforeach() | ||
|
||
message(STATUS "Static linking with libstdc++.a in ${STDCPP_LIBRARY}") | ||
target_link_libraries(${PROJECT_NAME} ${STDCPP_LIBRARY}) | ||
|
||
|
||
#IF(NOT(DEFINED XOSX)) | ||
|
||
if (UNIX) | ||
if(APPLE) | ||
|
||
|
||
SET(PTHREAD_LIBRARY libpthread.dylib) | ||
ELSE() | ||
find_library(PTHREAD_LIBRARY NAMES libpthread.a libpthread.dylib) | ||
|
||
|
||
ENDIF() | ||
ENDIF() | ||
|
||
#target_link_libraries(${PROJECT_NAME} ${PTHREAD_LIBRARY}) | ||
|
||
# I need this: -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic | ||
|
||
if (WIN32) | ||
#windows | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++ -static-libgcc") | ||
endif() | ||
|
||
|
||
if (UNIX) | ||
if(APPLE) | ||
|
||
else() | ||
|
||
|
||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
|
||
endif() | ||
endif() | ||
|
||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES POSITION_INDEPENDENT_CODE ON, PREFIX "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
||
<fmiModelDescription fmiVersion="2.0" modelName="var-stepper" | ||
guid="{8c4e810f-3df3-4a00-8276-176fa3c9f001}" numberOfEventIndicators="0"> | ||
|
||
|
||
<CoSimulation modelIdentifier="watertank-c" | ||
canHandleVariableCommunicationStepSize="true" | ||
canGetAndSetFMUstate="true" | ||
/> | ||
|
||
<LogCategories> | ||
<Category name="logAll" /> | ||
<Category name="logError" /> | ||
<Category name="logFmiCall" /> | ||
<Category name="logEvent" /> | ||
</LogCategories> | ||
|
||
<ModelVariables> | ||
|
||
<!-- ScalarVariable name="maxlevel" valueReference="0" | ||
description="the max tank level" causality="parameter" variability="fixed" | ||
initial="exact"> | ||
<Real start="10" /> | ||
</ScalarVariable> | ||
<ScalarVariable name="minlevel" valueReference="1" | ||
description="the min tank level" causality="parameter" variability="fixed" | ||
initial="exact"> | ||
<Real start="2" /> | ||
</ScalarVariable--> | ||
|
||
<ScalarVariable name="level" valueReference="2" | ||
description="the tank level" causality="output" variability="continuous" | ||
initial="approx"> | ||
<Real start="1" /> | ||
</ScalarVariable> | ||
|
||
<ScalarVariable name="valve" valueReference="4" | ||
description="the tank valve state" causality="input" variability="discrete"> | ||
<Boolean start="0" /> | ||
</ScalarVariable> | ||
</ModelVariables> | ||
|
||
<ModelStructure> | ||
<Outputs> | ||
<Unknown index="1" /> | ||
</Outputs> | ||
<Derivatives> | ||
<Unknown index="1" /> | ||
</Derivatives> | ||
<InitialUnknowns> | ||
<Unknown index="1" /> | ||
</InitialUnknowns> | ||
</ModelStructure> | ||
|
||
</fmiModelDescription> |
Oops, something went wrong.