API reference¶
Note
This is a scaffold. To enable auto-generated API docs from docstrings:
Install
pydae-corein the environment that builds the docs (pip install -e packages/pydae-coreor rely on the.readthedocs.yamlwhich does this automatically on RTD).Flip
autosummary_generate = Trueinconf.py.Uncomment the
autosummaryblock below.
The main public names are:
pydae.core.Builder— builds compiled DAE models from asys_dict.pydae.core.Model— runtime interface for a built model (ini,run,post,get_values).pydae.core.diagnostics— Jacobian health checks and structural analysis helpers.
pydae.core - Core DAE solver engine |
pydae.ssa¶
Created on Wed Sep 5 20:43:46 2018
@author: jmmauricio
- pydae.ssa.ssa.acker(A, B, poles)[source]¶
This function is a copy from the original in: https://github.com/python-control/python-control but it allows to work with complex A and B matrices. It is experimental and the original should be considered
- Bnumpy array_like (complex can be used)
Input matrix of the system
- polesnumpy array_like
Desired eigenvalue locations.
- Returns:
K – Gain such that A - B K has eigenvalues given in p.
- Return type:
numpy array_like
- pydae.ssa.ssa.add_arrow(string, name='arrow', scale=1, angle=0, center_x=0, center_y=0, color='#337ab7')[source]¶
- pydae.ssa.ssa.discretise_time(A, B, dt)[source]¶
Compute the exact discretization of the continuous system A,B.
- Goes from a description
d/dt x(t) = A*x(t) + B*u(t) u(t) = ud[k] for t in [k*dt, (k+1)*dt)
- to the description
xd[k+1] = Ad*xd[k] + Bd*ud[k]
- where
xd[k] := x(k*dt)
Returns: Ad, Bd
from: https://github.com/markwmuller/controlpy/blob/master/controlpy/analysis.py
- pydae.ssa.ssa.dlqr(A, B, Q, R)[source]¶
Solve the discrete time lqr controller.
x[k+1] = A x[k] + B u[k]
cost = sum x[k].T*Q*x[k] + u[k].T*R*u[k]
- pydae.ssa.ssa.eval_ss(system)[source]¶
- Parameters:
system (system class) – object.
- Returns:
A (np.array) – System A matrix.
# DAE system
dx = f(x,y,u) – 0 = g(x,y,u) z = h(x,y,u)
# system linealization
Δdx = Fx*Δx + Fy*Δy + Fu*Δu – 0 = Gx*Δx + Gy*Δy + Gu*Δu Δz = Hx*Δx + Hy*Δy + Hu*Δu
Δy = -inv(Gy)*Gx*Dx - inv(Gy)*Gu*Du
Δdx = Fx*Dx - Fy*inv(Gy*Gx)*Δx - Fy*inv(Gy)*Gu*Δu + Fu*Δu
Δdx = (Fx - Fy*inv(Gy*Gx))*Δx + (Fu - Fy*inv(Gy)*Gu)*Δu
Δz = Hx*Dx + Hy*Δy + Hu*Δu Δz = Hx*Dx - Hy*inv(Gy)*(Gx*Δx) - Hy*inv(Gy)*Gu*Du + Hu*Δu Δz = (Hx - Hy*inv(Gy)*(Gx))*Δx + (Hu - Hy*inv(Gy)*Gu)*Δu
- pydae.ssa.ssa.lead_design(angle, omega, verbose=False)[source]¶
Desing lead lag compensator: G = (T_1*s + 1)/(T_2*s + 1)
alpha = (1+np.sin(angle))/(1-np.sin(angle))
T_2 = 1/(omega*np.sqrt(alpha)) T_1 = alpha*T_2
G_ll = ctrl.tf([T_1,1],[T_2,1])
ctrl.bode_plot(G_ll);
- pydae.ssa.ssa.lqr(A, B, Q, R)[source]¶
Solve the continuous time lqr controller.
dx/dt = A x + B u
cost = integral x.T*Q*x + u.T*R*u
- pydae.ssa.ssa.participation(system, method='kundur')[source]¶
As in PSAT but with the notation from Kundur
- pydae.ssa.ssa.pi_design(a, b, zeta, omega)[source]¶
G = 1/(a*s + b) PI = (K_p + K_i/s) = (K_p*s + K_i)/s -> tf([K_p,K_i],[1,0]) K_i = K_p/T_p T_p = K_p/K_i
Example:
L = 4e-3 R = 0.1
K_p,K_i = pi_design(L,R,1.0,2*np.pi*10)
G_planta = ctrl.tf([1], [L,R]) G_pi = ctrl.tf([K_p,K_i],[1,0])
H = G_planta*G_pi/(1 + G_planta*G_pi) ctrl.bode_plot(H);
- pydae.ssa.ssa.plot_eig(eigenvalues, x_min='', x_max='', y_min='', y_max='', fig='', mark='o', color='', label='')[source]¶
‘ Creates a matplotlib figure from a numpy array of eigenvalues.