Skip to content

Commit

Permalink
Merge branch 'master' into tearing
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaeuber committed Aug 4, 2015
2 parents 2138055 + 7d07b6b commit 738aa2c
Show file tree
Hide file tree
Showing 579 changed files with 9,271 additions and 11,759 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
*.so
*_info.json
*.fail_log
/failed.*
difftool/lex.yy.c
openmodelica/bootstrapping/CodegenC.*
openmodelica/bootstrapping/CodegenUtil.tpl
Expand Down
33 changes: 31 additions & 2 deletions Makefile
Expand Up @@ -20,6 +20,10 @@ flatteningPlanarMechanics.log \
TestMedia.log \
cppruntime.log \
cppruntimeHpcom.log \
cppruntimeFMU1.log \
cppruntimeFMU2.log \
cppruntimeUmfpack.log \
cppruntimeStaticLinking.log \
taskGraph.log \
debugDumps.log \
dumpCruntime.log \
Expand Down Expand Up @@ -144,7 +148,8 @@ fmi_cs_st.log \
uncertainties.log \
scodeinst.log \
xml.log \
xogeny.log
xogeny.log \
openmodelicadiff.log

.PHONY : all omc-diff ReferenceFiles failingtest test fast fast.logs $(FASTLOGS) $(SLOWLOGS) $(SIMULATIONLOGS) slow.logs threaded

Expand Down Expand Up @@ -368,6 +373,18 @@ cppruntime.log: omc-diff
cppruntimeHpcom.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/hpcom -f Makefile test > $@
@echo $@ done
cppruntimeFMU1.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile test > $@
@echo $@ done
cppruntimeFMU2.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/fmu/modelExchange/2.0 -f Makefile test > $@
@echo $@ done
cppruntimeUmfpack.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/umfpack -f Makefile test > $@
@echo $@ done
cppruntimeStaticLinking.log: omc-diff
$(MAKE) -j1 -C openmodelica/cppruntime/staticLinking -f Makefile test > $@
@echo $@ done
linearization.log: omc-diff
$(MAKE) -C openmodelica/linearization -f Makefile test > $@
@echo $@ done
Expand Down Expand Up @@ -516,6 +533,9 @@ modelica3d.log: omc-diff
hummod.log: omc-diff
$(MAKE) -C simulation/libraries/3rdParty/HumMod -f Makefile test > $@
@echo $@ done
openmodelicadiff.log: omc-diff
$(MAKE) -C openmodelica/diff -f Makefile test > $@
@echo $@ done

failingtest: omc-diff
cd mofiles; $(MAKE) -f Makefile failingtest; \
Expand Down Expand Up @@ -567,6 +587,10 @@ clean_g_2 :
$(MAKE) -C metamodelica/meta -f Makefile clean
$(MAKE) -C openmodelica/cppruntime -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/hpcom -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/fmu/modelExchange/1.0 -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/fmu/modelExchange/2.0 -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/umfpack -f Makefile clean
$(MAKE) -C openmodelica/cppruntime/staticLinking -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 Expand Up @@ -643,8 +667,13 @@ git-sanity-check: git-clean
find -name "*.a" >> invalid-files.log
find -name "*.mat" >> invalid-files.log
find -name "*.csv" >> invalid-files.log
sort invalid-files.log > invalid-files.sorted
(find -type f -executable -exec file -i '{}' ";" | grep -s charset=binary >> invalid-files.log) || true
sort invalid-files.log | grep -v runtest.db > invalid-files.sorted
sort .gitvalidfiles > .gitvalidfiles.sorted
comm --check-order -23 invalid-files.sorted .gitvalidfiles.sorted > invalid-files.log
cat invalid-files.log
test ! -s invalid-files.log
for commit in `git rev-list origin/master..HEAD`; do \
test 50 -ge "`git log --format="%s" $$commit~1..$$commit | wc -c`" || (echo "$$commit has a too long commit summary (leave an empty line after the first if it is not part of the summary)"; git log $$commit~1..$$commit; false);\
test 72 -ge "`git log --format="%b" $$commit~1..$$commit | wc -L`" || (echo "$$commit has too long commit lines (max 72 characters per line)"; git log $$commit~1..$$commit; false);\
done
21 changes: 11 additions & 10 deletions flattening/modelica/algorithms-functions/Makefile
Expand Up @@ -98,6 +98,7 @@ TestGravityAcceleration.mo \
TupleSingleAssign.mo \
tupleSubset.mo \
UnusedInput.mo \
UnknownDimensionFunctionCall.mo \
Vectorizable1.mo \
Vectorizable3.mo \
Vectorizable5.mo \
Expand All @@ -109,9 +110,9 @@ WhenPriority.mo \
WhenStatement1.mo \
WhenStatement2.mo \
WhenStatement3.mo \
While.mo
While.mo

# test that currently fail. Move up when fixed.
# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES=\
AssignmentFunctionMultiple2.mo \
Expand All @@ -131,7 +132,7 @@ Vectorizable2.mo
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
Makefile
Makefile

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

Expand All @@ -156,7 +157,7 @@ test :
@echo
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)
Expand All @@ -165,14 +166,14 @@ clean :
# 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:
# 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 $(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
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest :
@echo
@echo Running failing tests:
Expand Down
@@ -0,0 +1,117 @@
// status: correct

package Modelica_Noise
package Math
package Random
package Generators
package Xorshift64star
extends Interfaces.PartialGenerator(final nState = 2);

redeclare function extends initialState
protected
Real r;
constant Integer p = 10;
algorithm
if localSeed == 0 and globalSeed == 0 then
state := {126247697, globalSeed};
else
state := {localSeed, globalSeed};
end if;
for i in 1:p loop
(r, state) := random(state);
end for;
end initialState;

redeclare function extends random
external "C" ModelicaRandom_xorshift64star(stateIn, stateOut, result) annotation(Include = "
#include <stdint.h>
#define ModelicaRandom_INVM64 5.42101086242752217004e-20 /* = 2^(-64) */
#define ModelicaRandom_RAND(INT64) ( (int64_t)(INT64) * ModelicaRandom_INVM64 + 0.5 )
void ModelicaRandom_xorshift64star(int state_in[], int state_out[], double* y) {
union s_tag {
int32_t s32[2];
uint64_t s64;
} s;
int i;
uint64_t x;
for (i=0; i<sizeof(s)/sizeof(uint32_t); i++) {
s.s32[i] = state_in[i];
}
x = s.s64;
/* The actual algorithm */
x ^= x >> 12; /* a */
x ^= x << 25; /* b */
x ^= x >> 27; /* c */
#if defined(_MSC_VER)
x = x * 2685821657736338717i64;
#else
x = x * 2685821657736338717LL;
#endif
/* Convert outputs */
s.s64 = x;
for (i=0; i<sizeof(s)/sizeof(uint32_t); i++) {
state_out[i] = s.s32[i];
}
*y = ModelicaRandom_RAND(x);
}
");
end random;
end Xorshift64star;
end Generators;

package Interfaces
partial package PartialGenerator
constant Integer nState = 1;

replaceable partial function initialState
input Integer localSeed;
input Integer globalSeed;
output Integer[nState] state;
end initialState;

replaceable partial function random
input Integer[nState] stateIn;
output Real result;
output Integer[nState] stateOut;
end random;
end PartialGenerator;
end Interfaces;
end Random;
end Math;
end Modelica_Noise;

function f
input Integer i[2];
output Real r;
protected
Integer io[:]; // : here is the culprit
algorithm
(r,io) := Modelica_Noise.Math.Random.Generators.Xorshift64star.random(i);
end f;

model M
constant Real r = f({1,2});
end M;

// Result:
// function Modelica_Noise.Math.Random.Generators.Xorshift64star.random
// input Integer[2] stateIn;
// output Real result;
// output Integer[2] stateOut;
//
// external "C" ModelicaRandom_xorshift64star(stateIn, stateOut, result);
// end Modelica_Noise.Math.Random.Generators.Xorshift64star.random;
//
// function f
// input Integer[2] i;
// output Real r;
// protected Integer[:] io;
// algorithm
// (r, io) := Modelica_Noise.Math.Random.Generators.Xorshift64star.random({i[1], i[2]});
// end f;
//
// class M
// constant Real r = 0.2575342903011664;
// end M;
// endResult
33 changes: 33 additions & 0 deletions flattening/modelica/connectors/EnumArrayConnector.mo
@@ -0,0 +1,33 @@
// name: EnumArrayConnector
// keywords: connect enum array
// status: correct
//
// Tests that connectors containing arrays with enum dimensions work correctly.
//

model EnumArrayConnector
type E = enumeration(a, b);

connector C
Real e;
flow Real f;
stream Real s[E];
end C;

model B
C c;
end B;

B b;
end EnumArrayConnector;

// Result:
// class EnumArrayConnector
// Real b.c.e;
// Real b.c.f;
// Real b.c.s[EnumArrayConnector.E.a];
// Real b.c.s[EnumArrayConnector.E.b];
// equation
// b.c.f = 0.0;
// end EnumArrayConnector;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/connectors/Makefile
Expand Up @@ -45,6 +45,7 @@ ConnectorSubtypeComp.mo \
ConnectTheSameConnector.mo \
ConnectTwoSources.mo \
ConnectTypes.mo \
EnumArrayConnector.mo \
EqualityConstraintLookup1.mo \
HeatTank.mo \
HeatTankExpanded.mo \
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/mosfiles/UnusedVariable.mos
Expand Up @@ -17,6 +17,6 @@ translateModel(M);getErrorString();
// true
// false
// "[<interactive>:4:3-4:9:writable] Error: Variable y is not referenced in any equation (possibly after symbolic manipulations).
// Error: Internal error pre-optimization module clockPartitioning failed.
// Error: pre-optimization module clockPartitioning failed.
// "
// endResult
25 changes: 18 additions & 7 deletions flattening/modelica/statemachines/ConferenceTut1.mo
Expand Up @@ -34,13 +34,24 @@ end ConferenceTut1;
// Result:
// class ConferenceTut1
// Integer i(start = 0);
// output Integer state1.i = i;
// output Integer state2.i = i;
// stateMachine state1
// state state1
// output Integer state1.i;
// equation
// state1.i = 2 + previous(i);
// end state1;
//
// state state2
// output Integer state2.i;
// equation
// state2.i = -1 + previous(i);
// end state2;
// equation
// initialState(state1);
// transition(state1, state2, i > 10, false, true, false, 1);
// transition(state2, state1, i < 1, false, true, false, 1);
// end state1;
// equation
// state1.i = 2 + previous(state1.i);
// state2.i = -1 + previous(state2.i);
// initialState(state1);
// transition(state1, state2, i > 10, false, true, false, 1);
// transition(state2, state1, i < 1, false, true, false, 1);
// i = if activeState(state1) then state1.i else if activeState(state2) then state2.i else previous(i);
// end ConferenceTut1;
// endResult

0 comments on commit 738aa2c

Please sign in to comment.