Skip to content

Commit

Permalink
Add test case for ticket:4271
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel authored and OpenModelica-Hudson committed Feb 14, 2017
1 parent 3d7d961 commit df58d37
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
15 changes: 8 additions & 7 deletions simulation/modelica/statemachines/Makefile
Expand Up @@ -8,8 +8,9 @@ TicksInState.mos \
TimeInState.mos \
MLS33_17_3_7NA.mos \
DeadEnd.mos \
ticket4271.mos \

# test that currently fail. Move up when fixed.
# test that currently fail. Move up when fixed.
# Run make failingtest
FAILINGTESTFILES = \
SingleState.mos \
Expand All @@ -32,8 +33,8 @@ test:
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(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 @@ -42,11 +43,11 @@ 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

Expand Down
40 changes: 40 additions & 0 deletions simulation/modelica/statemachines/ticket4271.mos
@@ -0,0 +1,40 @@
// name: ticket4271
// keywords: state machines
// status: correct

loadString("
model ticket4271
StateX state1(xfoox=1.0);
StateX state2(xfoox=0.1);
equation
initialState(state1);
transition(state1, state2, true, immediate=false);
transition(state2, state1, true, immediate=false);
end ticket4271;

model StateX
input Real xfoox;
Real y;
equation
y = xfoox * sample(1, Clock(1, 10));
end StateX;
"); getErrorString();
simulate(ticket4271); getErrorString();

val(state1.xfoox); getErrorString();
val(state2.xfoox); getErrorString();

// Result:
// true
// ""
// record SimulationResult
// resultFile = "ticket4271_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'ticket4271', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 1.0
// ""
// 0.1
// ""
// endResult

0 comments on commit df58d37

Please sign in to comment.