# MV-7003: Simulating a Single Input Single Output (SISO) Control System Using MotionView and MotionSolve

In this tutorial, you will learn how to implement a single input single output (SISO) controller in MotionView and solve it using MotionSolve.

Consider the problem of maintaining the reference speed of a rotor in the presence of disturbances. A block diagram of the control system is shown in the figure below.
One simple approach is to design a proportional integral (PI) controller (Ogata, 1995), such that:(1) ${G}_{C}\left(s\right)=\frac{{K}_{p}s+K}{s}$

This tutorial shows you how to implement this PI controller.

1. From the Start menu, select All Programs > HyperWorks <version number> > MotionView.
2. Load the rotor.mdl file, located in the motionsolve folder.
The model contains a body called rotor that is attached to ground by a revolute joint. The joint axis is parallel to the global Z-axis. There is a torsional spring-damper with only damping and no stiffness.

The model also contains output requests for the displacement and velocity of the rotor body.

## Add a Solver Variable for Reference Speed

1. From the Project Browser, right-click Model and select Add General MDL Entity > Solver Variable (or right-click from the toolbar.
The Add SolverVariable dialog will be displayed.
2. Change Label to Reference Speed.
The variable name remains sv_0.
3. Click OK.
4. To maintain a linear speed of 3 rad/sec, from the Type drop-down menu, select Linear and enter 3 as the value of the solver variable.

In this section, add a SISO controller. The input to the controller is the error between the reference speed solver variable and the rotor angular speed. The output of the controller is the torque to be applied to the rotor. The parameters for the simulation are chosen, somewhat arbitrarily, as Kp=1 and K=10.

1. From the Project Browser, right-click Model and select Add General MDL Entity > Control SISO (or right-click ).
The Add Control dialog will be displayed.
2. Click OK.
3. From the Input tab, select Expression from the Type drop-down menu and enter this expression:
-WZ({MODEL.b_0.cm.idstring})+{sv_0.value}

Note the single back quotes, indicating the expression is not to be processed by MDL, but by Templex. The parameters inside the curly braces are evaluated.

4. Click the Properties tab.
5. To add Numerator coefficients, click Append.
6. Enter 10 and 1 for the coefficients of 1 and s, respectively.
7. Similarly, for Denominator coefficients, click Append and enter 0 and 1 for the coefficients of 1 and s, respectively.

In this section, create a control torque acting on the rotor body. The Z-component of this torque is the output of the controller.

1. From the Project Browser, right-click Model and select Add Force Entity > Force (or right-click Forces ).
The Add Force or ForcePair dialog is displayed.
2. Leave the label and variable name default settings and click OK.
3. From the Connectivity tab, under Force, select Action Reaction. For Properties, select Rotational.
4. Set Local ref. frame by double-clicking Ref Marker and selecting Global Frame.
5. Double-click Body 1 for Action force on: and select the rotor body.
6. Double-click Body 2 for Reaction force on: and select Ground Body.
7. Double-click Point 1 for Apply force at: and select Point 0.
8. Click the Rot Properties tab and leave Tx and Ty set to 0.
9. Under Tz, select Expression and enter {MODEL.siso_0.OUTPUT}.
Tip: You may also click to access the expression builder and create this expression using the model tree.

## Add Output Requests for Control Force

1. From the Project Browser, right-click Model and select Add General MDL Entity > Output (or right-click ).
The Add Output dialog will be displayed.
2. Enter Control force for the Label name and click OK.
3. Specify other choices as shown in the figure below:

## Run the Simulation

1. Click Run to display the Run panel.
2. Under Simulation type, select Transient and specify the output (.xml) filename.
3. Enter 25 for the End time.
4. Click Run.

The results are displayed in the image below.

Reference

K. Ogata, Modern Control Engineering, 1990, Prentice-Hall Inc., Englewood Cliffs, N.J., US