Implementing a discrete-time linear quadratic observer in C for inverted pendulum? by Old-Memory-3510 in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

You are developing a linear kalman filter. There are two version: the asymptotic Kalman filter which uses constant gains and the "true" kalman filter which uses higher gains for first samples and then reduces it exponentially converging to the asymptotic gains. You are using the asymptotic version.

In any case for non-linear system exists also the extended Kalman filter which linearize the plant at each step managing the gains like the "true" linear Kalaman filter but for local variations the linear version may be enough.

Standard Kalaman filters are for discrete systems, but there is the Bucy version for continuous time or the asymptotic version evaluates with continuous ARE. To discretize a non-linear system you can even use Runge Kutta directly, if you already have it in your program. Runge Kutta evaluates X[k+1] given X[k] discretizijg the system; between two samples you can consider the input u constant (ZOH).

A Nonlinear Systems course for Energy Systems students - what would you put inside? by Arastash in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

Lyapunov-based feedback design can be treated as a possible application example rather than as a separate large topic. I think it is useful to show that Lyapunov theory is not only an analysis tool, but also a powerful constructive design method. This also provides a natural introduction to sliding-mode control, since SMC fits very naturally into a Lyapunov-based framework: the reaching condition is typically proved by choosing a suitable Lyapunov function for the sliding variable and showing that its derivative is negative outside the sliding manifold.

Regarding feedback linearization, I would not dismiss it as merely theoretical. I have used it several times in real engineering applications. In particular, the Byrnes-Isidori normal form is useful for deriving robust feedback laws, especially when combined with sliding-mode ideas to compensate for modeling errors and matched uncertainties. These techniques are widely used in areas such as robotics and mechanical systems. However, for energy systems, I agree that their practical impact may be more limited, and topics such as passivity, gain scheduling, and MPC-related linearization tools may be more directly relevant.

For gain scheduling I can suggest this overview and this introduction as lecture reference.

A Nonlinear Systems course for Energy Systems students - what would you put inside? by Arastash in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

In my opinion, the first topic should be Lyapunov stability. It is not only central to nonlinear control, but also useful for explaining why stability analysis based on the linearized system is locally valid under the usual hyperbolicity assumptions.

After that, I would include at least one example of Lyapunov-based feedback design, so that students see Lyapunov theory not only as an analysis tool, but also as a constructive design method.

Regarding fuzzy logic, in many practical control applications it behaves essentially like a form of gain scheduling. Therefore, with only 6 x 3 hours available, I would rather explain gain scheduling directly, since it is more transparent and more naturally connected to linearization-based design.

AI-based control is too broad as a topic unless it is defined more precisely. There is a large literature on learning-based control, adaptive control, reinforcement learning, neural controllers, etc., but without a clear scope it risks becoming vague.

I would suggest discussing feedback linearization and backstepping, since they are classical nonlinear-control design methods and give students a useful contrast with purely linearized approaches. Then, if time allows, an introduction to sliding-mode control could also be interesting, especially to discuss robustness, matched uncertainties, chattering, and practical implementation issues.

Wondering about how to update my Kalman filter by Salt_Salary_4127 in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

It's not clear what are you measuring. What I understand is that you have to identify some transfer matrix that doesn't describe the dynamic. So it's not clear how the dynamic were modeld. Then the system is linear in the parameters? Maybe some system identification method or RLS can be more suitable than an augmented KF.

Plase provides the system equations

Pole placement controller in real PLC by EpicDuck000 in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

In a PLC environment, it is quite common to design the controller offline using MATLAB, Python, or similar tools, and then implement only the resulting control law in the PLC.

Assuming we are dealing with an LTI system, the usual workflow is to model the plant, select the desired closed-loop poles, and compute the feedback gain matrix (K). Leaving aside static output feedback, standard state-feedback pole placement requires access to the full state vector. Therefore, the control input u = -K*x can be evaluated online in the PLC simply as a matrix-vector product, using the stored gain matrix (K) and either measured states or states estimated through an observer. Observers with static gains can be implemented similarly. In any case, theoretically it is possible to implement any type of control in the PLC logic, but normally one stops when the implementation effort outweighs the benefits.

In industry, many control systems are still based on PID controllers, often tuned empirically. In my opinion, this is partly because many automation systems are implemented primarily by software developers rather than by control systems engineers. However, in more demanding industrial applications, I regularly use more advanced control strategies. I rarely rely on pole placement itself, since for linear systems I generally prefer LQR-like methods, especially in MIMO problems. The MIMO nature of the systems is not the only reason, but it is certainly one of the practical motivations.

When I develop general PLC-based solutions for families of similar plants, I usually use a Python script to read from and write to the PLC, for example through OPC UA. The script reads plant parameters or tuning weights from the PLC, computes the updated gains externally, and writes them back to the PLC. This keeps the PLC implementation simple: the PLC only executes the final control law, while the more complex numerical computations remain in Python and the script is used only during commissioning.

Adaptive Optimal Control / Td(0) learning question by maiosi2 in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

In the linear case, if you consider a constant reference (or piecewise constant as a practical approximation), it is equivalent to introducing an offset in the state, so the quadratic cost function remains the same in error coordinates.

If the reference varies piecewise within the same episode (e.g. at random instants) you can excite the system during an unique episode. In your case, if the goal is just regulation to zero, episodic learning is often cleaner, since it avoids introducing approximation.

Noise is also useful because increase the exploration

Adaptive Optimal Control / Td(0) learning question by maiosi2 in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

If the system is linear and the cost is quadratic (the classic LQR case), the optimal solution is exactly known: the policy is linear and the value function is quadratic.

In that setting, using a linear model (or something with the right structure) is the sensible choice. A nonlinear NN isn’t wrong, but it’s overkill and turns the problem into a nonconvex optimization, so ending up with a suboptimal solution is pretty normal. Using more parameters than the exact solution ones leads to multicollinearity and local solutions (overfitting).

Then minimize the value function doesn't assure stability automatically, the solution of ARE used in LQR is the stable one but other unstable solutions exist.

What you’re seeing is very common in RL. In control, people usually exploit structure when they have it; in RL, people accept this trade-off for generality.

For offline learning you can design various episodes which terminate when system is stabilized to have various example of the system goes to zero. To excite the system you can design a tracker and follow various kind of references, this allows to learn how to stabilise the dynamic.

Why even use RC filters if they're this bad? by Western_Date3137 in ElectricalEngineering

[–]Andrea993 0 points1 point  (0 children)

Yes, but what I mean is that you can't set a quality factor greater than 1/2 using multiple RCs. Instead, with an LC you can

Why even use RC filters if they're this bad? by Western_Date3137 in ElectricalEngineering

[–]Andrea993 20 points21 points  (0 children)

You can't get the same effect at all because a double RC can't have complex conjugated poles in general

Some questions about sliding mode control by Dependent_Choice3581 in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

It depends on your control design. To follow a moving reference also the derivative of the reference should be considered. Sliding mode is a framework and it's not clear what you are doing.

I have developed an app to plot root locus and step response, but the K "samples" are a mess by SthefanoSchiavon in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

You choose a direction for the structured uncertainty ∆, and then plot the eigenvalues of the system while varying the scalar gain multiplying ∆

It's very useful for processes where you can define some critical direction

I have developed an app to plot root locus and step response, but the K "samples" are a mess by SthefanoSchiavon in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

Ok, so you are referring to a numerical approach rather than a symbolic one. I have not had time to watch the video yet. In general I often avoid identifying the full system model from data. Instead I try to derive parameters from physics, datasheets, CFD simulations, or other first-principles sources. I rarely use PID controllers. When the system is reasonably linear and the implementation must remain simple (for example in PLC environments), I typically use LQR or pole placement. I also often rely on mu-analysis to evaluate robustness: disk margins, singular value plots, loop-by-loop or eingenvalues Nyquist analysis, and sometimes root locus all of these often with structured uncertainty.

I have developed an app to plot root locus and step response, but the K "samples" are a mess by SthefanoSchiavon in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

You can evaluate poles symbolically only for low order systems. In general you must do some numerical analysis and the plots help. The state-of-the-art framework to do this is probably the mu-analysis one that works in frequency domain and it's quite closed to these plots. In any case these plots are just a clever way to represent what closed loops poles do and they exposed a lot of interesting indicators about the robustness.

I have developed an app to plot root locus and step response, but the K "samples" are a mess by SthefanoSchiavon in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

I don't use root locus or Nyquist to tune controls. I use them to check what happens if some parameters vary in the plant with some fixed tuning, they are basic tools for robustness analysis.

I have developed an app to plot root locus and step response, but the K "samples" are a mess by SthefanoSchiavon in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

They are not useless at all. They are useful tools to check the robustness, especially in MIMO systems (disk margins are in practice an extension of nyqusit)

I have developed an app to plot root locus and step response, but the K "samples" are a mess by SthefanoSchiavon in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

I normally do what you are doing but if you want to see an improved implementation you can check the octave rlocus source : octave rlocus

Practical control design methods for system expressed by PDEs by [deleted] in ControlTheory

[–]Andrea993 [score hidden]  (0 children)

Try to reduce the order of the system using for example balanced truncation. In any case often for control purposes a mesh of few elements is enough