コード例 #1
0
    def test_5_radau_uncompressed(self):
        """
        Test two 5th order radau segment indices

        All nodes are:   [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
        Input nodes:     [^  ^  ^  ^  ^  ^  ^  ^  ^  ^   ^   ^]
        Solver nodes:    [   ^  ^  ^  ^  ^     ^  ^  ^   ^   ^]
        Indep nodes:     [^                 ^                 ]
        Of input nodes, solver nodes for fix_initial are: {1, 2, 3, 4, 5, 7, 8, 9, 10, 11}
        The indep node is just the first one: {0, 6}
        """
        p = brach(transcription='radau-ps',
                  num_segments=2,
                  transcription_order=5,
                  compressed=False,
                  solve_segments='forward',
                  run_driver=True)

        state_indeps_comp = p.model.traj0.phases.phase0.indep_states

        self.assertSetEqual(
            set(state_indeps_comp.state_idx_map['x']['solver']),
            {1, 2, 3, 4, 5, 7, 8, 9, 10, 11})
        self.assertSetEqual(set(state_indeps_comp.state_idx_map['x']['indep']),
                            {0, 6})
コード例 #2
0
    def test_5_lgl(self):
        """
        Test one 5th order LGL segment indices

        All nodes are:   [0, 1, 2, 3, 4]
        Input nodes:     [^     ^     ^]
        Solver nodes:    [      ^     ^]
        Of input nodes, solver nodes for fix_initial are: {1, 2}
        The indep node is just the first one: {0}
        """
        p = brach(transcription='gauss-lobatto', num_segments=1, transcription_order=5,
                  compressed=True, solve_segments='forward', run_driver=True)

        state_indeps_comp = p.model.traj0.phases.phase0.indep_states

        self.assertSetEqual(set(state_indeps_comp.state_idx_map['x']['solver']), {1, 2})
        self.assertSetEqual(set(state_indeps_comp.state_idx_map['x']['indep']), {0})
コード例 #3
0
    def test_3_radau(self):
        """
        Test one 3rd order radau segment indices

        All nodes are:   [0, 1, 2, 3]
        Input nodes:     [^  ^  ^  ^]
        Solver nodes:    [   ^  ^  ^]
        Indep nodes:     [^         ]
        Of input nodes, solver nodes for fix_initial are: {1, 2, 3}
        The indep node is just the first one: {0}
        """
        p = brach(transcription='radau-ps', num_segments=1, transcription_order=3,
                  compressed=True, solve_segments='forward', run_driver=True)

        state_indeps_comp = p.model.traj0.phases.phase0.indep_states

        self.assertSetEqual(set(state_indeps_comp.state_idx_map['x']['solver']), {1, 2, 3})
        self.assertSetEqual(set(state_indeps_comp.state_idx_map['x']['indep']), {0})