Skip to content

Commit

Permalink
add test for #3503
Browse files Browse the repository at this point in the history
  • Loading branch information
adrpo committed Oct 12, 2015
1 parent 6707ec8 commit 4b8cd77
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
41 changes: 41 additions & 0 deletions simulation/modelica/synchronous/Bug3503.mos
@@ -0,0 +1,41 @@
// name: Bug3503.mos
// keywords: synchronous features, prefixing of clocks
// status: correct
//

setCommandLineOptions("+std=3.3"); getErrorString();

loadModel(Modelica); getErrorString();
loadFile("ClockedSource.mo"); getErrorString();
loadFile("ClockedModel.mo"); getErrorString();
instantiateModel(ClockedSource); getErrorString();
instantiateModel(ClockedModel); getErrorString();

// Result:
// true
// ""
// true
// ""
// true
// ""
// true
// ""
// "class ClockedSource
// parameter Real dt = 0.1;
// Real u = 1.0;
// output Real ud;
// equation
// ud = sample(time * u, Clock(dt));
// end ClockedSource;
// "
// ""
// "class ClockedModel
// parameter Real cs.dt = 0.1;
// Real cs.u = 1.0;
// Real cs.ud;
// equation
// cs.ud = sample(time * cs.u, Clock(cs.dt));
// end ClockedModel;
// "
// ""
// endResult
3 changes: 3 additions & 0 deletions simulation/modelica/synchronous/ClockedModel.mo
@@ -0,0 +1,3 @@
model ClockedModel
ClockedSource cs;
end ClockedModel;
7 changes: 7 additions & 0 deletions simulation/modelica/synchronous/ClockedSource.mo
@@ -0,0 +1,7 @@
model ClockedSource
parameter Real dt = 0.1;
Real u = 1;
Modelica.Blocks.Interfaces.RealOutput ud;
equation
ud = sample(time*u, Clock(dt));
end ClockedSource;
1 change: 1 addition & 0 deletions simulation/modelica/synchronous/Makefile
@@ -1,6 +1,7 @@
TEST = ../../../rtest -v

TESTFILES = \
Bug3503.mos \
SamplingWithClocks.mos \
subSample.mos \
SynchronousFeatures.ControlledMassBasic.mos \
Expand Down

0 comments on commit 4b8cd77

Please sign in to comment.