Support : Knowledge base

Knowledge Base

Welcome to OPAL-RT’s Knowledge Base

OPAL-RT offers a repository of support information for optimal use of its technology.

Loading…

Please note that OPAL-RT knowledge base is not fully optimized for mobile platforms.

For optimal experience, use a desktop computer.

Reference Number: AA-02176// Views: AA-02176// Created: 2023-05-09 18:19:57// Last Updated: 2023-05-10 23:08:35
HowTo
HYPERSIM: How to Create a Multiport Switch in HYPERSIM based on Multiport Switch in MATLAB using a C Code block.

This article will introduce a C Code approach to model a multiport switch in HYPERSIM. The MATLAB version of the switch is not found in HYPERSIM as such. MATLAB users will be familiar with the following library block.

Figure 1: multiport switch in MATLAB

In Figure 1 above, the number of data ports that are being used are "5". It is recommended that the C Code block in HYPERSIM be used for programming switch cases in general.

In MATLAB, the first input (Mode) being passed into the switch is the control input.

The equivalent HYPERSIM C Code block is programmed as shown in Figure 2 below:

Figure 2: multiport switch equivalent code in HYPERSIM

In the case of HYPERSIM, only 4 inputs are needed and the control input is "u1". The default case is programmed to input "u3". 

The above code is flexible and can be modified accordingly.