GFM and GFL combing in one block using smart inverter and selector

Overview

I am using HYPERSIM to model GFM and GFL in one block using smart inverter library, and used a selector to determine whether GFM ot GFL is used.
But I does not work properly.
Please help me check it.

I am doing a microgrid simulation, and I want to build GFM and GFL inverters in one block.
I will use the selector to determine whether GFM or GFL works.
But it cannot work properly.

Model Specifications

Parameter Value
Product HYPERSIM
Simulation type Offline
Software version HYPERSIM 2026.2+
Model version 2026.2.3.o32
Application Energy
Model file GFL_GFM_one_block_20260814.zip
Recommended time step 50us

Downloads

Hello @Vincent_Jiang,

Thank you for reaching out.
To help us investigate and resolve the issue as quickly as possible, could you please re-export the project and upload the updated files? It appears that the project may not have been exported correctly, and some required information could be missing from the package we received.

Please refer to the guide below and follow the recommended export procedure to ensure all required project files are included:

How to Export Projects Correctly:
https://portal.opal-rt.com/Knowledge-Base/Article/?id=17bb144d-9356-ef11-bfe3-002248b1d264

Once you’ve uploaded the exported project, we’ll be happy to take a closer look and help you with the next steps.

Thank you for your cooperation. Please let us know if you encounter any difficulties during the export process.

@Party_Patel Thank you for your help. I have uploded the new file. Please see the download model.

@Vincent_Jiang
Thank you for sharing the newly exported folder. I reviewed the model and identified the root cause, along with a simpler implementation approach.

I noticed that you are currently using a Progressive Selector block. While the solution below can also be implemented with the Progressive Selector, if you do not require gain ramping or smooth switching between modes, I would recommend using a standard Selector block instead to keep the implementation simple and easier to troubleshoot.

Why the signals are not visible

The reason the signals are not appearing is that they are not connected correctly.

The reference signals from both the Grid Following (GFL) and Grid Forming (GFM) controllers are bundled signals (D_0, D_1, D_2). A Selector block can only process a single signal at a time and cannot directly operate on a bundled signal. Therefore, the bundled references must first be separated before they can be routed through the selector.

To achieve this, we will use three individual selector paths, one for each reference signal. At the same time, we can also clean up the model layout to make it more readable.

Step 1: Name the Signals

  • Bring the signals out of the GFL, GFM, and inverter reference blocks.
  • Go to: Home → Tools → Name
  • Select each signal line and assign a meaningful name.
    This will make signal routing much cleaner and reduce the number of long crossing wires in the schematic.


Repeat this process for all reference signals.

Step 2: Create a Dedicated Scenario Area

  • Copy the newly named reference signals and paste them into an empty section of the schematic. We’ll use this area as the scenario selection area.
  • Next, right-click on each signal and press Ctrl + B to create a breakout.
  • A breakout box similar to the one below will appear:

Step 3: Connect the Breakouts

  • Connect the breakout blocks to the corresponding signals.
  • While placing the breakouts, you may need to rotate them. Use: Ctrl + Alt + Y
  • When connecting, a Bundle Connection dialog will appear. Simply click OK.

After connecting all references, your schematic should look similar to this:

Step 4: Add the Selector Blocks

  • Add three Selector blocks, one for each reference signal (D_0, D_1, and D_2).
  • Connect them as shown below. I also added control signal connectors to improve signal routing and keep the schematic organized.

Step 5: Run the Model and Verify the Results

  • Run the simulation and verify each operating mode.

No Scenario Selected

GFL selected

GFM selected

You can also create a subsytem and save it as a personal library component.

I hope this clarifies the issue and helps you implement the scenario selection successfully. Please try the steps above and let me know if you encounter any difficulties or if the behavior differs from the results shown here.
Thanks

@Party_Patel Thank you for your help. It works. But I found another problem.
When I selected GFM mode (selector input =1) and the GFM is in grid connected mode.
The GFM output power cannot follow the Pref.
If I disable the GFL smart inverter blocks, the GFM output power will follow the Pref.
Even I use a new GFL smart inverter blocks, the GFM output power cannot follow the Pref (in GFM mode and grid connected).
Thank you.

As from the following picutres you can see that, I drew the GFL blocks from the library.
The first picutre: No GFL blocks
The second picture: only GFL blocks
The third picture: GFL blocks and one constant connected in Pr

The waveforms are GFM output currents and power.
As you can see in the first picture, the waveforms are very good (Pr=0.5pu, output power=abound 500kW).
In the second picture, the waveforms have some spike (Pu=0.5pu, output power=abound 500kW and some spike).
In the third picture, the waveforms become strange(Pu=0.5pu, outpu power become -800kW and some spike).
*Note: GFL blocks are not connected to the inverter.
I am not sure what happend.

@Party_Patel
I found the cause. I disabled the constant as shown below. The GFM will follow the Pref (in grid connected mode).