コード例 #1
0
    def test_with_default(self):
        prob = om.Problem()
        prob.model.add_subsystem(
            'linear', LinearCombinationComp(a=2.))  # 'b' not specified

        prob.setup()

        prob.set_val('linear.x', 3)

        prob.run_model()
        self.assertEqual(prob.get_val('linear.y'), 7.)
コード例 #2
0
    def test_with_default(self):
        import openmdao.api as om
        from openmdao.test_suite.components.options_feature_lincomb import LinearCombinationComp

        prob = om.Problem()
        prob.model.add_subsystem(
            'linear', LinearCombinationComp(a=2.))  # 'b' not specified

        prob.setup()

        prob.set_val('linear.x', 3)

        prob.run_model()
        self.assertEqual(prob.get_val('linear.y'), 7.)
コード例 #3
0
    def test_with_default(self):
        import openmdao.api as om
        from openmdao.test_suite.components.options_feature_lincomb import LinearCombinationComp

        prob = om.Problem()
        prob.model.add_subsystem('inputs', om.IndepVarComp('x'))
        prob.model.add_subsystem('linear', LinearCombinationComp(a=2.))  # 'b' not specified
        prob.model.connect('inputs.x', 'linear.x')

        prob.setup()

        prob['inputs.x'] = 3

        prob.run_model()
        self.assertEqual(prob['linear.y'], 7.)