/[ascend]/trunk/test.py
ViewVC logotype

Diff of /trunk/test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1132 by johnpye, Sun Jan 14 10:40:58 2007 UTC revision 1133 by johnpye, Sun Jan 14 11:51:48 2007 UTC
# Line 118  class TestIntegrator(Ascend): Line 118  class TestIntegrator(Ascend):
118          self.L.load('johnpye/shm.a4c')          self.L.load('johnpye/shm.a4c')
119          M = self.L.findType('shm').getSimulation('sim')          M = self.L.findType('shm').getSimulation('sim')
120          M.setSolver(ascpy.Solver('QRSlv'))          M.setSolver(ascpy.Solver('QRSlv'))
121            P = M.getParameters()
122            M.setParameter('feastol',1e-12)
123          print M.getChildren()          print M.getChildren()
124          assert float(M.x) == 10.0          assert float(M.x) == 10.0
125          assert float(M.v) == 0.0          assert float(M.v) == 0.0
# Line 127  class TestIntegrator(Ascend): Line 129  class TestIntegrator(Ascend):
129          I.setReporter(ascpy.IntegratorReporterNull(I))          I.setReporter(ascpy.IntegratorReporterNull(I))
130          I.setEngine(integratorname);          I.setEngine(integratorname);
131          I.setLinearTimesteps(ascpy.Units("s"), 0.0, t_end, 100);          I.setLinearTimesteps(ascpy.Units("s"), 0.0, t_end, 100);
132          I.setMinSubStep(0.0005); # these limits are required by IDA at present (numeric diff)          I.setMinSubStep(0.0001); # these limits are required by IDA at present (numeric diff)
133          I.setMaxSubStep(0.02);          I.setMaxSubStep(0.1);
134          I.setInitialSubStep(0.001);          I.setInitialSubStep(0.001);
135          I.setMaxSubSteps(200);          I.setMaxSubSteps(200);
136          if(integratorname=='IDA'):          if(integratorname=='IDA'):
137              I.setParameter('autodiff',False)              I.setParameter('autodiff',False)
138            for p in M.getParameters():
139                print p.getName(),"=",p.getValue()
140          I.analyse();          I.analyse();
141          I.solve();          I.solve();
142          print "At end of simulation,"          print "At end of simulation,"

Legend:
Removed from v.1132  
changed lines
  Added in v.1133

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22