当前位置:网站首页>Inverter Simulink model -- processor in the loop test (PIL)
Inverter Simulink model -- processor in the loop test (PIL)
2022-07-02 09:38:00 【Quikk】
List of articles
inverter simulink Model —— Processor in the loop test (PIL)
1 Basic idea of processor in the loop testing
1.1 Basic introduction of simulation model
During the simulation of normal power electronic system , The structure is mainly divided into main circuit + Control circuit ; The control circuit is generally divided into acquisition circuit and control core .

Take the inverter control system as an example :
DC side voltage source , Three phase inverter unit , filter , The load belongs to the main circuit ;
take 220V The voltage level is converted to the control unit ADC Collectable 0-3.3V Low voltage conditioning circuit is called acquisition circuit ;
take 0-3.3V pulse PWM The signal is converted to IGBT Driving signal (0-24V) The driving circuit of ;
The control core is generally composed of system on chip , Such as STM32、2833X And other basic computing cores ;
Next, let's introduce the basic principle of simulation , Whether the control circuit or the main circuit is simulink in They are all obtained by numerical calculation . And in the actual system : The main circuit is a real circuit , The control circuit is generally 10k,50k And other fixed frequency control units . In order to realize the simulation of this situation , It is necessary to minimize the calculation step of the main circuit , In order to achieve the purpose of simulating continuous system , And the control system must maintain Normal sampling frequency . Take a particle : If take Slover In steps of 10e-7; Then the external main circuit is represented by 10e-7 The step size is calculated once ; The control unit is 10e-4(10k); You need to 1000 An external step is calculated once for the internal element .
1.2 Processor in the loop test concept
In the actual simulation process , A large number of controllers and external main circuits are PC Terminal CPU To do the operation on . But the actual situation is that the dominant frequency of microprocessors is often much lower than that of computers CPU, The output results may be different from the real situation . However, it often needs lot of time , So you can build ** Processor in loop (PIL)** The test plan of the bottom layer MCU Analyze the operation .
Processor in the loop test , It is to calculate the main circuit in CPU On the implementation , The control circuit operation will be at the bottom MCU On the implementation . The basic process is :
PIL After starting ,MCU Received by PC All kinds of data transmitted ;
MCU Calculate according to the data to get PWM Output the signal and transmit it to PC End ;
PC Termination received PWM After the signal , Apply it to the main circuit , The state of the main circuit changes , Continue to repeat the second step (1) Step
The specific implementation of this scheme will be introduced below ;
2 Processor in the loop test process
2.1 Test model introduction
The test model uses the off grid inverter control model ; Model links : Model links
The output voltage waveform under the normal off grid state is shown in the figure ,0.1s Turn on the load supply switch ;0.8s Perform power step ;

2.2 Introduction to basic structure
PIL The system composition needs to ensure the system connection :1) Bottom hardware download port and matlab Keep connected 2) Bottom hardware serial port and matlab Keep connected ; Build the hardware platform shown in the figure below

2.3 Model settings
The model needs to be configured before setting MCU Code generation environment , Please refer to : Environment building
1) Create a processor in the loop model








notes : Make sure that COM9, Baud rate , Etc , Ensure smooth communication , Prevent in ring test failure .
2.4 In loop test module generation
Package the control module into subsystems , Post generation PIL modular ; At this time, we need to slover step and Powergui Step size of It's also set to 10e-4; And set up Initial communication status , Enter the following code on the command line and execute , Be sure to pay attention to The serial port information corresponds to the information in the device management ;
setpref('MathWorks_Embedded_IDE_Link_PIL_Preferences','COMPort','COM9');
setpref('MathWorks_Embedded_IDE_Link_PIL_Preferences','BaudRate',115200);
setpref('MathWorks_Embedded_IDE_Link_PIL_Preferences','enableserial',true);

Pop up the dialog box and click build that will do ( We need to pay attention to ,MCU It can only run Single Type variable , The variables in the control module need to be changed to single type ):

Pop up the generated PIL Model , Copy the model to the original file .

2.5 Model test

Get into SIL/PIL manager

Modify the simulation step size to 10e-6;

Set up PIL Parameters :

Click on run Verification
3 test result

After the test, get the above results , The result is divided into a software simulation result , One PIL In loop test results . At this point, you can compare the differences . compare You can also compare the differences between the two under the column .
Hardware :dsp28335
PC:simulink r2019b
Use serial port SCIA communicate
simulation model , I need to take it myself :PIL In loop model
The above process effectively realizes PIL test , The specific steps are generally shown in the figure , It should be noted that the generation PIL The test module must modify the model step size ( Change to controller execution step ). When testing , Be sure to change back to the original step .
边栏推荐
- Chrome视频下载插件–Video Downloader for Chrome
- 微服务实战|原生态实现服务的发现与调用
- C语言之最小数
- Micro service practice | introduction and practice of zuul, a micro service gateway
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- Required request body is missing: (cross domain problem)
- hystrix 实现请求合并
- Amq6126 problem solving ideas
- CKEditor 4.10.1 上传图片提示“不正确的服务器响应” 问题解决
- [go practical basis] how to customize and use a middleware in gin
猜你喜欢

BugkuCTF-web24(解题思路及步骤)

Customize redis connection pool

Matplotlib swordsman - a stylist who can draw without tools and code

破茧|一文说透什么是真正的云原生

tinyxml2 读取和修改文件

TD联合Modelsim进行功能仿真

Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)

深入剖析JVM是如何执行Hello World的

互联网API接口幂等设计
![[go practical basis] gin efficient artifact, how to bind parameters to structures](/img/c4/44b3bda826bd20757cc5afcc5d26a9.png)
[go practical basis] gin efficient artifact, how to bind parameters to structures
随机推荐
别找了,Chrome浏览器必装插件都在这了
What are the differences between TP5 and laravel
Matplotlib swordsman line - layout guide and multi map implementation (Updated)
TD联合Modelsim进行功能仿真
View the port of the application published by was
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
Microservice practice | fuse hytrix initial experience
BugkuCTF-web16(备份是个好习惯)
Double non undergraduate students enter the factory, while I am still quietly climbing trees at the bottom (Part 1)
CKEditor 4.10.1 上传图片提示“不正确的服务器响应” 问题解决
Matplotlib swordsman line - first acquaintance with Matplotlib
What are the waiting methods of selenium
三相并网逆变器PI控制——离网模式
Timed thread pool implements request merging
告别996,IDEA中必装插件有哪些?
Thinkphp5 how to determine whether a table exists
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
Long summary (code with comments) number structure (C language) -- Chapter 4, string (Part 1)
Redis 序列化 GenericJackson2JsonRedisSerializer和Jackson2JsonRedisSerializer的区别
vs+qt 设置应用程序图标