Skip to content

Commit

Permalink
Modelica_Synchronous testing #3560
Browse files Browse the repository at this point in the history
Added tests for Modelica_Synchronous.Examples.RealSignals.*
  • Loading branch information
bernhard-thiele committed Jan 14, 2016
1 parent d33c699 commit c53b470
Show file tree
Hide file tree
Showing 60 changed files with 1,232 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
85 changes: 85 additions & 0 deletions simulation/libraries/3rdParty/Modelica_Synchronous/Makefile
@@ -0,0 +1,85 @@
# A collection of libraries that can be tested, but are not enabled by default (since they are usually not installed by developers)

TEST = ../../../../rtest -v

TESTFILES = \
Modelica_Synchronous.Examples.Elementary.RealSignals.TimeBasedStep.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.TickBasedStep.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.TimeBasedSine.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.TimeBasedRamp.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.TickBasedRamp.mos \

# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES= \
Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.Sample1.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.Sample2.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.Sample3.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.SampleClocked.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.SampleVectorizedAndClocked.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.SampleWithADeffects.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.HoldWithDAeffects1.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.HoldWithDAeffects2.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.SubSample.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.SuperSample.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.SuperSampleInterpolated.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.ShiftSample.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.BackSample.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClock.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockVectorized.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.UpSample1.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.UpSample2.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToTriggerHold.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToSquareWaveHold.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.UniformNoise.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.FractionalDelay.mos \
Modelica_Synchronous.Examples.Elementary.RealSignals.TickBasedSine \

# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
*.mos \
*.mat \
Makefile \
ReferenceFiles \
simulateAll.sh \
simulateAll.cmd \
sortResults.py


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

.PHONY : test 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 *.mos.txt
@rm -rf $(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,0 +1,47 @@
// name: Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

/*
Fails. step.y should start with value "1" at "t=0", but it starts with a step from "0" to "1"
*/

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep);
compareVars :=
{
"step.y"
};

// loadModel(Modelica,{"3.2.1"});
runScript("common.mos");getErrorString();
//outputFormat :="csv";

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep
// {"step.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.IntegerSignals.TimeBasedStep_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,39 @@
// name: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClock
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClock);
compareVars :=
{"assignClock1.y","unitDelay1.y"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClock
// {"assignClock1.y","unitDelay1.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClock', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClock_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,39 @@
// name: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToSquareWaveHold
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToSquareWaveHold);
compareVars :=
{"sample.y","clockToSquareWave.y"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToSquareWaveHold
// {"sample.y","clockToSquareWave.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToSquareWaveHold', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToSquareWaveHold_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,39 @@
// name: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToTriggerHold
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToTriggerHold);
compareVars :=
{"sample.y","clockToTrigger.y","triggeredSampler.y"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToTriggerHold
// {"sample.y","clockToTrigger.y","triggeredSampler.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToTriggerHold', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockToTriggerHold_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,39 @@
// name: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockVectorized
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockVectorized);
compareVars :=
{"assignClock1.y[1]","assignClock1.y[2]","unitDelay1.y","unitDelay2.y"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockVectorized
// {"assignClock1.y[1]","assignClock1.y[2]","unitDelay1.y","unitDelay2.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockVectorized', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.RealSignals.AssignClockVectorized_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,39 @@
// name: Modelica_Synchronous.Examples.Elementary.RealSignals.BackSample
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.RealSignals.BackSample);
compareVars :=
{"sample.y","shiftSample1.y","backSample1.y"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.RealSignals.BackSample
// {"sample.y","shiftSample1.y","backSample1.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.RealSignals.BackSample', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.RealSignals.BackSample_res.mat
// Files Equal!
// "true
// "
// ""
// endResult
@@ -0,0 +1,39 @@
// name: Modelica_Synchronous.Examples.Elementary.RealSignals.FractionalDelay
// keywords: simulation Modelica_Synchronous examples
// status: correct
//
// Simulation Results
// Modelica_Synchronous
//

runScript("../../common/ModelTestingDefaults.mos"); getErrorString();

modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica_Synchronous.Examples.Elementary.RealSignals.FractionalDelay);
compareVars :=
{"sample.y","fractionalDelay.y"};

runScript("common.mos");getErrorString();

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica_Synchronous.Examples.Elementary.RealSignals.FractionalDelay
// {"sample.y","fractionalDelay.y"}
// "Modelica_Synchronous
// \"\"
// true
// \"Modelica_Synchronous\"
// "
// ""
// Simulation options: startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica_Synchronous.Examples.Elementary.RealSignals.FractionalDelay', options = '', outputFormat = 'mat', variableFilter = 'time|step.y', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica_Synchronous.Examples.Elementary.RealSignals.FractionalDelay_res.mat
// Files Equal!
// "true
// "
// ""
// endResult

0 comments on commit c53b470

Please sign in to comment.