8. Modularizing Simulation Diagram Code (Control Design and Simulation Module)
- Updated2023-03-14
- 2 minute(s) read
You can create simulation subsystems to divide simulation diagrams into components that are modular, reusable, and independently verifiable. Complete the following steps to create a simulation subsystem from this simulation diagram.
- View the simulation diagram.
- Select the Calculate Acceleration, Calculate Velocity, and Calculate Position functions by pressing the <Shift> key and clicking each function.
- Select Edit»Create Simulation Subsystem. LabVIEW replaces these three functions with a single function that represents the simulation subsystem, which is circled in the following image.
The inputs and outputs of the simulation subsystem include the inputs and outputs of all the functions you selected. Also, notice the amount of blank space on the simulation diagram. Because you combined three functions into a subsystem, you can resize the Control & Simulation Loop and reposition the functions to make the simulation diagram easier to view. - Press <Ctrl-S> to save the simulation diagram. LabVIEW prompts you to save the simulation subsystem you just created. Click the Yes button and save this simulation subsystem as Newton.vi. You now have a simulation subsystem that obtains the position of a mass by using Newton's Second Law of Motion.
![]() |
Note You can resize the simulation subsystem to better display its simulation diagram. You also can double-click the simulation subsystem to display the configuration dialog box of that simulation subsystem. |