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

Allow add_state to be called in the setup method of Phase #259

Closed
robfalck opened this issue Jan 16, 2020 · 0 comments · Fixed by #276
Closed

Allow add_state to be called in the setup method of Phase #259

robfalck opened this issue Jan 16, 2020 · 0 comments · Fixed by #276
Assignees
Labels
enhancement New feature or request

Comments

@robfalck
Copy link
Contributor

Recent updates to OpenMDAO allow inputs/outputs to be specified in configure.
Because of this, we can now in theory associate state variables to be integrated with an ODE system. However, since we want to maintain ODE's as pure OpenMDAO systems with no special Dymos features, we can achieve similar benefits by using a subclassed Phase.

Given an ODE class MyODE, we can implement a Phase that always uses that given ODE as:

class MyPhase(dm.Phase):

    def __init__(self, transcription):
        super(transcription, ode_class=MyODE)

    def setup(self):
        self.add_state('x', targets=['target.path.in.ode'], rate_source='rate.source.path.in.ode', units='m')

Then we can instantiate MyPhase and avoid having to repeat the target, rate source, and possibly units information each time we declare MyPhase. This removes the current DRY principle issue in Dymos where states need to be added with target/source information even though this is generally can be set once and never changed again.

@robfalck robfalck added the enhancement New feature or request label Jan 16, 2020
@robfalck robfalck self-assigned this Feb 10, 2020
@robfalck robfalck mentioned this issue Feb 11, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant