Code Monkey home page Code Monkey logo

Comments (4)

petercorke avatar petercorke commented on September 23, 2024 2

Hi @zam101 and @MartinGrignard, check out the thread in Issue #18. There is a new implementation of PID on the master branch version.

from bdsim.

petercorke avatar petercorke commented on September 23, 2024 1

Not yet, sorry. The usual trick is to make the d term s/(s+a) where a is another design parameter, set somewhere toward the open loop bandwidth of the plant

from bdsim.

petercorke avatar petercorke commented on September 23, 2024 1

I've been thinking about this and it's much more complex than I initially thought. My previous answer to @zam101 was hasty and not well thought through, it's more complex than I said then. I tried to put some of this down on a wiki page. My main focus with bdsim right now is getting it ready for the forthcoming book, and after that a derivative block and PID block are top of the feature list.

from bdsim.

MartinGrignard avatar MartinGrignard commented on September 23, 2024

Hi @petercorke,
First, thanks for the work done on this wonderful package!
I'm also trying to build a PID controller with it and, following your previous answer that recommends adding a low-pass filter to the derivative term, the expression becomes

$$H(s) = K_p + \frac{K_i}{s} + \frac{K_d s}{1 + \alpha s},$$

where $\alpha = \frac{1}{\omega_0}$ and $\omega_0$ is the cutoff frequency of the system.

Focusing solely on the derivative term, if I write

derivator = bd.LTI_SISO([K_d, 0], [alpha, 1])

I get the exact same error as @zam101:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[29], line 1
----> 1 derivator = bd.LTI_SISO([k_d, 0], [alpha, 1])

File [.../bdsim/run_sim.py:806), in BDSim.blockdiagram..new_method..block_init_wrapper(self, *args, **kwargs)
    804 def block_init_wrapper(self, *args, **kwargs):
--> 806     block = cls(*args, bd=bd, **kwargs)  # call __init__ on the block
    807     return block

File [.../bdsim/blocks/transfers.py:332), in LTI_SISO.__init__(self, N, D, x0, **blockargs)
    330 if x0 is None:
    331     x0 = np.zeros((n,))
--> 332 assert nn <= n, "direct pass through is not supported"
    334 # convert to numpy arrays
    335 N = np.r_[np.zeros((len(D) - len(N),)), np.array(N)]

AssertionError: direct pass through is not supported

Do you have some hints on how I could actually make it work?

from bdsim.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.