-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Implement substitute
for AbstractSystem
s
#2257
Conversation
How would this work if I want to substitute a subsystem that is deeper than level one? For example, if I want to substitute the following component in the DC motor example? addPI = Blocks.Product() # My new component
substitute(model, Dict(pi_controller.addPI => addPI)) |
Just |
So if there's more than one PI controller in the model, it will change all of them? What if I only want to change one of them? |
This function is not created for that use case. |
In that case, there should probably by something more than just name that identifies the components to substitute since using the name alone could easily lead to problems if the replaced name is used more than once, for potentially different component types, by multiple different component authors. |
The name cannot be used more than once, and component authors don't specify the name. They are set when defining the instance (via I think what you're getting at though is that we should have a form of typing on components, so we can identify all of the components that are the same type. That's a wholly separate thing though which would be nice to have for other reasons as well. |
The substitute function operates recursively, so as I understand it it considers the un-namespaced name of every single subsystem in present in the model? |
That's a good point to clarify. |
Yes, those are valid concerns, but they are just not what this function does. |
No description provided.