Ejemplo n.º 1
0
 def test_spring(self):
     with open(os.path.join(TEST_DIR, 'Spring.mo'), 'r') as f:
         txt = f.read()
     ast_tree = parser.parse(txt)
     text = gen_sympy.generate(ast_tree, 'Spring')
     with open(os.path.join(TEST_DIR, 'generated/Spring.py'), 'w') as f:
         f.write(text)
     from generated.Spring import Spring as Spring
     e = Spring()
     res = e.simulate(x0=[1, 1])
     self.flush()
Ejemplo n.º 2
0
 def test_estimator(self):
     with open(os.path.join(TEST_DIR, 'Estimator.mo'), 'r') as f:
         txt = f.read()
     ast_tree = parser.parse(txt)
     text = gen_sympy.generate(ast_tree, 'Estimator')
     with open(os.path.join(TEST_DIR, 'generated/Estimator.py'), 'w') as f:
         f.write(text)
     from generated.Estimator import Estimator as Estimator
     e = Estimator()
     res = e.simulate(x0=[1])
     self.flush()
Ejemplo n.º 3
0
    def test_spring(self):
        with open(os.path.join(TEST_DIR, "Spring.mo"), "r") as f:
            txt = f.read()
        ast_tree = parser.parse(txt)
        text = gen_sympy.generate(ast_tree, "Spring")
        with open(os.path.join(TEST_DIR, "generated/Spring.py"), "w") as f:
            f.write(text)
        from generated.Spring import Spring as Spring

        e = Spring()
        res = e.simulate(x0=[1, 1])
        self.flush()
Ejemplo n.º 4
0
    def test_estimator(self):
        with open(os.path.join(TEST_DIR, "Estimator.mo"), "r") as f:
            txt = f.read()
        ast_tree = parser.parse(txt)
        text = gen_sympy.generate(ast_tree, "Estimator")
        with open(os.path.join(TEST_DIR, "generated/Estimator.py"), "w") as f:
            f.write(text)
        from generated.Estimator import Estimator as Estimator

        e = Estimator()
        res = e.simulate(x0=[1])
        self.flush()