← Back to Design Patterns
Renewable energy Mixed Evidence Chemicals & batch processingAerospaceRoboticsPharmaceuticals
Trajectory optimizationSetpoint generationMPCOptimal controlNLP

Trajectory Optimization and Setpoint Generation — Optimal Plans for Real-Time MPC Tracking

Why This Matters (Executive Summary)

  • The problem: Many industrial and energy systems operate under complex nonlinear dynamics with dozens of constraints. Solving the full optimization online in real time is either too slow or too risky for production deployment.
  • The solution class: A two-stage architecture where a computationally expensive optimal control problem (OCP) is solved offline (or in a slower supervisory loop) to generate optimal trajectories or setpoint libraries, and a fast online MPC tracks these references while handling real-time disturbances.
  • Measurable outcomes: Published implementations report 100% convergence success for spacecraft landing across broad uncertainty envelopes, 5-15% cycle time reduction in robot motion, tighter batch quality specs, and significant energy savings in lyophilization.
  • Why it matters for operations: You get the best of both worlds — the optimality of a full NLP solution and the robustness of real-time MPC tracking — without requiring extreme compute hardware on the plant floor.

The Design Pattern Explained

The two-stage pattern separates what to do from how to do it in real time:

  1. Offline trajectory optimization (the planner): A large-scale nonlinear program (NLP) or convex program is solved using tools like CasADi and IPOPT via direct collocation or multiple shooting. This stage captures the “best possible plan” for a given operating condition, respecting all safety and operational constraints. The output is a trajectory (time-varying setpoints) or a library of trajectories indexed by operating condition.

  2. Online MPC tracking (the executor): A lightweight MPC runs at the plant’s control rate, tracking the reference trajectory while handling unmeasured disturbances, sensor noise, and minor model deviations. The MPC enforces real-time constraints that the planner may not have captured exactly.

Setpoint libraries and scheduling: Instead of solving one trajectory, a family of optimal trajectories is pre-computed across operating conditions (wind speeds, product grades, batch recipes) and stored as a lookup or scheduling system. This ensures the reference itself is feasible across the full operating range, with sensitivity analysis confirming robustness.

NLP, convex OCP, and linear MPC tracking — three distinct computational roles: This two-stage pattern involves different optimization types at each stage, and the distinction matters significantly for implementation effort and reliability. Offline nonlinear optimization (NLP): Applications 1 (airborne wind energy kite trajectories), 4 (BASF RECOBA batch chemical process), and 5 (pharmaceutical lyophilization primary drying) all solve large-scale non-convex Nonlinear Programs using CasADi and IPOPT via direct collocation or multiple shooting. These NLPs can take seconds to minutes per solve, are susceptible to local optima, and require careful initialization — but they capture the full nonlinear physics and produce genuinely optimal trajectories over complex multi-hour operating horizons. Offline convex optimization (SOCP/LP): Applications 2 (spacecraft G-FOLD powered descent) and 3 (robot time-optimal path parameterization TOPP) exploit the insight that key constraints can be convexified — the thrust-magnitude nonconvexity is relaxed losslessly in G-FOLD, and TOPP is reformulated as a convex second-order cone program. Convex offline solvers guarantee global optimality and converge in 1-5 seconds, dramatically improving reliability over NLP-based alternatives. Online linear MPC tracking: once the offline optimal trajectory is computed, the real-time executor is typically a fast linear tracking MPC — the nominal trajectory is fixed, disturbances are small, and a linearized model around the trajectory suffices. This yields a convex QP at each control step: globally optimal, deterministic solve time, embedded-feasible. The practical implication: the offline planner absorbs the computational burden of nonlinearity and constraint complexity; the online tracker remains simple, robust, and auditable.

Applications & Reference Implementations

Application 1: Airborne Wind Energy — 3D Trajectory Optimization for Pumping-Cycle Kites (SkySails PN-14)

For the PN-14 airborne wind energy system, a 3D optimal-control formulation was implemented in Python with CasADi and IPOPT to compute power-cycle trajectories for variable-trim kites with rated power up to 200 kW and kite areas of 90-180 m2. The optimization handles geometrical/airspace constraints, feedback-loop performance limits, and aerodynamic/mechanical/electrical boundaries, with wind-speed-dependent initialization to avoid poor local optima. Optimal trajectories differ substantially between low and high wind speeds, and the results were used directly as time-varying setpoints for supervisory control plus performance projections for component sizing. The fast, robust convergence across the full operating range demonstrates industrial-grade trajectory optimization. 1

Application 2: Spacecraft Powered Descent Guidance — Convex OCP Solved Onboard in Seconds

JPL/Caltech researchers developed the G-FOLD (Guidance for Fuel-Optimal Large Diverts) algorithm for planetary and terrestrial rocket landing, converting the nonconvex powered descent optimal control problem into a second-order cone program through lossless convexification. The key insight: the thrust-magnitude inequality constraint (a nonconvex set) can be relaxed without losing optimality, yielding a convex problem that can be solved to global optimality in 1-5 seconds on flight hardware. The resulting time-varying thrust magnitude and direction profile serves as a setpoint trajectory for the onboard closed-loop guidance and control system. Monte Carlo tests across broad initial condition uncertainty envelopes demonstrated 100% convergence success. The approach influenced retropropulsive landing guidance for commercial launch vehicle recovery programs. This is the offline OCP + online tracking pattern at its extreme: solve the hard problem fast, then execute robustly. 2

Application 3: Time-Optimal Robot Path Following — Offline Convex OCP + Servo Tracking (TOPP)

A classic pattern in industrial robot programming separates motion planning into two stages: (1) offline computation of the time-optimal velocity profile along a given geometric path, and (2) online servo tracking of that profile. Verscheure et al. (2009) showed that time-optimal path parameterization (TOPP) can be formulated as a convex second-order cone program, yielding a globally optimal solution that respects all joint torque, velocity, and acceleration limits. The offline solution provides the minimum-time motion schedule; the online servo controller then tracks it at each control cycle. This two-stage approach has been adopted in industrial robot programming tools and in the open-source TOPP-RA library (Pham & Pham, 2018), making time-optimal motion standard practice for 6-DOF manipulators. Published results show 5-15% cycle time reduction compared to conservative jerk-limited trajectories, directly improving throughput in assembly, welding, and palletizing. 3

Application 4: Batch Chemical Process Optimization — Offline Recipe + Online Tracking MPC (BASF RECOBA)

The EU-funded RECOBA project (6 million EUR, 3-year term), coordinated by BASF, implemented the offline OCP + online tracking pattern for complex batch processes including emulsion co-polymerization, steel, and silicon production. In the offline phase, a large-scale NLP computes optimal process recipes — temperature profiles, feed rate trajectories, catalyst addition schedules — for each product grade, balancing quality targets against energy use and cycle time. In the online phase, a fast tracking MPC executes the recipe in real time, correcting for disturbances (raw material variability, heat transfer changes) while keeping the process on the optimal trajectory within specification bounds. This architecture is the industrial gold standard for batch process optimization: the expensive offline computation handles problem complexity, while the online MPC handles uncertainty. 4

Application 5: Pharmaceutical Lyophilization — Offline Design Space Optimization + Constrained Process Tracking

Freeze-drying (lyophilization) of injectable biologics is a critical pharmaceutical manufacturing step where product quality depends on the entire primary drying temperature profile. Researchers at Politecnico di Torino developed a Design Space approach using offline optimal control: for each product formulation, an NLP computes the optimal shelf temperature trajectory that minimizes primary drying time while keeping product temperature below the collapse temperature threshold. The offline solution defines a Design Space — a validated region of feasible operating conditions — which is then tracked online by a real-time process control system using temperature and pressure measurements as feedback. Published results demonstrate cycle time reductions of 10-30% compared to conservative fixed-ramp protocols, with product quality maintained across all validated batches. The pattern is directly transferable to any pharmaceutical or food batch process where offline quality-by-design optimization defines the operating envelope and online MPC enforces it in real time. 5

What This Means for Your Operations

The two-stage pattern is directly transferable to any DACH operation where:

  • Batch processes follow recipes that could be optimized per grade/product and tracked in real time (chemicals, pharma, food, specialty materials).
  • Energy systems need condition-dependent operating strategies (wind turbines, combined heat and power, energy storage scheduling).
  • Robotic or mechatronic systems require complex trajectories that respect workspace, actuator, and safety constraints.

Common prerequisites:

  • A dynamic model (even simplified) that captures the dominant physics.
  • Defined constraint sets (safety, quality, actuator limits).
  • Enough operational data to calibrate model parameters and validate margins.
  • An integration path from the optimization output to the real-time control layer.

How We Deliver This (Engagement Model)

  • Phase 0: NDA + data request — Collect process models, constraint definitions, historical batch/operating data, and current control architecture documentation.
  • Phase 1: Fixed-scope discovery (concept + feasibility) — Map the problem to the two-stage architecture. Define the OCP formulation, select solver tools (CasADi/IPOPT or alternatives), and identify the online MPC tracking requirements. Deliver a concept document with architecture, expected benefits, and validation plan.
  • Phase 2: Implementation + validation + commissioning — Build the trajectory optimizer and online tracking MPC. Compute setpoint libraries across the operating envelope. Validate against historical data and commissioning scenarios. Deploy with monitoring and safe fallback.
  • Phase 3: Monitoring + training + scaling — Monitor trajectory feasibility, tracking error, and constraint activity in production. Train operators on setpoint scheduling and override procedures. Extend to additional product grades, operating conditions, or sister plants.

Typical KPIs to Track

  • Trajectory tracking error (deviation from optimal reference)
  • Batch quality consistency (Cpk, specification compliance rate)
  • Energy yield or efficiency gain versus fixed-schedule baseline
  • Cycle time reduction versus conservative nominal profile
  • Constraint violation frequency and margin utilization
  • Solver convergence reliability and computation time
  • Operator intervention rate and manual override frequency

Risks & Prerequisites

  • Model quality determines trajectory quality: If the offline optimization uses an inaccurate model, the “optimal” trajectory may be infeasible or suboptimal in practice. Validate with data.
  • Local optima in NLP: Nonlinear trajectory optimization can converge to local optima. Initialization strategies, homotopy methods, and multi-start approaches mitigate this risk.
  • Online tracking must be robust: The MPC tracking layer must handle disturbances that the offline planner did not anticipate. Sufficient constraint margins and disturbance rejection capability are essential.
  • Integration complexity: Connecting an offline optimization pipeline to a real-time control system requires careful engineering of data flow, timing, and fallback behavior.

FAQ

Why not just solve everything online in one MPC? For many industrial problems, the full nonlinear optimization is too computationally expensive to run at the required control rate. The two-stage approach lets you use a detailed, high-fidelity model offline and a simpler, faster model online — capturing the best plan and executing it robustly.

How often do I need to recompute trajectories? It depends on how much your operating conditions change. Some systems use a pre-computed library indexed by a few key parameters (wind speed, product grade). Others recompute trajectories in a slower supervisory loop (minutes to hours) as conditions evolve.

Can I use this pattern with my existing DCS/PLC? Yes. The trajectory optimizer runs on an engineering workstation or server. Its output — time-varying setpoints — is fed to the existing control system, which tracks them using its standard MPC or PID loops. This minimizes changes to the safety-critical real-time layer.

What tools are used for trajectory optimization? CasADi (open-source modeling and automatic differentiation) with IPOPT (open-source large-scale NLP solver) is a proven, widely-used combination. For convex problems (like TOPP or spacecraft landing), ECOS or MOSEK solve in milliseconds to seconds. Commercial alternatives exist but the open-source stack is robust and well-documented.

Book a 30-Minute Discovery Call

Ready to explore whether this pattern fits your system?

Dr. Rafal Noga — Independent APC/MPC Consultant

📧 Email me · 🌐 noga.es

Fixed-scope discovery · NDA-first · DACH on-site available

Public References

Footnotes

  1. “Optimization of 3-D Flight Trajectory of Variable Trim Kites for Airborne Wind Energy Production” (arXiv:2403.00382, 2024). https://arxiv.org/abs/2403.00382

  2. Blackmore, “Autonomous Precision Landing of Space Rockets” (The Bridge, National Academy of Engineering, 2016). See also: Acikmese & Ploen, “Convex Programming Approach to Powered Descent Guidance” (Journal of Guidance, Control, and Dynamics, 2007).

  3. Verscheure et al., “Time-Optimal Path Tracking for Robots: A Convex Optimization Approach” (IEEE Transactions on Automatic Control, 2009). https://doi.org/10.1109/TAC.2009.2016711. See also: Pham & Pham, “A New Approach to Time-Optimal Path Parameterization Based on Reachability Analysis” (IEEE T-RO, 2018).

  4. BASF News Release, “BASF Cooperates with Partners to Introduce Online Control of Complex Batch Processes” (RECOBA, 2015). https://www.basf.com/global/en/media/news-releases/2015/03/p-15-172

  5. Fissore et al., “Advanced Approach to Build the Design Space for the Primary Drying of a Pharmaceutical Freeze-Drying Process” (Journal of Pharmaceutical Sciences, 2011). https://doi.org/10.1002/jps.22264

Contact

Send a message

Opens your email client with pre-filled message

Direct contact

Dr. Rafał Noga

Meeting

Suggest a 30-minute video slot by e-mail. Available EN/DE/FR/ES/PL.

Propose a slot

Stay Updated

Get insights on Industrial AI, APC, and process optimization delivered to your inbox.