3 import static org.junit.Assert.assertTrue;
4 import static org.junit.Assert.fail;
11 import org.apache.commons.math.linear.RealMatrix;
12 import org.junit.Test;
14 public class SimulationTest {
17 public void testSimulate() {
19 FileModelManager m =
new FileModelManager();
21 ReducedModel r =
new ReducedModel();
25 double[] mu = r.params.getRandomParam();
28 RealMatrix res = null;
31 VisualizationData v =
new VisualizationData(r.getGeometry());
32 v.useResult(r.getSimulationResult());
33 v.computeVisualFeatures(
new ColorGenerator());
35 Plotter p =
new Plotter(r.name);
36 p.plotResult(r.getTimes(), res, r);
38 while (p.isVisible()) {
44 }
catch (Exception e) {
51 public void testSimulateAfflinModel() {
53 FileModelManager m =
new FileModelManager(
"./test");
54 m.useModel(
"afflinmodel");
55 ReducedModel r =
new ReducedModel();
60 double[] mu =
new double[] { 0.3, 0.01, 9.81 };
63 double[][] res = r.getOutput();
64 System.out.println(res.length +
" x " + res[0].length +
", times: " + r.getTimes().length);
66 Plotter p =
new Plotter(r.name);
67 p.plotResult(r.getTimes(), res, r);
69 while (p.isVisible()) {
75 }
catch (Exception e) {
Manages models loaded from the file system available via the java.io classes.
Basic methods for plotting results of dynamical sytem simulations.
Main reduced model class.
A container class for all model visual data.
The color generator is used to produce RGBA (RGB+Alpha) values from a given array of floats...