Alvin Zou’s Status Report For 2/24

Personal tasks of this week:

Task: Profiling double pendulum swing up with NMPC

Definition: Analyzing results from the double pendulum swing up and performing performance profiling.

Completion: I have conducted some profiling on the performance of the NMPC controller, with results showing that most of the time spent in the pipeline is on solving the QP subproblem. This confirms the hypothesis that we can theoretically achieve a lot of speed up if the QP subproblem is solved using our analog solver.

 

Task: Design review presentation

Definition: Presenting the design review presentation

Completion: The presentation is completed.

 

Task: Formulating NMPC problem and isolating the QP subproblem

Definition: Formulating the NMPC problem for our system mathematically and converting it to a form that can be solved by SQP. After this is achieved, the QP subproblem can then be isolated. This step is to calculate what variables are used in the QP subproblem, so that the analog circuit can be designed to solve the correct subproblem.

Completion: The state update equations have been formulated. Next is converting the equations into a form that can be solved by SQP and then isolating the QP subproblem.

 

Next Steps:

The next step is to continue deriving the mathematical representation of the NMPC problem to eventually isolate the QP subroutine in preparation for replacing it with our analog solver.

Overall progress assessment:

Currently on schedule. Working towards isolation of the digital and analog solver.

Thomas’s Status Report for Feb 24

Personal tasks of this week:

Task: Library-Based NMPC Swing-Up Controller Benchmarking

Definition: Run a performance benchmark on the library-based NMPC swing-up controller, measuring the time it takes to complete each step of solving the NMPC problem, and identify the performance bottleneck of the system.

Completion: The task is completed. We benchmarked the swing-up controller and found that 32ms out of 38ms in each iteration is spent on solving the NLP, which can be accelerated using our proposed analog SQP solver to achieve significant speedup.

Task: Symbolic NLP Formulation of the NMPC Swing-Up Controller

Definition: Symbolically formulate the NMPC Swing-Up controller as an NLP, which acts as the NLP problem we supply to the analog SQP solver on each iteration.

Completion: The task is partially completed. We’ve made substantial progress in deriving the dynamics constraints and symbolic cost function. More work will be done in the next week.

Next Steps:

My next step is to continue working on formulating a symbolic NLP problem of the NMPC swing-up controller. I will also continue to work with Andrew on analog component selection and circuit simulation.

Overall progress assessment:

My progress is on-schedule, as all of my tasks this week have been completed or partially completed.

Team Status Report for Feb 17

Significant risks and risk management:
Risk: Inverted double pendulum simulation has insufficient numerical accuracy for NMPC
Definition: Since running the NMPC controller might require a higher numerical accuracy than simulating the dynamics of the inverted double pendulum system, the numerical accuracy of the system might be insufficient when NMPC is integrated into the symbolic simulation.
Severity: If the numerical accuracy is insufficient, the progress of the whole project would be severely jeopardized, because the system would likely not satisfy NR3 (accuracy).
Resolution: We will try to mitigate the risk by synthesizing a NMPC controller that has sufficient robustness against noise, because numerical inaccuracies can usually be seen as noise from the controller’s perspective.
Changes to the existing design:
There are no significant changes to the existing design as we’ve just started implementation.
Changes to the project schedule:
Similarly, there are no significant changes to the project schedule

Additional Societal Impacts

Part A)

Optimization is a powerful tool of representing real-world problems mathematically, and fast solvers, like the product we aim to deliver, make solving them easier.

Health

Optimization helps make healthcare more efficient and accessible. For example, finding the most efficient distribution of vaccines during a pandemic can be formulated as an optimization problem. Solving this problem quickly can enable more effective control of infectious diseases.

Safety

Optimization helps make vehicles safer to operate. Vehicle control with safety guarantees is a classic application of model predictive control (MPC), which is an optimization problem. Our solver has the potential of solving MPC problems in real-time, which can make vehicle control strategies with stronger safety guarantees practical.

Welfare

Optimization helps distribute scarce resources efficiently. Logistics is another classic application of optimization, which is critical for fulfilling everyday needs, especially during periods of hardship. Solving these problems efficiently ensures that goods and services are delivered where they are most needed.

Part B)

Our analog SQP solver has potentially wide societal implications. This comes from the fact that SQP solvers are used to solve nonlinear optimization problems, which is general class of problems with extensive use cases and applications, spanning from computer science to machine learning to biology and medicine(examples can be found in https://neos-guide.org/case-studies/). Because of the breadth of possible applications, our product solution can potentially affect a large group of people.

In particular for social groups, solving optimization problems can help make management in large organizations more efficient. One example is in the supply chain industry, where creating a supply chain strategy that operates across multiple regions can be formulated into an optimization problem.

Part C)

Our applications in analog optimization have significant implications in terms of the related economic factors. Specifically, this is because each of the systems relating to the production, distribution, and consumption of goods and services are areas that can be optimized to be more efficient, which leads to savings in terms of time and money. Furthermore, optimization enhances the general productivity of our society by making production procedures faster, cleaner, safer, and more efficient. As a result, a productive society leads to more sustainable development and more safer environment.

*In the team report, A was written by Thomas Liao, B was written by Alvin Zou and C was written by Andrew Chong.

Andrew’s Status Report for Feb 17

Personal tasks of this week:

Task: Trade Studies on PCB Manufacturing/Assembly

Definition: There were many considerations in choosing a PCB Manufacturing/Assembly company to manufacture our product. This includes quality, turnaround time, ability to assemble the PCB components, and cost. We considered the following companies: JLCPCB, PCBWay, OshPark, and Colorado PCB Assembly.

Completion: The task is completed.  From our trade study, we were able to determine that PCBWay was the best manufacturer for us. This is because PCBWay generally has good quality, has the ability to both PCB manufacturing and Assembly together, has turnaround + shipping in approximately a week, and offers large discounts if the Assembly service is used. In fact, we found that if the Assembly service is used, the price is actually cheaper than buying a stencil and manually reflowing it ourselves, which can introduce a source of error. Some reasons why we didn’t pick the other companies are as follows: JLCPCB has poor quality, OshPark can only manufacture the PCBs, and Colorado PCB Assembly, while with very high quality and fast turnaround, only offers assembly. While it is possible to combine multiple options, we thought that with the component sourcing to different parts, as well as PCB shipping from the PCB manufacturer to the Assembly, back to us would be worse both logistically and for our schedule.

Task: Preliminary Design for Optimization Prototype

Definition: To ensure that we are able to complete the final prototype of the analog optimization circuit, a smaller, proof-of-concept prototype must be made in order to ensure that our approach is sound.

Completion: The task is completed.  Looking through Sergey’s Thesis, we found that there is a schematic provided for a simple 2-variable equality constraint, a 2-variable inequality constraint, and a cost function constraint (which is just a series of resistors) that we can use as our basis for our preliminary prototype. However, the problem is only for a 2-variable equality constraint. We decided to make a slightly more complex design and make the simplest possible optimization circuit with one equality constraint, one inequality constraint, and one cost function.

Next Steps:

The next steps are to use the tools selected to create a prototype of our simple optimization problem, as detailed in Sergey’s thesis as a proof of concept, then Once the baseline works, we will begin expanding that into creating our first prototype analog circuit that specifically models our double pendulum swingup optimization problem. Once that is done, we will order using PCBway.

Overall progress assessment:

My progress is on-schedule, as all of my tasks this week have been completed.

 

Alvin Zou’s Status Report For 2/17

Personal tasks of this week:

Task: Double pendulum swing up with NMPC

Definition: Building Prototype 2 by creating a double pendulum system, designing a controller to control the system, and visualizing the simulation.

Completion: Currently, I have created the system and designed a controller with Thomas using do-mpc that can successfully swing up the pendulum.

Task: Slides for design review presentation

Definition: Creating the slides for the design review next week with the rest of the team. Also rehearsing for the presentation.

Completion: The presentation is mostly completed. Aim to complete by Sunday.

 

Next Steps:

The completion of P2 has validated the problem can be solved using a software SQP solver. The next step is then to isolate the QP subroutine in preparation for replacing it with our analog solver. Basic profiling should also done on P2 to collect performance data.

Overall progress assessment:

Currently on schedule. P2 is completed.

Thomas’s Status Report for Feb 17

Personal tasks of this week:

Task: Library-Based NMPC Swing-Up Controller Synthesis

Definition: Using an open source library, synthesize a NMPC controller that is capable of swinging up an inverted double pendulum. The purpose of this task is to validate that swinging up the inverted double pendulum is achievable with NMPC with small prediction and control horizons. The implementation must be in Python in order to integrate with the rest of the project.

Completion: The task is completed. We’ve selected do-mpc [1] as our library due to its ease of use. The synthesized NMPC controller is capable of consistently swinging up an inverted double pendulum with a prediction horizon of 3 and a control horizon of 3. However, we will synthesize a controller with longer predilection and control horizons for better robustness against noise.

Next Steps:

My next step is to integrate the NMPC swing-up controller with the symbolic dynamics model, and derive a symbolic NLP problem that corresponds to the NMPC controller. Then I will work on solving the NLP problem by implementing the SQP algorithm, calling an open-source QP solver.

I will also work with Andrew on analog component selection and circuit simulation.

Overall progress assessment:

My progress is on-schedule, as all of my tasks this week have been completed.

References:

[1] https://www.do-mpc.com/en/latest/

Andrew’s Status Report for Feb 10

Personal tasks of this week:

Task: Literature Review

Definition: By studying Sergey’s Thesis more closely, our aim was to look for methods in which we can further flesh out or improve our design.

Completion: The task is completed. By taking a closer look at the thesis, we were able to discover the primary accuracy and performance concerns of the system. These are the nonlinearity of the potentiometers contributing to a decrease in accuracy, as well as the negligence of parasitic capacitance contributing to a decrease in performance. More specifically, in Sergey’s PCB design, due to an oversight in the parasitic capacitance, it caused his system to develop non-stable behavior, which required him to add compensating capacitors to the feedback loop of his op-amps. If these were considered,  the step response could have been significantly improved as shown below.  By learning from mistakes in the original designs like these, we believe that we will be able to achieve solid performance. Furthermore, this research was very helpful in determining which component aspect we should put the most focus on.

Source: https://www.sciencedirect.com/science/article/abs/pii/S0098135414000131

Task: Spice Selection

Definition:  To begin circuit simulation, a spice tool would be required to test the behavior of our preliminary circuits. Considering the wide variety of spice tools available, a detailed review of each of the available products was done.

Completion: The task was completed. We have decided on using Cadence’s PSpice considering its performance, as well as the fact that it is readily available to CMU students. The contender was AltiumSpice, as our PCB design will be in Altium, so it would be easy to integrate. However, we decided against it considering its performance.

Task: Preliminary Part Selection

Definition: Considering our current requirements, a preliminary selection of our main components was needed to determine if we would be able to deliver the desired performance with the required performance and accuracy.

Completion: The task is partially completed. By using the same components that Sergey used as a baseline, we looked for components that had tolerances and performance that was at least as good, or better. Considering the developments in the industry, we were able to make a shortlist of parts that we are considering, but have not determined the specific components we are using yet.

Overall progress assessment:

My progress is on-schedule, as all of my tasks this week have been completed. I will continue working towards completing my Prototype of creating a  circuit simulation of a simple optimization problem.

 

Team Status Report for Feb 10

Significant risks and risk management:

Risk: Inverted double pendulum simulation wouldn’t converge

Definition: Since we are still working on building a simulation for the inverted double pendulum, we do not know whether or not problems like numerical instability or truncation error of the integrator would cause the simulation to not converge, i.e. incapable of settling on a solution.

Severity: If the inverted double pendulum simulation wouldn’t converge, the progress of the whole project would be severely jeopardized, because the simulation is a critical part of Prototype 1, that is swinging up the double pendulum with NMPC in simulation.

Resolution: A step we can take right now is to accelerate our progress towards a testable MVP of the simulation, whose convergence can be validated. Another measure is to study the properties of common numerical integrators and select those with superior convergence properties and are available in our library.

Risk: The analog circuit can’t meet the required tolerances

Definition: This risk has been brought to our attention by our assigned in instructor Thomas Sullivan (Thanks!). It is currently unclear to us what tolerance the analog components will need to have in order to satisfy the 10% solution accuracy required by the accuracy requirement (NR3). This is nontrivial to determine as the accuracy of the whole circuit can’t be easily associated with the accuracy of individual components.

Severity: If the analog circuit can’t meet the required tolerances, the progress of the whole project would be severely jeopardized, because the accuracy requirement (NR3) would not be satisfied.

Resolution: A solution is to use Sergey’s work [1] as a reference. If our components are more accurate than Sergey’s components in every relevant measure, it is likely that the whole circuit wouldn’t be significantly worse in accuracy compared to his circuit. This is possible because  more accurate components are available since his work was published.

Changes to the existing design:

There are no significant changes to the existing design because this is the week in which our proposal was presented, and our initial design was just finalized.

Changes to the project schedule:

Similarly, there are no significant changes to the project schedule compared to what was presented in the proposal presentation.

References:

[1] https://escholarship.org/content/qt01q7h2ng/qt01q7h2ng_noSplash_2892dd43015926698bb02bdb85d7b62f.pdf

Alvin Zou’s Status Report for 2/10

Things I did:

For the past two weeks, I helped our team create the abstract and presentation. Additionally, I worked on the symbolic modeling and simulation of the double pendulum system with Thomas, towards prototype 2. Specifically, I was able to use the Lagrangian equations of the system to derive the equations of motion, and encoded them into symbolic objects in Casadi. The main challenge I faced during this step is figuring out how to represent dynamical systems in Casadi. This is largely due to the fact that Casadi’s documentation is very sparse. This caused issues when I tried to represent the derivatives of variables, as I had to work around to find a correct representation.

Additionally, after obtaining the dynamical equations, I was able to implement a Second Order Implicit Runge-Kutta solver(IRK2). By using this solver, I can solve the dynamical ODE’s, giving me the evolution of the state with respect to time. The reason we used IRK2 is three fold:

  1. IRK2 guarentees stability if the ODE system is stable.
  2. It gives O(dt^3) local error(where dt is the time step) even though it’s a second order method due to some its properties.
  3. It only requires the current state and next state values when solving the system, which is already given by the NMPC formulation. This means there is no need to add additional variables to the equality constraint for optimization, which means we don’t need to add additional components to the PCB board.

After creating the solver, I implemented a basic visualizer using matplotlib, which visualizes the double pendulum and displays how it’s state evolves as time progresses.

Finally, I added a control input, a torque on the joint, to the system.

The resulting simulation with a constant torque applied is shown below.

 

Things I will do:

For the upcoming week, I will continue working on the simulation, starting with looking into how to integrate a NMPC solver into the system. This will involve a review of existing solvers, and looking at ways of integrating them with Casadi.

 

Current standing:

Currently, I am on schedule working towards prototype 1. I will be continually working on this for the next week.

Thomas’s Status Report for Feb 10

Personal tasks of this week:

Task: Proposal Presentation

Definition: As the presenter, prepare for the proposal presentation by drafting up the content to present, making presentation slides, writing a script, and rehearsing. Finally, present the proposal to our section.

Completion: The task was completed. It was done together with my teammates, who were especially helpful in giving me useful feedback when I rehearsed. Our TA Aidan also gave me very constrictive feedback on my presentation. The presentation slides can be found here: http://course.ece.cmu.edu/~ece500/projects/s24-teamd6/proposal/

Task: Project Management

Definition: As the team’s Project Manager of the week, keep track of the progress of the project, ensure that everyone is aware of and capable of completing their tasks, organize meetings and work sessions, and communicate with instructors and TAs on behalf of the team when necessary.

Completion: The task was partially completed. I was effective in manually tracking progress and organizing work sessions, but I did not set up a more easy-to-use project management tool (like a GitHub Project) as planned. I will work on better utilizing the available tools when I take up PM duties next time.

Task: Symbolic Model Development

Definition: Work with Alvin to develop a symbolic dynamics model of an inverted double pendulum, which would be the basis of Nonlinear Model Predictive Control (NMPC).

Completion: The task is completed. Alvin and I made substantial progress in deriving the dynamics equations and coding up the simulation using CasADi, an automatic differentiation library. A visualization of the simulated double pendulum with an external torque applied can be found in Alvin’s update for this week.

Overall progress assessment:

My progress is on-schedule, as all of my tasks this week have been completed. I will continue working towards completing Prototype 1, which is swinging up the inverted double pendulum with NMPC in a simulation.