Page tree
Skip to end of metadata
Go to start of metadata

Where To Find This Example

Select Help > Open Examples... from the menus and type either the example name listed above or one of the keywords below.

Or in Version 13 or higher you can open the project directly from this page using this button. Make sure to select the Enable Guided Help before clicking this button.

Design Notes

Dynamic SubCircuit Structures

This example illustrates how to create a dynamic subcircuit structure.

Functionality:

SubCircuitA, SubCircuitB and SubCircuitC perform different functions on the input data. MainCircuit block contains a variable SubCSelect, which is an enumerated parameter that selects the subcircuit to be used, hence determining the functionality performed internally. By selecting the proper option for SubCSelect from the drop-down menu, MainCircuit dynamically updates the subcircuit that should be used.

To verify functionality:

1. Select the desired setting for SubCSelect parameter of MainCircuit block.

2. Click Run Simulation.

3. Right-click on the subcircuit S1 ("MainCircuit") and select Edit Subcircuit. Inside MainCircuit, right-click on subcircuit S1 (SubCName) and select Edit Subcircuit. This will take you to either SubCircuitA, SubCircuitB or SubCircuitC depending on the selection of SubCSelect parameter of MainCircuit block.

The significant steps creating this example are shown below:

1.  Create the appropriate system diagrams similar to SubCircuitA, SubCircuitB and SubCircuitC.

            - All these subcircuits should have identical parameter interfaces.

2.  Create a MainCircuit system diagram.

3.  In MainCircuit, create a new equation, SubCSelect << 0.

4.  Right-click on SubCSelect, and select Properties.

            - Set Data Type to Enumeration,

            - Set the parameter description to Select SubCircuit {SubCircuitA, SubCircuitB, SubCircuitC},

            - Available options of this enumerated parameter are defined within the curly brackets,

            - Underlying parameter value is an integer starting from 0.

5.  Create a parameter SubCName which is evaluated based on the value of SubCSelect and contains the names of the appropriate subcircuits corresponding to each value of SubCSelect.

6.  Include an input port and an output port in the MainCircuit system diagram.

7.  Include one of the subcircuits SubCircuitA, SubCircuitB or SubCircuitC in the MainCircuit system diagram; connect it properly to the input and output ports.

8.  Change NET parameter of the latter subcircuit to SubCName.

9.  Add equations defining parameters that should be passed on to the subcircuit.

10. Create the Main System Diagram and include the MainCircuit subcircuit. Connect it properly.

System Diagram - SubCircuitA

System Diagram - SubCircuitB

System Diagram - SubCircuitC

System Diagram - Main System Diagram

Graph - Graph 1