Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GaussLobatto transcription components have duplicate inputs in some cases. #818

Open
1 of 4 tasks
robfalck opened this issue Aug 31, 2022 · 0 comments
Open
1 of 4 tasks

Comments

@robfalck
Copy link
Contributor

Issue Type

  • Bug
  • Enhancement
  • Docs
  • Miscellaneous

Description

The GaussLobatto transcription relies on specifying the states at the discretization nodes, evaluating the ODE at the discretization nodes, and then interpolating the collocating polynomial to the collocation nodes. The GaussLobattoInterleaveComp is then used to make a time-contiguous array of states and whatever ODE outputs are to be sent to the timeseries.

In the case when state rates come from a control, control values are unnecessarily being sent to the interleave comp. This is demonstrated in the double integrator example.

Fixing this should be simple. If the state rate comes from the ODE, only then do we add it to the interleave component.

        src_added = interleave_comp.add_var(f'state_rates:{state_name}', shape,
                                            units=get_rate_units(options['units'], time_units),
                                            disc_src=rate_path_disc, col_src=rate_path_col)
        
        if src_added:
            rate_path_disc, disc_src_idxs = self._get_rate_source_path(state_name,
                                                                       nodes='state_disc',
                                                                       phase=phase)
            phase.connect(rate_path_disc,
                          f'interleave_comp.disc_values:state_rates:{state_name}',
                          src_indices=disc_src_idxs)
        
            rate_path_col, col_src_idxs = self._get_rate_source_path(state_name,
                                                                     nodes='col',
                                                                     phase=phase)
            phase.connect(rate_path_col,
                          f'interleave_comp.col_values:state_rates:{state_name}',
                          src_indices=col_src_idxs)

becomes

            if rate_src_type == 'ode':
                src_added = interleave_comp.add_var(f'state_rates:{state_name}', shape,
                                                    units=get_rate_units(options['units'], time_units),
                                                    disc_src=rate_path_disc, col_src=rate_path_col)

                if src_added:
                    rate_path_disc, disc_src_idxs = self._get_rate_source_path(state_name,
                                                                               nodes='state_disc',
                                                                               phase=phase)
                    phase.connect(rate_path_disc,
                                  f'interleave_comp.disc_values:state_rates:{state_name}',
                                  src_indices=disc_src_idxs)

                    rate_path_col, col_src_idxs = self._get_rate_source_path(state_name,
                                                                             nodes='col',
                                                                             phase=phase)
                    phase.connect(rate_path_col,
                                  f'interleave_comp.col_values:state_rates:{state_name}',
                                  src_indices=col_src_idxs)

In addition, the state interp comp is showing duplicate inputs in that case, since v provides the rate of x.

In this case, we may want to make the interp comp work such that it doesn't pull in this duplicate data unnecessarily.

Example

N/A

Environment

dymos 1.5.1-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant