Frequently Asked Question

Video: 3.1 Model Mapping in Compiler Console
Last Updated 3 years ago


Press "Ctrl + F" to find the keyword of your interest.

If you wish to have a direct link access to the video timestamps, please follow these instructions.

Found this video helpful? Why not take the whole HIL Specialist course? A Certificate is waiting for you for free at HIL Academy.

Would you or your organization benefit from having these videos narrated in your native language? Contact us and let us know if you wish to contribute.

TRANSCRIPT

00:00:02

Hello! In this video we will explain Model mapping,  

00:00:05

which will be practically demonstrated with the model we have been using throughout basic workflow module.  

00:00:12

Specifically, we will focus on different aspects of model compilation, which are necessary for  

00:00:17

using your HIL device optimally. Besides a practical demonstration, we will also cover  

00:00:23

the theoretical aspects of this topic necessary to apply this knowledge to more complex cases. 

00:00:30

First of all, let s discuss the basic system architecture of the HIL system.  

00:00:34

In order to have a simulation which runs in real time, we had to design our HIL  

00:00:38

system so it can execute calculations fast. Because of this, specific parts of the model  

00:00:44

simulation are predetermined to run on one of three separate units. These units exchange  

00:00:49

data in real time among themselves. You can see these units on the right part of the slide. 

00:00:56

Typhoon HIL simulators are based on a heterogeneous multi-processor  

00:01:00

architecture. Every HIL device has these three elements Typhoon FPGA solver, System CPU,  

00:01:07

and User CPU. If you want to understand the HIL architecture more comprehensively, take a look  

00:01:12

at the System architecture basics documentation page, which is listed in the video description. 

00:01:19

The Typhoon FPGA is a multi-core processor optimized for simulating  

00:01:24

the electrical domain part of the model in real-time.  

00:01:27

This means that every electrical circuit and all the components that comprise them such  

00:01:31

as passive elements, converters, machines, and others, are simulated by this circuit solver. 

00:01:39

In addition, there are two general purpose processors User CPU and System CPU.  

00:01:46

Depending on the HIL device they can be single or multi-core processors. The System CPU is typically  

00:01:52

used to either simulate low dynamics phenomena of certain electrical domain components or to handle  

00:01:57

communication protocol stacks. A few examples of components that utilize System CPUs are Voltage  

00:02:03

RMS, Single Phase Constant Power Load and Single Pole MP Circuit Breaker. In the vast majority  

00:02:09

of cases, there is no need to change any of the default parameters of the System CPU. 

00:02:16

In contrast, the User CPU is under direct user control. It executes sub-models composed  

00:02:22

of signal processing components, such as Gain, αβ to DQ transformations, Sums, among others. 

00:02:32

Now, let s see what this means for a real model. 

00:02:41

For the model you currently see on the screen, the same separation applies.  

00:02:46

The electrical part of the model is simulated by the FPGA circuit solver,  

00:02:50

which in this case includes: the voltage source, the three-phase inverter, the contactor, and the  

00:02:55

electrical machine. Control of the inverter, which is comprised of the sinusoidal sources,  

00:03:01

the Constant source, and the αβ to abc component, are simulated on the User CPU.  

00:03:07

The RMS current measurement in phase A is simulated on the System CPU. 

00:03:13

Why should you know how the model is mapped on the HIL device? First you  

00:03:17

need to know if your HIL device will meet the real-time requirements imposed by your model.  

00:03:22

In practice, this means that your model needs to compile successfully for the selected HIL device.  

00:03:28

For this to happen you need the basic knowledge of the system  

00:03:30

architecture in order to efficiently troubleshoot compiler errors. Also,  

00:03:35

managing your model s use of processing resources lets you utilize the hardware  

00:03:39

resources economically so that you get the most out of your HIL device. Now that this is clear,  

00:03:44

let s further explain the Typhoon FPGA solver architecture and constraints that it faces. 

00:03:54

Typhoon s FPGA circuit solver simulates the electrical circuit with a predefined time step,  

00:04:00

which can be set in Model settings, as shown in the 2.3.1 course sub-module. There are a  

00:04:06

couple of constraints which are imposed by the fact that the simulation is run in real time. 

00:04:12

The first one is that the simulation time step is discrete and fixed.  

00:04:16

This simulation time step can t be dynamically adjusted and we can t  

00:04:20

iterate our calculations in order to reach better simulation result. 

00:04:25

The second one is that time for computation is strictly limited.  

00:04:29

This means that all calculations must be finished before the next simulation step starts. 

00:04:37

The system architecture is shown on this slide.  

00:04:41

First, we will analyze the Standard Processing Core, sometimes referred to as SPC or simply  

00:04:47

the core. This is a basic building block of the circuit solver, which is in charge of simulating  

00:04:52

electrical circuits consisting of linear passive elements, converters, and contactors. 

00:04:59

Let s check how many SPCs we have in our model and what they consist of. 

00:05:09

In our model, we have only one SPC consisting of a resistor, a three-phase inverter, and a contactor.  

00:05:16

We can see this by checking the Messages log when we compile the model to see the list of all SPCs. 

00:05:34

You can currently see some elements corresponding to the SPC. This list is  

00:05:39

useful when performing model partitioning, which will be covered in a later module. 

00:05:45

Depending on the configuration of the device, we can have various amounts of SPCs in our model.  

00:05:50

As we are currently compiling our model for a HIL 404 with configuration 1,  

00:05:55

let s check how many SPCs we can fit.As you can see, for this configuration we have  

00:06:00

a maximum of 3 SPCs. If we go to the Device table which can be found in Model settings,  

00:06:06

we can check how many SPCs other configurations can support. As a reminder, the Device Table for  

00:06:12

a given model can be found in the Model Settings dialog box in the Model menu in Schematic Editor. 

00:06:23

You can see that if we want to have more SPCs, such as to simulate multiple converters,  

00:06:28

we should switch to Configuration 2 since it supports 4 SPCs.  

00:06:33

Configuration 3 offers a smaller amount of SPCs but has other benefits which may be useful for  

00:06:38

simulations with electrical machines. In short, changing the device configuration  

00:06:43

to provide more capacity can let you better use the FPGA solver resources. 

00:06:49

Let s now talk about the SPC s internal resources. 

00:06:54

On the left part of the slide, there is a visual overview of SPCs internal resources, while on the  

00:07:00

right part we have the Device Configuration table for HIL404. Different colors indicate  

00:07:06

relationship between device table parameter and specific SPC internal resources. Let s briefly  

00:07:12

talk about Typhoon approach to converter modelling before taking a closer look at Converter solver. 

00:07:20

The converters are modeled using ideal switches. Converters with more switches  

00:07:24

increase the computational load on the solver. We assign each converter  

00:07:28

a predefined weight to represent the magnitude of this computational load.  

00:07:32

More complex converters have a weight of 3, such as the three-phase inverter in our model,  

00:07:37

while simpler converters such as an IGBT Leg have a weight of only 1. We will take a deeper and  

00:07:42

more comprehensive look at modeling converters in the HIL for Power Electronics submodule. 

00:07:50

For each switch state permutation, our circuit model is considered to  

00:07:54

be linear and time-invariant. We call these permutations the mode  

00:07:57

of the circuit. For each mode of the circuit, we have designated a linear,  

00:08:02

time-invariant model which is discretized and represented by a state space matrix. 

00:08:09

Converter weight plays a significant role in the context of the Converter solver.  

00:08:14

Since all switch permutations within the converter will trigger a circuit mode change,  

00:08:18

we need a unit to determine what the next circuit mode will be. This unit is the Converter  

00:08:22

solver. However, as the weight of the converter increases, so does the number of circuit modes,  

00:08:28

which increases the load on the converter solver. Therefore, each configuration has a limit  

00:08:34

on the overall weight of converters per SPC.Let s check out what this means for our model. 

00:08:45

First let s enter into the Three Phase Inverter properties. In the description of the component,  

00:08:50

you can see that its weight is 3. Now when we check the messages log,  

00:08:56

we can see in the line Power Electronics Converter utilization that we reach the maximum  

00:09:00

possible weight for this configuration.Now, let s move to the contactor solver. 

00:09:07

Contactor states are determined by the contactor solver. They are also used for turning on and  

00:09:12

off delays, zero current turn off, and generating feedback signals. Similarly,  

00:09:18

to how we have a specific weight available per core, we also have specific number of contactors  

00:09:23

available for each core. This information can be found in the device table as well. 

00:09:30

Let s see what how many contactors we are able to put in our model. 

00:09:38

As you can see, we have only one single-phase contactor in this model. If we take a look at  

00:09:44

the messages log, we will notice that we are able to have up to six contactors in this SPC.  

00:09:49

It is important to note that three phase contactors still count as one contactor,  

00:09:54

since all three switches in the contactor work synchronously. 

00:09:59

Now, let s move to the Non-ideal switch solver.Non-ideal contactors are modeled as small  

00:10:06

inductances while they are conducting and small capacitances when they are open.  

00:10:10

The biggest advantage of including these is that you can fit many more non-ideal  

00:10:13

contactors than ideal contactors under certain configurations, but they should be used sparingly  

00:10:19

because the way they are modelled puts an extra load on time slot utilization. 

00:10:25

We currently don t have any non-ideal contactors in the model.  

00:10:29

If we take a look at the Message log, we ll notice that for the current configuration we have no  

00:10:34

available non-ideal switch utilization. Because of this, if we need to add non-ideal switches,  

00:10:40

we will have to switch to another configuration. 

00:10:44

Let s now discuss the time varying elements solver. 

00:10:47

If we want to simulate time varying elements, such as variable inductors,  

00:10:52

capacitors and resistors, which have an ability to change their values in real time,  

00:10:56

we need to employ the time-varying elements solver. 

00:11:04

As you can see in our model, we have no time variable elements in it.  

00:11:08

In the messages log, you can notice that we can fit up to sixteen time-varying elements. 

00:11:14

Now let s look at the rest of the SPC utilization parameters.  

00:11:23

The total number of signal processing controlled sources is limited to 16 per core,  

00:11:28

although we are not using any currently. Delayed controlled sources may appear as an  

00:11:32

embedded part of some components, such as super capacitors. For this specific configuration we  

00:11:40

can use up to 12 components that use delayed controlled sources. 

00:11:47

We are now left with the two parameters of the SPC which describe their performance abilities:  

00:11:52

matrix multiplier and matrix memory. 

00:11:57

Matrix multiplier processing power defines the minimum simulation step for a given model. 

00:12:04

The Matrix memory size defines the maximum size of the SPC, in terms of the number of passive  

00:12:09

components and ideal switches. Increasing the number of passive components increases  

00:12:14

the matrix size, and increasing the number of ideal switches results in additional matrices. 

00:12:22

Now we can analyze how these two performance parameters apply for our model.  

00:12:26

The memory requirements of our circuit is estimated during the compilation process.  

00:12:31

Each core has a specific amount of memory allocated to it.  

00:12:35

As you can see, our core only takes around a third of its designated memory. 

00:12:45

Matrix memory utilization is in direct correlation with two parameters in Device configuration table  

00:12:51

SPC matrix memory and SPC output memory size. If your core takes too much memory,  

00:12:57

you should seek a configuration which provides relatively larger values of these parameters. 

00:13:05

Aside from matrix memory, let s cover the matrix multiplier processing power.  

00:13:11

The value of the matrix multiplier processing power parameter directly  

00:13:15

reflects the SPC s ability to finish all calculations within one time step. 

00:13:25

As you can see in the messages log, this model has a predefined simulation step of 1 microsecond.  

00:13:31

After the matrices has been discretized with this time step, the timing constraint  

00:13:35

analysis begin. In this part, the compiler analyzes if all SPCs and other functional  

00:13:41

units could run on this time step, and time slot utilization is expressed in relative units. 

00:13:49

As you can see in timing constraint analysis part of messages log, none of our functional  

00:13:54

units exceed the maximum possible time slot of 100 percent. This means that timing  

00:13:59

constraints are met, and that this model will run successfully both on a HIL 404 or on virtual HIL. 

00:14:09

We have now analyzed all the resources that comprise a Standard Processing Core.  

00:14:13

Let s now analyze other resources that comprise Typhoon FPGA solver. 

00:14:21

The next functional unit within FPGA is the Signal generator. This unit is used  

00:14:26

to simulate independent sources such as voltage sources, current sources, constant power loads,  

00:14:32

and others. Since the Signal generator has a table based implementation, it supports  

00:14:37

arbitrary waveforms. These waveforms could be harmonically rich waveforms, created inside  

00:14:43

our SCADA or in our Waveform Generator tool.Let s see how is this implemented in our model. 

00:14:53

We currently have only one voltage source. In the messages log, we can  

00:14:57

see that we utilize only one signal generator out of a possible 12 for this configuration.  

00:15:02

It is important to mention that this utilization counts every signal source,  

00:15:06

regardless of if it is within a three-phase or single-phase component. For example, three-phase  

00:15:12

voltage source will take 3 units within signal generator, even though it is a single component. 

00:15:20

We should make distinction here between different types of sources.  

00:15:24

We previously mentioned that Signal Processing sources utilization as a core resource these  

00:15:29

sources have Signal Controlled prefix in their name and they utilize SPC resources. Basic signal  

00:15:35

sources, such as voltage source or current source which have no special prefix are FPGA resources.  

00:15:41

There are also two more types of sources voltage or current controlled which are  

00:15:45

sources controlled by measurements in other components or externally controlled sources,  

00:15:50

which are controlled from HIL analog inputs. These sources utilize only matrix memory. 

00:16:02

Look-up tables are another type of FPGA resource. We use these to simulate  

00:16:07

elements within an electrical circuit that have non-linear characteristics.  

00:16:11

Some elements that have Look-up tables within them are Non-linear inductors, PV panels, and  

00:16:16

batteries, among others. Every configuration has a specific number of Look-up tables it can support. 

00:16:27

We don t utilize any element that contains a Look-up table in our model,  

00:16:30

so in the messages log you can see that we use 0 out of the 8 possible for these elements. 

00:16:37

The capacity for look-up tables is available for any combination of components that needs them.  

00:16:42

For example, since we have a max of eight look-up tables, we could add three  

00:16:47

batteries and five non-linear inductors.Now we ll discuss Machine solver. This FPGA  

00:16:55

resource is a dedicated part of the processor which solves machine electro-magnetic state  

00:17:00

space equations in the D-Q or alpha-beta domains and solves the mechanical equations.  

00:17:05

In addition, the machine solver has built-in support for speed and position measurement devices  

00:17:10

such as an incremental encoder and resolver.You can see that we currently use one machine  

00:17:20

in our model the Induction machine with squirrel cage. Looking at our Machine solver utilization,  

00:17:27

we see that the Machine solver resource is fully occupied. 

00:17:33

The PWM Modulator is a FPGA resource which is used to generate PWM signals. When we  

00:17:40

want to control our model with an internal control algorithm, as we have done in our model, then it  

00:17:45

is very useful to utilize the PWM Modulator. PWM Modulators will be more comprehensively explained  

00:17:52

in the Power electronics module. For now, we ll just discuss the resources they take up. 

00:18:02

As you can see, we control this three-phase inverter by providing three modulation signals  

00:18:07

to the PWM Modulators. As you can see, we use 3 PWM channels out of a possible 12.  

00:18:14

This is because we have a Three-phase inverter, and each leg utilizes one of the PWM channels. 

00:18:24

The last step of the compiling is the timing validation. Timing validation checks if the  

00:18:29

FPGA solver can run a model with the required simulation step. If this part of the compilation  

00:18:35

is finished successfully, then you can be sure that the timing validation passed. 

00:18:43

This validation uses the device settings you defined for your model to define constraints,  

00:18:48

and applies it to both the physical and virtual devices. This means that if you successfully  

00:18:52

finish compiling the electrical part of the model and run it on virtual HIL in non-real-time,  

00:18:57

the same model will run in real time on the selected HIL device. Therefore, you  

00:19:02

can validate that your model will work on a real HIL device without having physical access to it. 

00:19:09

This concludes the compilation of the Electrical part of the model.  

00:19:15

If you want to learn more about FPGA solver, please take a look  

00:19:18

at the FPGA solver basics documentation page listed in the video description. 

00:19:25

The next part of the compile process is the compilation of the signal processing.  

00:19:30

This means that the compiler will generate code for both the User and System CPU. 

00:19:37

CPUs impose two boundaries on the signal processing  

00:19:41

the maximum memory available and the maximum number of specific signal processing elements,  

00:19:46

such as digital and analog probes, tunable elements, SCADA inputs and outputs, and others. 

00:19:55

As we previously mentioned, we do have a component which runs on the System CPU in our model:  

00:20:00

the RMS current meter in phase A. Inside the RMS meter there is one probe element, and as  

00:20:05

you can see in the messages log, it is counted in the Probes utilization line. In the second part  

00:20:10

of the compilation of signal processing we can see that the memory utilization is rather low. 

00:20:18

Next, we can inspect the compilation for the User CPU.

00:20:24

This paragraph in the messages log shows how the CPU is utilized. We have two SCADA inputs, which  

00:20:30

is reflected in the line IO variables utilization. Also, we have two probes, which is reflected  

00:20:36

in the Probes utilization. One of the probes is streaming, which is reflected in the line  

00:20:41

Streaming bandwidth, comparing the number of kilo Samples per second sent to the maximum capacity. 

00:20:48

Lastly, the memory utilization of the compiled model code is shown. 

00:20:54

This concludes the signal processing compilation and the whole compilation process in general.  

00:21:00

This means that now we are ready to load compiled model to SCADA and to begin simulation. 

00:21:06

Now you should have a detailed understanding of what is behind a successful model compilation. If  

00:21:11

you are interested in signal processing modeling principles, please take a look at the Signal  

00:21:16

processing modeling principles documentation page listed in the video description. In the  

00:21:21

next video, we will take you through some of the typical issues that new users encounter during  

00:21:25

the compilation process and how to solve them.

00:21:29

Thank you for your attention.

Please Wait!

Please wait... it will take a second!