Tutorial: Co-Simulating a Plunger Model with Flux 3D

Create a Twin Activate model to regulate by hysteresis a current that feeds into the coil of a 3D Flux model of a plunger, and co-simulate the models.

Attention: Available only with Twin Activate commercial edition.

The co-simulation process with Flux includes four basic steps:

  1. Create a Flux model (for this tutorial, the Flux model is provided for you).
  2. Generate the Flux coupling component required for Twin Activate to read in the Flux model data.
  3. Create a Twin Activate model and include the Flux block for reading in the Flux coupling component.
  4. Co-simulate the models in Twin Activate.

Files for This Tutorial


A finished version of the models you build in the tutorials along with any files required to complete the tutorials are available at this location: <installation_directory>/tutorial_models/Flux_plunger.
Important: The co-simulation process requires that the FLUX .FLU and .F2STA files be located in the same working directory. When naming the working directory, avoid spaces and special characters as Flux cannot recognize them.

Overview of the Flux Translation Motion Model

The Flux model is a plunger with one transient computation completed for the position of the plunger in a function of time. The coil of the plunger is supplied with constant voltage.

The plunger is comprised of three main components:
  • Upper grip
  • Lower grip
  • Coil

The inputs for the plunger are defined as multi-physical parameters and include:

  • Command: the control of the switch
  • I: the current in the coil conductor

The outputs for the plunger are scalar I/O settings that retrieve values through the sensors, formulas (forces and couples) and parameters (position, speed, acceleration).

The circuit of the plunger is configured with a voltage source, coil conductor, resistor and switch.

Figure 1. Plunger Electrical Circuit

Generating the Coupling Component in Flux

Load the Flux model and generate the coupling component with the required inputs, outputs and parameters.

  1. Launch Flux, and from your working directory, open the project, TRANSLATING_MOTION_COUPLING.F2STA.
    The model loads and looks something like this:
    Figure 2. Split View of Plunger
  2. From the Flux 3D toolbar, select Solving > Generate component for Twin Activate coupling.
  3. In the dialog, enter the following information for the component:
    • Enter the name for the component: TRANSLATION_MOTION_COUPLING.
    • Enter the path to your working directory: <name_without_spaces>.
    • Select the input (geometric I/O parameters) for the component: COMMAND
    • Select the output: I.

    The dialog should look something like this:

  4. Click OK.
    The coupling component is saved to your working directory as TRANSLATING_MOTION_COUPLINGF2STA.FLU.

Creating the Twin Activate Model

Create a Twin Activate model to regulate by hysteresis the current in the coil that feeds the Flux model of the plunger.

  1. From Twin Activate, create a new model and save it to your working directory as Translating_motion_coupling.scm.
    Alternatively, load the model: <installation_directory>/tutorial_models/Flux_plunger/Translating_motion_coupling.scm and skip this section of the tutorial.
  2. From the Palette Browser, select Activate > CoSimulation, and drag and drop one Flux block into your diagram.
  3. Double-click the Flux block, and in the block dialog, for Flux to Activate input filename, enter the path to the coupling component you generated from Flux: <working_directory>/TRANSLATING_MOTION_COUPLING.F2STA.
  4. Click OK.
    The Flux block populates with the model data from the Flux coupling component.
  5. For the last three fields in the Flux block dialog, enter these values:
    • For Numerical memory (MB), enter 4000.
    • For Character memory, enter 240.
    • For Minimal input variation %, enter 0.
  6. Click OK.
    The Flux block dialog should look something like this:
  7. In the diagram, add and define these blocks:
    Add blocks Define the block options with these values
    Time Default
    Display 1 Default
    Display 2 Default
    Display 3 Default
    Scope 1 Default
    Scope 2 Default
    Gain Gain = -1
    Sum Number of inputs = 2
    Step Generator

    Step time = .07

    Initial value = 1

    Final value = .075

  8. Assemble and connect the blocks as you see in the following figure, then save the model.
    Figure 3. Diagram Assembled with Flux Block

    The Twin Activate model is complete and configured to supply a current to the Flux model of the plunger.

Co-Simulating the Twin Activate and Flux Models

During co-simulation, the Twin Activate model supplies a current into the coil of the plunger.

  1. On the ribbon, select Setup.

  2. On the dialog that appears, select the Simulation Time tab.
  3. For Final Time, enter .2. Keep the defaults for the remaining fields.
  4. Select the Solvers tab.
  5. Select the Forward Euler solver, then click OK. Keep the defaults for the remaining fields.
  6. On the ribbon, select Run.

    The scopes in the Twin Activate model plot the simulation results of the current fed into the coil of the plunger.
    Figure 4. Current/Coil Conductor_1 (A) Without Regulation
    Figure 5. Current Coil Conductor With Regulation