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

Added notebook with electric circuit #288

Merged
merged 5 commits into from
Feb 17, 2019
Merged

Added notebook with electric circuit #288

merged 5 commits into from
Feb 17, 2019

Conversation

miguelcocruz
Copy link
Contributor

@miguelcocruz miguelcocruz commented Feb 12, 2019

Related Issue

#202

@miguelcocruz miguelcocruz changed the title Development Added notebook with electric circuit Feb 12, 2019
@ljvmiranda921 ljvmiranda921 requested a review from whzup February 12, 2019 23:37
@ljvmiranda921
Copy link
Owner

Hi @miguelcocruz ! Thank you so much for your contribution! We will be reviewing this over the weekend or next week and merge this once everything is OK!

Have a good day!

cc: @whzup

@miguelcocruz
Copy link
Contributor Author

Hey @ljvmiranda921 ! Thank you for the opportunity!

Copy link
Collaborator

@whzup whzup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @miguelcocruz thanks for this nice PR 🎊:+1:. I really like it 😃.
I have some additions, though:

  • I think it would be prettier to have the function with out kwargs, i.e. instead of:
def cost_function(I, U, R, I_s, v_t = 25.85 / 1000):
    c = abs(U - v_t * np.log(abs(I[:, 0] / I_s)) - R * I[:, 0])
    return c

More like this:

def cost_function(I):
    # Define U, v_t here as constants
    c = abs(U - v_t * np.log(abs(I[:, 0] / I_s)) - R * I[:, 0])
    return c

This way it is clear that it is only a onedimensional optimization. It might even increase the speed of the optimization.

  • It would be nice to have a graph with the cost function and a comparison to another method of finding out the current. I made a screen capture of my TI-Nspire with a solve for this purpose:
    optimization
    You can use this one or if you know something that can solve equations in Python that would be even cooler 😉.

  • The optimization now takes over 18 seconds which is extremely long for just a small solve operation in a 1-dimensional space. Could you try lowering the number of iterations (100 or even 10-20 if that works) and look if this works, too?

Again thanks for the PR. It's nice to have you as a contributor 😄.

Copy link
Collaborator

@whzup whzup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice! 😄 Thank you for your work @miguelcocruz! 💯

@whzup whzup merged commit 5df7cc5 into ljvmiranda921:development Feb 17, 2019
@miguelcocruz
Copy link
Contributor Author

Woohoo, my first PR! 🎊 Thank you @whzup for the suggestions

@ljvmiranda921
Copy link
Owner

ljvmiranda921 commented Feb 18, 2019

Hey, congratulations @miguelcocruz for your first PR! 🎉 🎉
@all-contributors please add @miguelcocruz for docs and examples

@allcontributors
Copy link
Contributor

@ljvmiranda921

I've put up a pull request to add @miguelcocruz! 🎉

ljvmiranda921 pushed a commit that referenced this pull request Feb 28, 2019
Add a new example for the usage of pyswarms. It shows how a simple circuit can
be analyzed by using PSO.

Resolves #202
ljvmiranda921 pushed a commit that referenced this pull request May 1, 2019
Add a new example for the usage of pyswarms. It shows how a simple circuit can
be analyzed by using PSO.

Resolves #202
ljvmiranda921 pushed a commit that referenced this pull request May 1, 2019
Add a new example for the usage of pyswarms. It shows how a simple circuit can
be analyzed by using PSO.

Resolves #202
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

Successfully merging this pull request may close these issues.

3 participants