SimericsMP has a proportional–integral–derivative (PID) controller module that will let you control the speed of the model via the rpm (as well as many other things like trying to steer the model using an autopilot to turn the rudders (required Premium) or direction of propulsion). Read about PID Controllers.


To use this capability you will need to have version 5.2.13 or later. In version 5.x, a Premium license is required. In version 6.x, this capability is available with a Standard or Premium license.

Controllers are treated as modules in SimericsMP just like other flow and dynamics modules. To add a new controller, click on "Select Modules" in the Model panel and add a controller (giving it a Module Name) as shown below where I added a controller called "SpeedController".

Then setup the new controller by setting it's properties as shown below. The main properties that you must set on the controller are the error inputs and the controller gains. For the error you can specify either the Set Point and Process Variable inputs or just define a simple Error Function, which is the (target speed - the current speed) in the example below for a speed controller. Here we defined 'targetSpeed' as an expression variable in the Expression Editor, but you can also just enter a numerical value such as 10 - marine.forward_vel (where the value 10 in this case is assumed to be in SI units of m/s). 

As far as setting the controller gains, the process of tuning the controller depends on the nature of the control variables and process for which the controller is being developed. In general this can be an involved process (for example tuning a rudder controller for steering in waves), and there are various well-documented approaches to controller tuning such as the Ziegler-Nichols method. However, for a simple speed controller like that shown here it shouldn't be difficult to achieve a reasonable set of controller gains (although it may require some trial and error). You will need to set a value of Kp (the proportional gain) which in this case tells the controller how fast and how much to change the rpm based on the error in speed (delta rpm / delta speed). In general it should be ok to set it to a fairly high number because you are not necessarily trying to match the real throttle response of the vessel but instead trying to get to your target speed quickly. However, with just a Kp gain you may never really reach the desired speed (although you can get infinitesimally close) because the error approaches zero at the target speed. Therefore, you will also want to set an integral gain value, Ki, which tries to minimize the integrated error. You'll need to experiment with that value. If it is too large the controller can become unstable in theory. Thus a "P-I" controller is likely to be satisfactory for this intended use.

There are also some optional inputs which you should consider for the controller. The "initial_control_variable" input is the initial rpm in the case of the speed controller, which you should hopefully have a reasonable guess for so that it doesn't have to start from zero. You can also optionally set min/max control variables and control variable rates. 



Finally, you need to set the Prop RPM in the Marine module, or you can make the change in the Expression Editor:


prpm1 = controller.SpeedController.output

If you didn't name the controller when you added it to the simulation, it would just be "controller.output."


These images show an example of using the controller to adjust the RPM to hit a target speed. The RPM quickly jumps to the Max Control Variable value of 2500, but then drops back down and is adjusted to achieve the target speed (the speed actually overshot slightly before coming back down).