.



Building a Model Using MechaWare

This tutorial demonstrates how to build a simple PID control algorithm using MechaWare.

Note: Mechaware 4.0 is only compatible with the specific MPI release that contains the version matched firmware file. The appropriate MPI Library must be installed and the MechaWare Firmware loaded onto the controller before downloading the MechaWare model. For more information, see Controller Requirements.

Perform the following procedure to create a simple PID control algorithm using MechaWare.

    1. Open MATLAB and click on the Simulink Library Browser button   on the MATLAB toolbar.

    1. From the Library list, select MechaWare Blocks.

    1. Click the New Model button from the Simulink toolbar to create a new model. A New Model window displays.

    1. Leave the New Model window open and return to the MechaWare Block list. Select the Filter block group.


    1. Select the PID with Reset block and Drag/Drop or Copy/Paste the Block into the New Model window as shown in Step 6.

    1. Double-click on the PID with Reset block to reveal block parameters.

    1. The default parameters are displayed. As part of the tuning process, you must determine the appropriate parameters for your system. For this tutorial, the default values are used. When finished, click Ok. For more information, see PID Tuning.

    1. From the Library list, select Inputs and select Position Error from the Inputs block group. Note this is the input to the PID and where the Axis is specified from which the Position Error is collected.

    1. Drag/Drop or Copy/Paste the Position Error block into the New Model window as shown below.

    1. Double-click on the Position Error block and select the Axis Number. For this example, the Axis Number remains at 0. Click Ok. Note for more information about block parameters, see the MechaWare Block Library.

    1. Connect the two blocks by using your cursor to drag a line from the Position Error block to the Input of the PID with Reset block as shown below.

    1. To instruct the PID which motor to command, select the Torque Output block from the Outputs block group and drag it to the New Model window.

    1. Connect the two blocks by using your cursor to drag a line from the PID with Reset block to the Torque Output block as shown below.

    1. Double-click on the Torque Output block and select the Motor Number. For this example, the Motor Number remains at 0. Click Ok. Note for more information about block parameters, see the MechaWare Block Library.

    1. Click on the Save button to save the MechaWare model. For this tutorial, name the model simplePID.mdl and save it to the directory at C:\Program Files\MEI\MDK\04.00.01\MechaWare.

The MechaWare model in now complete. You are now ready to load the model to the controller. Proceed to the next tutorial, Loading a MechaWare Model to a Controller.

 

Linking MechaWare to Simulink | Loading a MechaWare Model to a Controller


       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2009 Motion Engineering