Nonlinear Model Predictive Control of Maritime Vessels

With our general purpose maritime simulation tool MOpS as the framework, we have explored some interesting position-keeping algorithms, a fundamental component in systems commonly referred to as Dynamic Positioning (DP) or station keeping. One in particular, a straightforward brute-force multivariable nonlinear model-predictive controller with integrated optimal thruster allocation demonstrated outstanding qualities when tested out on various kinds of “vessels” in realistically simulated environments. We call it NMPC in this text.

Download simulator and explore the features yourself.

Traditional thruster-allocation algorithms typically try to keep a comfortable distance away from nonlinear operating regions and linearize around favourable working points. While this paves the way for established linear control- and optimization theory, the net result can be rather suboptimal if considerable thruster energy is spent for no other reason than ensuring forces cancel out each other in calm weather. The direct method tested here eliminates the expensive and error-prone linearization stage and replaces it with a basic rule-based system that ranks and selects from a number of simulated trajectories. This requires somewhat more computational power, but in return also permits acceptable performance in e.g. low-rpm/standstill rudder+propeller operation.

Among other benefits are architectural simplicity, robustness and an intuitive procedure to compensate for keel-design, thruster interference and other strange hydrodynamic effects. Simpliification, since one single module replaces three (attitude-controller/force-prioritization/trust-allocation).

Fortunately, the numerous individual simulation tasks that are required to accomplish this are totally self sufficient and can be executed in random order, for instance as parallel execution threads. This permits near 100% utilization of multi-core CPU-architectures, facilitating development of low-power ingress protected devices.

Driven by curiosity, since virtually no information of such systems has been published, we designed a dynamic simulator system to explore this methods potential. Its main components were:

  • A near-realistic vessel- and environment-model constituting the object to be controlled.
  • A reduced order variant of this vessel model for the massive-scale predictions.
  • A controller algorithm that orchestrates the simulations and picks out the best outcome.
  • Intentionally flawed (30-60%) prediction model parameters to maintain realism, typically inaccurate mass, drag, hysteresis, slow thruster response etc.

Random manipulations of the aforementioned inaccuracies, as well as wave- and current-induced disturbance forces were used to establish a picture of the control robustness.

Indications so far suggest that if the vessel is modeled reasonably correct with respect to geometry, mass, maximum forces and thruster locations, and provided the respective force- and rudder adjustments predominantly affect the vessel in anticipated ways, this particular NMPC implementation performed surprisingly well on every case we tried it on with only moderate adaptations. Its most remarkable property is the robustness with respect to inaccurate mass assumptions and severe nonlinearities, like the impressive ability to directly include a plain on/off bow thruster in the control strategy. Furthermore, rudder backlash up to 3-4 degrees only negligible influence.

Challenge 1: Work boat

A twin-hull work boat case is illustrated below. The vessel is equipped with one continuously variable-rpm propeller for main propulsion in each hull, tandem rudders, and bow+stern tunnel-thrusters installed in the port hull only.

In this particular scenario it is chasing a remorseless reference trajectory; 50 by 50 metre square, clockwise motion at constant 1.3 knots speed while heading always should point north. 1 knot current setting south-west, and significant waves constitute quite adverse conditions. An optimal criterion continuously minimizes energy consumption/wear/comfort etc as well as heading error, rate-of-turn and positional offset:

The bird’s eye view in the screen-shot above illustrates the situation; vessel’s simulated position outlined in green, the desired position in grey, and the predicted position in red. Trajectory-history is drawn in black. The trend-plot below it views rudder angles and four propeller rpm’s  over the last two minutes. Observe how smoothly the actuators are manipulated despite the wave-influence, a direct consequence of the incremental nature of the optimal tracking process. Variable-pitch propellers would behave equally well, but rpm is chosen as trending combines better with the angular variables.

As rechargeable batteries improve and hybrid propulsion becomes mainstream, this configuration might eventually become attractive: A single Voith Schneider Propeller (VSP) astern instead of the two engines/gears/propellers supplemented by a bow-thruster. The slight yaw-disturbance from the single VSP can be modeled and automatically compensated for:

Challenge 2: Multiple outboard engines

Manufacturers of outboard engines have for some time now marketed off-the-shelf systems for station-keeping and easier berthing of recreational vessels. Here the NMPC algorithm controls three 200 hp outboard motors, plus an simple on/off bow-thruster for better margin in rough conditions. 06 knots side current and quite significant head-waves:


As we can see on the trend plots, this very primitive bow thruster is mostly considered by the algorithm to be too powerful to be useful and effectively ruled out, except on the leg going “westward”, against the current, where it immediately comes to use with very helpful impulses in port (negative) direction.

The overlaid histogram that can bee seen in this particular example reveals basic statistics regarding which of the in this case more than 2000 evaluated actuator adjustment combinations are preferred most frequently, and also indicates for which reason. The tall red column to the left represents “no changes” and is usually quite dominant.

Challenge 3: Car ferry

A 50-car ferry with two azimuth thrusters. These thrusters have a problematic nonlinearity in the form of a substantial force-treshold caused by in/out clutching at idle rpm. However, we can immediately conclude that the algorithm consistently discards all solutions below this treshold. Furthermore, these thrusters typically suffer from a disturbing angular motion dead band in the order of 1-2 degrees. As it turns out, this particular algorithm tolerates significantly more before problems begin to surface.


Challenge 4: Single azimuth thruster.

Offshore standby-vessels, in particular those with traditional main-engine+reduction gear for propulsion, could potentially achieve significant fuel- and emissions savings by leaving station-keeping entirely to the auxiliary engines and the electrical thrusters whenever possible. An NMPC controller can fulfill this requirement as we see in the case below. A standard 3000 ton offshore standby vessel with a tunnel-thruster and an azipod arrangement in the bow stays stationary in 1.5 knots current setting south-east. Quite heavy swells arriving from south west combined with some choppier waves from north west.

The weight factor on heading error can be set to zero as in this case. This simple change allows the algorithm to track the optimal heading as combined drift direction varies over time:


Given the vessels potential vulnerability in this power-conservation mode, ability to immediately re-activate e.g. main propellers is paramount. Fortunately, the design of the multi-variable MPC controller allows this to take place without any impact on the control structure whatsoever, guaranteeing essentially bump-less shut-in of additional thrusters.

Careful selection of weight-factors for the various thrusters can also establish a priority system of gradual and automatic in- and out-phasing of thrusters as required by net drift. In case all environmental disturbances disappear, this algorithm will eventually shut down all the thrusters. The criterion for that is that whenever the predicted improvement in weighted “cost” of the positional error over the given time horizon is exceeded by the cost of thrust and other factors needed for this improvement.

This in contrast to conventional designs that rely on keeping thrusters within specific ranges to allow for meaningful linearization, with inevitable increase in wear and energy consumption as result.

Challenge 5: Fixed thrusters:

Sub-sea ROVs and similar specialized, possibly autonomous, low-speed vessels often rely on fixed-angle thrusters. The NMPC approach also seems to cope well with such configurations. Below is an imaginary 60 ton 40 by 16m work-barge fitted with four fixed propellers doing the same exercise, except only 0.4 m/s speed since it is quite underpowered:

Smaller vessels, e.g. a subsea ROV with electrical thrusters is should be equally controllable, except the models should be extended to full 6 degrees of freedom (6DOF).

Challenge 6: Combining thrusters and moorings

Deep-sea mining activities represent other ship-maneuvering issues and often involves an array of anchors instead of thrusters. NMPC can quite straightforwardly combine the two and find the optimal chain lengths just as well as thruster forces and angles. This at the cost of another order of magnitude more processing power though because of the added lump-mass chain models. Below is a basic example with a 1500 ton barge, two bow-anchors and a conventional setup with single stern rudder/propeller in combination with tunnel bowthruster:

Anchors and thrusters in co-operation

As one would expect, the main propeller must reverse a lot. The algorithm establishes this fact by itself, and in case a favorable head current appears it will contribute to alleviate this.

One can also imagine pusher boats incorporated as yet another form of “manipulator” and build more complex optimal maneuver planners, but developing a practical pusher-boat model has been beyond the scope of this study.

Challenge 7: Bavaria 36

Here is how a 7 ton Bavaria-36 realistically would behave when dealing with our torture trajectory with its sails down:


Observe how this basically dumb algorithm “magically” by plain trial-and-error consistently reveals a clever “next move” and coordinates the bow-thruster(red), throttle(blue) and rudder(green) methodically. The boat moves as close to sideways as the optimal criterion demands.

Compared to a traditional controller

Although not quite identical cases nor optimal tuning, the comparison below demonstrates the main differences. The behaviour of a vessel with traditional 3x PID controllers and separate optimal thruster allocator/prioritizer shown to the left, NMPC to the right. Ideal conditions, i.e. no wind or current. The pronounced oscillations are caused by the integral term in the controller as the reference speed in surge-direction suddenly drops to zero. The MPC controlled vessel will usually lag a short distance behind the reference and can therefore cut slightly through the corners with substantial benefits in this case.

Also note the pronounced jaggedness of the thruster-commands (kN) in the conventional variant compared to the incremental nature of the MPC alternative. Precence of waves, and navigational noise would inevitably accentuate this difference.

How does it actually work?

The simple sailboat case is well suited as an illustration. If we from standstill request immediate motion to a new position ca 15 meters outside starboard quarter as indicated with a crosshair and a gray hull outline, the following response appears:

The controller performs 63 dynamical scenario-simulations from the initial position estimate (cyan outline) over a given time horizon. The end positions are here outlined in thin gray, and as we can see most of them veers away immediately and can be eliminated. However, the best result according to the optimal criterion (red) usually represents an improvement and is subsequently selected for thrust and rudder adjustments. After a second or so, a reassessment is then made with updated initial states, usually with a slightly different outcome.

For a light vessel like this, the procedure will typically be repeated at more or less regular sub-second intervals, or whenever considered beneficial by e.g. the position estimator system. For larger vessels, 5 seconds or even minutes can be sufficient. Reasonable real-time precision is in fact only required for the position estimation process.

The number 63 arises from the possible combinations of control outputs, in this case 7x rudder by 3x rpm by 3x bow-thruster alternatives. For the full 7-actuator OSV model above, 3645(5*3^6) scenarios were evaluated over a 20 second horizon. Owing to longer time steps, careful model simplifications and parallel processing, this can be achieved in 25 ms on a typical 3 GHz  with four cores.

A detailed study of the graphics above reveals that the selected output for the occasion was neutral rudder, further increasing the already negative rpm and still no bow-thruster — just like any other experienced yachtsman. The only difference is that while he would have based his actions on years of trial and probably some mistakes, this stateless NMPC algorithm rebuilds its experience base every single time step.

In reality one would always avoid positional offsets of the magnitude in the example above but generate a smooth trajectory for the NMPC-controller to follow much closer.


Brute-force NMPC is particularly well suited to maritime vessel position control for a number of reasons:

  • These problems represent a favorable combination of moderate model complexity and comparatively long dominant time constants. The computational burden therefore lies well within the capacity of existing low-power ruggedized embedded systems.
  • Energy consumption in maritime activity is subject to increasing scrutiny, battery-powered propulsion is one example. The opportunity to formulate an optimal criterion that penalizes energy-consumption, noise, wear etc can improve endurance, economy and HSE-conditions considerably in station-keeping mode.
  • The high tolerance to equipment wear, e.g. rudder hysteresis, marine growth etc.
  • Represents a straightforward approach to manage over-actuated vessels and balance safety, reliability, comfort, fuel-economy etc.
  • Can directly replace traditional algorithms in existing systems.

Other advantages:

  • Code simplicity. Control-loop(s)+prioritization+thruster-allocation functionality are all implemented in one quite simple module that is easy to maintain.
  • Anti-windup logic is not required whatsoever.
  • Eliminates the infamous linearization task.
  • Built-in “cost” (energy, wear, HSE, etc) optimization.
  • A seemingly “forgiving” tune-in procedure lowers risk of experiencing oscillations and similar surprises during installation and test.
  • The low sensitivity to parameter variations leads to reduced maintenance costs.
  • An intuitive procedure to incorporate known nonlinearities like thrust limitations, rudder characteristics etc: Express the observation in model code and verify the system performance. Repeat until satisfaction.
  • The same goes for interference between thrusters, speed influence on thruster performance, propeller walk, effects from sea-bottom and quay surfaces etc.
  • Known or measured external forces from wind and towed equipment etc also blend nicely with the prediction models, essentially establishing feed-forward.
  • Influence from wind and ocean current can be exploited as an extra bias force and in some cases provide DP-functionality with under-actuated vessels like fishing smacks.
  • No control structure rearrangement needed whenever a thruster is enabled or disabled.
  • The fact that actuator forces are always adjusted gradually in smaller increments will in many cases eliminate the need for complex wave-estimations and similar. It also prevents the type of violent thruster behavior that PID-based systems can produce, typically during initial trials after installation. Sudden setpoint changes or erroneous measurements will be handled smoothly.
  • Hard constraints like total-power limits or obstacles can be implemented as part of the optimal criterion. Input from the energy- and power management systems in hybrid propulsion systems could also be included in the criterion if desired. Similarly, as countermeasure against erosion on quay structure foundations, the outmost thrusters can be prioritized during the first metres of e.g. car-ferry departures.


  • Lack of merit.
  • Typically requires more than microcontroller computational capacity.


We have prepared a demo collection of the simulators used above, as well as a few more like the mentioned fishing smack and a waterjet equipped SAR vessel. Feel free to install and explore the possibilities: 64-bits Windows installer, signed.

Start the individual demos from the Windows program menu. Once started, F1 provides help. Clean up with a single-click uninstall.

Related reading:

OpenMP, an implementation of multithreading (Wikipedia)

Pleasingly Parallel Systems (Wikipedia)