Removing Inherited Components and Connections from an Extended Model

You can remove (deselect) inherited components and connections from an extended model. This allows you to, for example, perform shortcut testing of electrical models, by deselecting components and corresponding connection lines, and instead replace them by pure connection lines, simulating a shortcut.

Notes:
  • To deselect components and connections, the best is to graphically select them in the diagram and press the Delete key. For each selected inherited component, confirmation is asked.
  • There is no graphical support to regret the deselection of a component or a connection. You must do it in the text layer.
  • If there are modifiers for deselected components in other models, they will remain.
  • If a deselected component or connection is removed from the base model, the break statement in the extending model is not removed; an error is raised when the model is checked or translated in the beginning of the simulation.

Context: In this scenario, you create a new library containing an extended model. You extend the model example Coupled Clutches with a new name MyCoupledClutches. Then you perform deselection and also regret deselection. The scenario is academic, that is, it has no physical meaning, but shows you how to perform the actions.

  1. To get an extended model example to work with, perform Extending a Model Example into a New Library.
  2. In the diagram, select step1 and step2.
  3. Press the Delete key and then click Yes in the dialog that appears for each object.
    The selected steps are removed from the diagram layer.
    Note: If you click No for any object, you get a message that the object is inherited, and the deselect operation is not performed for that object.
  4. Repeat the Steps 2 and 3 to deselect the connection between sin2 and clutch1.
  5. To see the result of the deselections in the Modelica code, from the Behavior Authoring section of the action bar, click Modelica Editor .

    You need to work with the code later.

    The resulting Modelica code is:
    model MyCoupledClutches
      extends Modelica.Mechanics.Rotational.Examples.CoupledClutches(
          break step1,
          break step2,
          break connect(sin2.y, cluctch.f_normalized));
    end MyCoupledClutches;
    where each break line is the deselection of that item.
  6. From the Package Browser, drop Modelica.Blocks.Sources.Step into the diagram, and name it step1.

    For information how to rename a component, see Renaming a Component.

    Note: There is no warning about duplicate name.

  7. In the Modelica code, regret the deselection of step2 by removing the line break step2,

    Notes:
    • If you have deselected only one or two objects, you donĀ“t have separate lines for the break statements.
    • For more information about working with Modelica code, see Displaying and Editing Modelica Text.

    When you click OK in the Modelica Editor, step2 is restored, and you get a message that the operation was successful.
  8. In the diagram, connect:
    1. sin2.y to clutch1.f_normalized.
    2. step1.y to clutch2.f_normalized.

    For more information about how create a connection between two components, see Creating a Standard Connection.

Result: You can now simulate the model - it behaves differently from the normal unless you specify step1.startTime to 0.4.

Note: For information on how to simulate the model, see Simulating a Behavior.