Frequently Asked Question

Video: 3.2 Problems & Solutions of Real-Time Model
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 the previous lesson, we discussed HIL architecture,  

00:00:06

model mapping, and how this impacts the way we design our models. So far, you ve seen only  

00:00:12

positive hardware utilization cases resulting in successful model compilation. In this video,  

00:00:17

we will teach you how to deal with less fortunate cases where you hit hardware limits and need to  

00:00:22

optimize your model in order to bring it to successful compilation and stable simulation.  

00:00:27

In addition to offline troubleshooting in the compiler console, you will also learn  

00:00:31

to troubleshoot your model during runtime in HIL SCADA. As you can see on the screen,  

00:00:36

we will demonstrate these typical situations using the model we have developed during this course.  

00:00:43

First, let s discuss matrix memory. A comprehensive explanation of matrix  

00:00:48

memory was given in lesson 3.1, Model mapping in compiler console.

00:00:53

There, it was pointed out that matrix memory defines the maximum size of the  

00:00:57

Standard Processing Core, or SPC, in terms of the number of passive  

00:01:02

components and in the number of ideal switches.Let s find out what would happen if we surpass the  

00:01:08

maximum matrix memory. In order to achieve this, lets add some passive elements and switches.  

00:01:16

We ll add two additional contactors and one variable passive load to the DC link.  

00:01:21

This load will be implemented as a simple variable resistor, with a SCADA input provided  

00:01:25

as its controller. Lastly, let s add a capacitor between the inverter and the rest of DC link.  

00:02:12

Now, when we compile the model, we ll receive an error that matrix memory utilization is  

00:02:17

over 100 percent, and that we should make the needed corrections and restart the compilation.  

00:02:24

What are the following steps we should implement to solve this issue? There are several ways  

00:02:28

we could deal with this. The main approach would be to partition the model into cores.  

00:02:33

As we are currently on HIL404, on configuration 1, we can see that we can have up to 3 Standard  

00:02:39

Processing Cores. So, let s make use of them and partition the circuit into two separate cores.  

00:02:46

In order to divide our model in two cores, we use an Ideal Transformer Coupling,  

00:02:51

or IT coupling. To do this, we will use the Single Phase Core Coupling component.  

00:03:02

By doing this, we now have two cores.  

00:03:08

In the first core, we have the voltage source, ideal switch,  

00:03:12

variable resistor, and capacitor. On the second core, we have the inverter,  

00:03:17

the remaining ideal switches, and the induction machine.  

00:03:51

Now, when we compile the model, we can see in the messages log that we have two cores.  

00:03:57

There are links to components that you can use to trace their location  

00:04:00

in the schematic and identify which sub-circuit belongs to which core.  

00:04:10

In the matrix memory utilization section, we can notice that matrix memory utilization  

00:04:15

has significantly dropped and the memory load is being shared between two cores.  

00:04:19

The compiler has now successfully finished compilation.  

00:04:25

Core couplings will be more comprehensively explained in lesson 3.3, Model partitioning.  

00:04:30

If you are interested in a more comprehensive explanation on performing model partitioning  

00:04:34

when matrix memory overloads, please check out our documentation, linked in the materials section.  

00:04:42

Let's also take this chance to look at the compiler log in more detail. As you can see,  

00:04:47

there are two tabs in the messages console the Output tab that contains both compiler report  

00:04:53

and warnings, and the second tab containing only warnings and errors. Let s go to the second tab.  

00:05:00

We'll address only the second warning the one warning us about a bad voltage loop.  

00:05:05

If you take a closer look, you ll realize that the meaning of this warning is to warn  

00:05:09

us that for a specific arrangement of the converter switches, the HIL won t provide  

00:05:13

correct simulation results. When we receive this error, we must be sure that our externally  

00:05:18

connected controller or our internally developed control won t bring our converter in this state.  

00:05:25

Let s determine what this means for our model. As the Boolean values in the brackets suggest,  

00:05:30

this warning is for the converter state where all the switches are closed and the contactors in  

00:05:34

front are open. Since our control algorithm will never bring our converter in this permutation,  

00:05:41

we don t have to worry about this error. There is a FAQ article linked in the materials section  

00:05:46

which contains a more comprehensive explanation of this warning and what to do in case it appears.  

00:05:52

Let’s now go back to the discussion about matrix memory utilization.

00:05:56

While IT coupling is a good way to our matrix memory utilization issue,  

00:06:01

it isn t the only way to address it. Let s reset our model and try a different method.  

00:06:07

The second approach we could take to deal with insufficient matrix memory is  

00:06:11

to choose a configuration or device which provides more matrix memory.  

00:06:15

Let s check possible configurations for HIL404.  

00:06:24

Unfortunately, all configurations offer the same matrix memory capabilities.  

00:06:29

Therefore, if you only have access to the HIL404, then you have no access to configurations which  

00:06:35

have more matrix memory. Let s see what configurations the HIL604 device offers.  

00:06:43

As you can see in the device configuration table,  

00:06:46

Configuration 4 of the HIL604 device offers much more matrix memory.  

00:06:51

Therefore, let s choose HIL604 with configuration 4 and see how it handles our model.  

00:07:22

Now, when we try to compile, we finish the compilation successfully.  

00:07:26

Notice that this is done on a single core, which was not possible on HIL404, configuration 1.  

00:07:34

It s important to note that we can perform these compilation tests without actually connecting to a  

00:07:39

HIL device, simply by setting the desired hardware configuration and compiling the model. This  

00:07:45

means that if you have a specific model in mind before purchasing or leasing a HIL device, you  

00:07:50

can already begin to build it to determine which HIL device or devices are right for your needs.  

00:07:56

The last solution to consider could be that we reduce the model by removing components that  

00:08:00

are nonessential to the model behavior. However, reducing your model should be considered only as a  

00:08:08

last resort, as this may affect model fidelity.Next, we ll discuss how to deal with possible  

00:08:15

problems that may occur during time slot utilization. This utilization is tied  

00:08:20

to the matrix multiplier, as was explained in lesson 3.1, Model mapping in compiler console.  

00:08:27

As we are now using a HIL604 with configuration 4, let s try to simulate  

00:08:32

this model with a simulation time step of half of microsecond. We ll change this in model settings.  

00:08:44

Now, when we try to compile this model, we are notified that timing constraints are not met.  

00:08:57

There are two time slot utilizations which surpassed the limit time slot utilization of  

00:09:02

core0 and time slot utilization of the machine.Let s discuss the time slot utilization of core0. 

00:09:12

The most effective solution for time utilization of core  

00:09:15

zero would be to split the model in two cores.  

00:09:46

However, this would still not solve the second issue of time slot utilization of the machine.  

00:09:53

An alternative solution for time slot utilization of the core would  

00:09:56

be to change to a configuration which offers more peak processing power.  

00:10:00

Since we are on HIL604, configuration 4, we can try switching to another configuration.  

00:10:12

As you can see, by using configuration 5, we would increase the amount of peak  

00:10:17

processing power, which would decrease the time slot utilization of the core.  

00:10:23

Still, this wouldn t be enough to address the machine time slot utilization issue.  

00:10:31

Reducing the number of elements in the model would help solve time slot utilization issues,  

00:10:36

but again should only be used as a last resort.  

00:10:41

There are several solutions which could solve both issues with time slot utilization  

00:10:46

core and machine. The simplest way would be to increase the simulation time step, since  

00:10:51

currently we are trying to simulate the model with a simulation time step of half microsecond.  

00:10:56

Increasing this to one microsecond would solve the time slot utilization issues. However,  

00:11:03

if an application demands a smaller timestep, we can still try to optimize the model by  

00:11:08

replacing the VBR induction machine with a regular current source-based model.  

00:11:12

For successful compilation, we would have to change the calculation method to constrain matrix.  

00:11:18

In this way we ve made the whole model capable of running on half a microsecond.  

00:11:47

We should note that this wasn't an issue when we were using the HIL404 device. Although the  

00:11:52

HIL404 device offers smaller capabilities in terms of memory and maximum model size, it offers much  

00:11:58

better circuit solver possibilities, allowing it to run this model at a half of a microsecond.  

00:12:13

Let’s switch back to HIL404.

00:12:25

Let’s now compile the model. 

00:12:36

As you can see, this model is successfully compiled for the HIL404 device.  

00:12:41

Exercises like these can help you find a perfect HIL device for your  

00:12:44

model and eliminate any mistakes from your purchase decision.  

00:12:50

Now, let's cover some of the more common issues you might encounter during model creation.  

00:12:56

We'll first expand our model in order to fully resemble a drive setup.  

00:13:00

In order to do this, let s replace our DC voltage source,  

00:13:04

switch, and variable resistor with a Three Phase Voltage Source component with passive  

00:13:09

components on each phase, in order to model a grid. We ll set the RMS Voltage to 230V.  

00:13:16

Then, let's connect a Three Phase Diode Rectifier, which we can connect to the DC bus. Lastly,  

00:13:23

we will attach the single phase core coupling, this time connecting the red side to the inverter,  

00:13:28

in order to divide this drive setup into multiple cores and finish compilation successfully.  

00:14:45

When we go to the SCADA and start simulation, the Arithmetic overflow flag is raised,  

00:14:50

and simulation results are far from correct. The reason why this is happening is because the  

00:14:55

IT coupling is oriented incorrectly. For now, we can fix this by flipping the IT coupling.  

00:15:01

We will cover the root causes for this issue in detail in lesson 3.2.1 Topological conflicts  

00:15:06

and model degenerations, and we will cover Model partitioning in much more detail in lesson 3.3.  

00:15:14

Incorrect coupling placement isn t the only possible cause of this issue.  

00:15:18

Electrical machines can also cause arithmetic overflow when the snubbers of the machine are  

00:15:23

incorrectly calculated inside the machine component. Arithmetic overflow can also  

00:15:28

occur because a potential load is applied to the machine while the load torque exceeds the  

00:15:32

electrical torque, causing the machine speed to go over the calculation limit.  

00:15:39

A useful component during debugging of arithmetic overflow is the HIL Flag  

00:15:43

status. Let s return to Schematic Editor and drag and drop it into our model and connect  

00:15:44

the outputs we want to track to Digital Probes. The HIL Flag status provides binary signals at  

00:15:47

the outputs that refer to the type of arithmetic overflow that is occurring, and whether it s a  

00:15:52

core or machine arithmetic overflow. If you want to learn more about arithmetic  

00:15:56

overflow and what causes it, please check our FAQ article listed in the video description.  

00:16:03

Now let us discuss other issues which may occur.  

00:16:07

When Signal processing was discussed previously during this course, we mentioned that we define  

00:16:12

the execution rate of signal processing. For example, this simple control algorithm which we  

00:16:18

created in order to control Three Phase inverter has an execution rate of 100 micro seconds.  

00:16:24

What if we set an execution rate to be too small for the CPU to guarantee real-time computation?  

00:16:29

If the CPU can t manage to run this code in the given time slot,  

00:16:33

we will be warned in HIL SCADA by the computing interval overrun or CIO flag.  

00:16:40

Let's experience this by decreasing the execution rate of our control algorithm to one microsecond.  

00:17:21

As you can see, compilation finishes successfully but when we run our simulation,  

00:17:26

the CIO flag pops up, warning us that the control  

00:17:29

algorithm can t be executed in the given time slot of 1 microsecond.  

00:17:44

As a rule of thumb, most power electronics models should not have an execution rate  

00:17:48

below 10 microseconds and most microgrid models should not go below 100 microseconds.  

00:17:54

However, the 4th generation HIL404 and HIL606 can grant you even faster execution rates.  

00:18:01

This troubleshooting process can only be done on a real HIL device, since CIO issues only  

00:18:06

occur during real-time simulation. If you want to learn more about the CIO flag, please check  

00:18:12

out the link to our time slot utilization documentation in the materials section.  

00:18:18

By combining this knowledge with what we covered in lesson 3.1 Model  

00:18:21

mapping in the compiler console, we can identify two types of time validation.  

00:18:26

Electrical domain time validation is done statically, where the compiler determines  

00:18:31

if the FPGA can run the solver with the required simulation step. Meanwhile, signal processing time  

00:18:37

validation is done dynamically as we just saw. It's for this reason that the compiler will prevent  

00:18:43

you from starting a simulation with an electrical domain simulation step which is too small,  

00:18:48

but only notifies you of an inadequate signal processing time step during simulation.  

00:18:54

This lesson covered the most common issues you may come across during compilation and simulation. We  

00:19:00

looked at circuit partitioning components, which are the most effective and most important tools  

00:19:04

for resolving circuit solver overutilization. You will have a series of dedicated lessons devoted  

00:19:10

to them later in this module. However, since the number of device cores is limited, they should be  

00:19:15

used economically. This is why you need to know about the alternative solutions and modeling  

00:19:20

tricks we covered in this lesson. If you want to learn more about these issues, please refer to the  

00:19:25

Knowledge Base articles provided in the materials.

00:19:30

Thank you for your attention.

Please Wait!

Please wait... it will take a second!