Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niklwors committed Sep 25, 2015
2 parents 13c1925 + 7e1d026 commit 8049849
Show file tree
Hide file tree
Showing 29 changed files with 1,813 additions and 136 deletions.
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -25,6 +25,7 @@ cppruntimeFMU2.log \
cppruntimeUmfpack.log \
cppruntimeStaticLinking.log \
cppruntimeGenDebugSymbols.log \
cppruntimeHardcodedStartValues.log \
cppruntimeOMEdit.log \
taskGraph.log \
debugDumps.log \
Expand Down Expand Up @@ -398,6 +399,9 @@ cppruntimeStaticLinking.log: omc-diff
cppruntimeGenDebugSymbols.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/genDebugSymbols -f Makefile test > $@
@echo $@ done
cppruntimeHardcodedStartValues.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/hardcodedStartValues -f Makefile test > $@
@echo $@ done
linearization.log: omc-diff
$(MAKE) -C openmodelica/linearization -f Makefile test > $@
@echo $@ done
Expand Down Expand Up @@ -606,6 +610,7 @@ clean_g_2 :
$(MAKE) -C openmodelica/cppruntime/umfpack -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/staticLinking -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/genDebugSymbols -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/hardcodedStartValues -f Makefile clean
$(MAKE) -C openmodelica/cruntime/optimization/basic -f Makefile clean
$(MAKE) -C openmodelica/cruntime/xmlFiles -f Makefile clean
$(MAKE) -C openmodelica/debugDumps -f Makefile clean
Expand Down
39 changes: 39 additions & 0 deletions flattening/modelica/connectors/ConnectArrayCond2.mo
@@ -0,0 +1,39 @@
// name: ConnectArrayCond2
// keywords: connect conditional #3473
// status: correct
//
// Tests connecting deleted conditional array components.
//

connector InConn = input Real;
connector OutConn = output Real;

block Foo
parameter Boolean enabled = false;
InConn x if enabled;
end Foo;

block Src
OutConn x = time;
end Src;

model ConnectArrayCond2
Foo[2] foo(enabled = {true, false});
Src src;
Src src1;
equation
connect(src.x, foo[1].x);
connect(src1.x, foo[2].x);
end ConnectArrayCond2;

// Result:
// class ConnectArrayCond2
// parameter Boolean foo[1].enabled = true;
// Real foo[1].x;
// parameter Boolean foo[2].enabled = false;
// Real src.x = time;
// Real src1.x = time;
// equation
// foo[1].x = src.x;
// end ConnectArrayCond2;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/connectors/Makefile
Expand Up @@ -18,6 +18,7 @@ Connect17.mo \
Connect18.mo \
ConnectArray1.mo \
ConnectArrayCond.mo \
ConnectArrayCond2.mo \
ConnectEnumArray.mo \
ConnectFlowEffort.mo \
ConnectFlowEffort2.mo\
Expand Down
4 changes: 4 additions & 0 deletions openmodelica/cppruntime/Makefile
Expand Up @@ -42,6 +42,7 @@ umfpack \
fmu \
staticLinking \
genDebugSymbols \
hardcodedStartValues \
outputFormat \
ReferenceFiles \
outputFormat \
Expand All @@ -57,6 +58,7 @@ FMI_1_0_DIR = fmu/modelExchange/1.0
FMI_2_0_DIR = fmu/modelExchange/2.0
STATIC_LINKING_DIR = staticLinking
DEBUG_SYMBOLS_DIR = genDebugSymbols
HARDCODED_START_VALUES_DIR = hardcodedStartValues
OUTPUT_FORMAT_DIR = outputFormat
OMEDIT_DIR = omedit

Expand All @@ -75,6 +77,7 @@ test:
@$(MAKE) -C $(HPCOM_FMI_1_0_DIR)
@$(MAKE) -C $(STATIC_LINKING_DIR)
@$(MAKE) -C $(DEBUG_SYMBOLS_DIR)
@$(MAKE) -C $(HARDCODED_START_VALUES_DIR)
@$(MAKE) -C $(OUTPUT_FORMAT_DIR)
@$(MAKE) -C $(OMEDIT_DIR)

Expand All @@ -90,6 +93,7 @@ clean :
@$(MAKE) -C $(HPCOM_FMI_1_0_DIR) clean
@$(MAKE) -C $(STATIC_LINKING_DIR) clean
@$(MAKE) -C $(DEBUG_SYMBOLS_DIR) clean
@$(MAKE) -C $(HARDCODED_START_VALUES_DIR) clean
@$(MAKE) -C $(OUTPUT_FORMAT_DIR) clean
@$(MAKE) -C $(OMEDIT_DIR) clean

Expand Down
Expand Up @@ -9,6 +9,7 @@ setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("CoupledClutches.fmu"); getErrorString();
loadFile("CoupledClutches_me_FMU.mo"); getErrorString();
simulate(CoupledClutches_me_FMU, numberOfIntervals=150, variableFilter="J1_w1|J2_w1|J3_w1|J4_w1"); getErrorString();
Expand Down
Expand Up @@ -8,6 +8,7 @@ setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("cranes.mo"); getErrorString();
translateModelFMU(cranes.crane); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
//importFMU("cranes_crane.fmu", "<default>", 6, false, true); getErrorString();
importFMU("cranes_crane.fmu", "<default>"); getErrorString();
loadFile("cranes_crane_me_FMU.mo"); getErrorString();
Expand All @@ -27,6 +28,8 @@ val(prismatic_v, 1);
// ""
// "SimCode: The model cranes.crane has been translated to FMU"
// ""
// true
// ""
// "cranes_crane_me_FMU.mo"
// ""
// true
Expand Down Expand Up @@ -64,6 +67,6 @@ val(prismatic_v, 1);
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1695:3-1695:195:writable] Warning: Parameter world_z_label_cylinders_2__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:1696:3-1696:195:writable] Warning: Parameter world_z_label_cylinders_3__shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
// "
// 0.9493545677180412
// 0.3948240973749629
// 0.9493545676148136
// 0.3948240567413477
// endResult
Expand Up @@ -23,6 +23,7 @@ end DIC;
translateModelFMU(DIC); getErrorString();

loadModel(Modelica); getErrorString();
setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("DIC.fmu"); getErrorString();
loadFile("DIC_me_FMU.mo"); getErrorString();
simulate(DIC_me_FMU); getErrorString();
Expand All @@ -41,6 +42,8 @@ val(y2, 1);
// ""
// true
// ""
// true
// ""
// "DIC_me_FMU.mo"
// ""
// true
Expand All @@ -55,5 +58,5 @@ val(y2, 1);
// 1.0
// 0.0
// -1.0
// 0.0
// -1.397697929617081e-11
// endResult
7 changes: 4 additions & 3 deletions openmodelica/cppruntime/fmu/modelExchange/1.0/Makefile
Expand Up @@ -2,11 +2,11 @@ TEST = ../../../../../rtest -v


TESTFILES = \
DIC_FMU1_CPP.mos
DIC_FMU1_CPP.mos \
Crane_FMU1_CPP.mos

FAILINGTESTFILES = \
Crane_FMU1_CPP.mos \
CoupledClutches_FMU1_CPP.mos \
CoupledClutches_FMU1_CPP.mos

DEPENDENCIES = \
*.mo \
Expand All @@ -28,6 +28,7 @@ test:
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -rf $(CLEAN)
@rm *_me_FMU.mo

getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
Expand Down
@@ -0,0 +1,50 @@
// name: Modelica.Fluid.Examples.BranchingDynamicPipes_FMI_1_0
// keywords: simulation MSL Examples FMI-Export FMI-Import
// status: correct
//
// Simulation Results
// Modelica Standard Library
//

loadModel(Modelica, {"3.2.1"}); getErrorString();
setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
translateModelFMU(Modelica.Fluid.Examples.BranchingDynamicPipes); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("Modelica_Fluid_Examples_BranchingDynamicPipes.fmu"); getErrorString();
loadFile("Modelica_Fluid_Examples_BranchingDynamicPipes_me_FMU.mo"); getErrorString();
simulate(Modelica_Fluid_Examples_BranchingDynamicPipes_me_FMU); getErrorString();

resultFile := "Modelica_Fluid_Examples_BranchingDynamicPipes_me_FMU_res.mat";
referenceFile := getEnvironmentVar("REFERENCEFILES") + "/msl32/Modelica.Fluid.Examples.BranchingDynamicPipes.mat";

//val(pipe1_mediums_1__p, 5);
//val(pipe3_flowModel_m_flows_1_, 5);
//val(pipe4_mediums_5__p, 5);
//val(pipe3_flowModel_m_flows_5_, 5);

// Result:
// true
// ""
// true
// ""
// true
// ""
// "SimCode: The model CoupledClutches has been translated to FMU"
// "Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
// "
// "CoupledClutches_me_FMU.mo"
// ""
// true
// ""
// record SimulationResult
// resultFile = "CoupledClutches_me_FMU_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.5, numberOfIntervals = 150, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'CoupledClutches_me_FMU', options = '', outputFormat = 'mat', variableFilter = 'J1_w1|J2_w1|J3_w1|J4_w1', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 3.235409814452836
// 3.382195820527042
// 3.382195822575476
// -5.144123568889825e-06
// endResult
Expand Up @@ -9,6 +9,7 @@ setCommandLineOptions("+simCodeTarget=Cpp"); getErrorString();
loadFile("CoupledClutches.mo"); getErrorString();
translateModelFMU(CoupledClutches, version = "2.0"); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
importFMU("CoupledClutches.fmu"); getErrorString();
loadFile("CoupledClutches_me_FMU.mo"); getErrorString();
simulate(CoupledClutches_me_FMU, numberOfIntervals=150, variableFilter="J1_w1|J2_w1|J3_w1|J4_w1"); getErrorString();
Expand Down
Expand Up @@ -22,6 +22,7 @@ end DIC;
");
translateModelFMU(DIC, version = "2.0"); getErrorString();

setCommandLineOptions("+simCodeTarget=C"); getErrorString();
loadModel(Modelica); getErrorString();
importFMU("DIC.fmu"); getErrorString();
loadFile("DIC_me_FMU.mo"); getErrorString();
Expand All @@ -41,6 +42,8 @@ val(y2, 1);
// ""
// true
// ""
// true
// ""
// "DIC_me_FMU.mo"
// ""
// true
Expand All @@ -54,6 +57,6 @@ val(y2, 1);
// 0.0
// 1.0
// 0.0
// -1.0
// 0.0
// -0.9999999997999998
// 8.602324061413036e-11
// endResult
1 change: 1 addition & 0 deletions openmodelica/cppruntime/fmu/modelExchange/2.0/Makefile
Expand Up @@ -27,6 +27,7 @@ test:
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -rf $(CLEAN)
@rm *_me_FMU.mo

getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
Expand Down
50 changes: 50 additions & 0 deletions openmodelica/cppruntime/hardcodedStartValues/Makefile
@@ -0,0 +1,50 @@
TEST = ../../../rtest -v

TESTFILES = \
Modelica.Fluid.Examples.BranchingDynamicPipes_hardcodedStartValues.mos

# Run make failingtest
FAILINGTESTFILES =


# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
*.mos \
Makefile


CLEAN = `ls | grep -w -v -f deps.tmp`

.PHONY : test testAll clean getdeps failingtest

test:
@echo
@echo Running tests...
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)

# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest:
@echo
@echo Running failing tests...
@echo
@$(TEST) $(FAILINGTESTFILES)

0 comments on commit 8049849

Please sign in to comment.