LabVIEW Control Design and Simulation Module

Example 2: Simulating an External Model (Control Design and Simulation Module)

  • Updated2023-03-14
  • 3 minute(s) read

LabVIEW users can use the External Model Interface (EMI) to simulate an external, or third-party, model in the LabVIEW Control Design and Simulation Module. Use the External Model function to represent and simulate the model.

Complete the following steps to simulate the My Integrator model created in Example 1.

  1. In a blank VI, add a Control & Simulation Loop to the block diagram.

    Add 

  2. Add an External Model function to the block diagram inside the Control & Simulation Loop.

    Add 

  3. In the Select an External Model Library dialog box that appears, browse to the shared library corresponding to the My Integrator model. You also can browse to the EMI_Integrator.dll file located in the labview\examples\Control and Simulation\Simulation\External Model Interface\EMI_Integrator directory. This .dll file corresponds to the EMI_Integrator.c example code.
  4. Click the OK button to close the Select an External Model Library dialog box.
  5. If the Context Help window is not displayed, select Help»Show Context Help to display the window.
  6. Hover over the External Model function on the block diagram. Notice that the function now has a name of My Integrator, one block diagram input named Input, and one block diagram output named Output.
  7. Double-click the External Model function to display the configuration dialog box. Notice that the configuration dialog box has an Initial Value parameter with a default value of 0.
  8. Click the OK button to close the configuration dialog box for the External Model function.
  9. Add a Sine Signal function to the block diagram inside the Control & Simulation Loop and to the left of the External Model function.

    Add 

  10. Wire the output output of the Sine Signal function to the Input input of the External Model function.
  11. Add a SimTime Waveform function to the block diagram inside the Control & Simulation Loop and to the right of the External Model function. When you place this function on a simulation diagram, LabVIEW automatically wires a waveform chart indicator to the function.

    Add 

  12. Wire the Output output of the External Model function to the Value input of the SimTime Waveform function.
  13. Press the <Ctrl-E> keys to display the front panel window of the VI.
  14. Run the VI and observe that the Waveform Chart indicator displays the integral of a sine wave.
  15. Stop the VI.

Refer to the EMI_Integrator VI in the labview\examples\Control and Simulation\Simulation\External Model Interface\EMI_Integrator directory for an example of using the External Model function.

Log in to get a better experience