Altium Designer畫的逆變控制板與逆變直流升壓電路原理圖和PCB圖如下:(51hei附件中可下載工程文件)
逆變電源設(shè)計概要 大家知道, 市電或其他的交流電可以通過二極管或可控硅的單向?qū)щ娦哉鞒芍绷麟姽┙o需要使用直流電的場合。這種把交流電變換成直流電的過程我們叫做整流,也叫做順變。那么逆變呢?我們自然地就會想到,應(yīng)該就是把直流電變換成交流電的過程。逆變電源就是相對于整流器而言通過半導(dǎo)體功率開關(guān)器件的開通和關(guān)斷把直流電變換成交流電的這么一個裝置。 逆變電源也叫做逆變器, 下面分單元地講一下逆變器主要的單元電路。 主要內(nèi)容為: 一.電池輸入電路 二.輔助電源電路 1. 12V 電池輸入的輔助電源電路 2. 24V-48V電池輸入的輔助電源電路 3. 多路隔離輔助電源電路 三.高頻逆變器前級電路的設(shè)計
1. 閉環(huán)前級變壓器匝數(shù)比的設(shè)計
2. 準開環(huán)前級變壓器匝數(shù)比的設(shè)計 四.高頻逆變器后級電路的設(shè)計
1. 米勒電容對高壓 MOS 管安全的影響及其解決辦法
2. IR2110應(yīng)用中需要注意的問題
3. 正弦波逆變器 LC 濾波器的參數(shù) 五.逆變器的部分保護電路 1. 防反接保護電路 2. 電池欠壓保護 3. 逆變器的過流短路保護電路的設(shè)計 4. IGBT 的驅(qū)動和短路保護
stm32單片機逆變器控制軟件源程序如下:
/****************************************************************
* Copyright (c) 2010 ,
* All rights reserved.
*
*
*文件名稱:
*文件標示:
*摘要 :
*當前版本:v1.0
*****************************************************************/
#include "includes.h"
#include "math.h"
__align(8) static OS_STK TaskStartStk[500];
__align(8) static OS_STK TaskLedStk[500];
#define START_PRIO 1u
#define LED_PRIO 5u
OS_EVENT * spk;
OS_EVENT * lcd;
OS_EVENT * time_10;
static void TaskStart( void *parg);
static void TaskLed(void *parg);
void MenusTask( void *parg);
int main()
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
OSInit();
spk=OSSemCreate( 1 );
lcd=OSSemCreate( 1 );
time_10=OSSemCreate( 1 );
OSTaskCreateExt( TaskStart,
(void *)0,
&TaskStartStk[500-1],
START_PRIO,
START_PRIO,
TaskStartStk,
500,
( void *)0,
OS_TASK_OPT_STK_CHK+OS_TASK_OPT_STK_CLR);
OSStart();
return 0;
}
#include "math.h"
static float x_est_last1 = 0;
static float P_last1 = 0;
/*/the noise in the system */
static float Q1 = 0.1;
static float R1 = 0.8;
static float K1;
static float P1;
static float P_temp1;
static float x_temp_est1;
static float x_est1;
static float z_measured1; /*/the 'noisy' value we measured */
// float z_real = 0.5; /*/the ideal value we wish to measure */
static float sum_error_kalman1 = 0;
static float sum_error_measure1 = 0;
static float kalman1(float z_real)
{
/*/do a prediction */
x_temp_est1 = x_est_last1;
P_temp1 = P_last1 + Q1;
/*/calculate the Kalman gain */
K1 = P_temp1 * (1.0/(P_temp1 + R1));
/*/measure*/
z_measured1 = z_real ;
x_est1 = x_temp_est1 + K1 * (z_measured1 - x_temp_est1);
P1 = (1- K1) * P_temp1;
sum_error_kalman1 += fabs(z_real - x_est1);
sum_error_measure1 += fabs(z_real-z_measured1);
P_last1 = P1;
x_est_last1 = x_est1;
return x_est1;
}
void halfword(FP32 j);
static void TaskStart( void *parg)
{
INT16U i=0,j=0,l=0;
FP32 vbat=0,k=0,oldk=0,dianliu=0,wendu=0;
(void)parg;
OS_CPU_SysTickInit();
OSStatInit();
OSTaskCreateExt( TaskLed,
(void *)0,
&TaskLedStk[500-1],
LED_PRIO,
LED_PRIO,
TaskLedStk,
500,
( void*)0,
OS_TASK_OPT_STK_CHK+OS_TASK_OPT_STK_CLR );
LedInit(); //初始化LED指示燈燈
PWMTimer(25000); //初始化PWM
DCOut(ENABLE);
ADC1_Configuration(); //采樣初始化
Getk_adc();
ReadCanShu();
OSTimeDlyHMSM( 0, 0, 1, 0 );
vbat=GetDC310();
gotoxy(0,0);
dprintf8("12");
k=310/vbat;
k=kalman1(k);
if(k<1)
{
halfword(k);
ban();
}
Time1Config(); //SPWM
SPWMState(ENABLE );
//halfword();
while(1)
{
OSTimeDlyHMSM( 0, 0, 0, 50 );
vbat=GetBATE();
if((vbat<10.5)||(vbat>14.5))
{
i++;
if(i==60)
while(1)
{
LedGreen(0);
WenKong(0);
DCOut(DISABLE);
SPWMState(DISABLE );
}
}
else
i=0;
dianliu=GetElectric();
if(dianliu>32)
{
j++;
if(j==40)
while(1)
{
LedGreen(0);
WenKong(0);
DCOut(DISABLE);
SPWMState(DISABLE );
}
}
else
j=0;
if(dianliu>55)
{
while(1)
{
LedGreen(0);
WenKong(0);
DCOut(DISABLE);
SPWMState(DISABLE );
}
}
if(dianliu>2)
WenKong(1);
if(dianliu<1.5)
WenKong(0);
vbat=GetDC310();
vbat=kalman1(vbat);
k=310/vbat;
//k=kalman1(k);
if(k<1)
{
halfword(k);
}
else
halfword(1);
}
}
float k_dianya=0.14143920; //電池電壓比例
extern volatile FP32 vref;
static void TaskLed(void *parg) //測試任務(wù)
{
INT32U j=0,b=0;
FP32 vbat=0,k=0;
//ADC_Config();
Init_ST7576();
//Usart1Init(9600);
DianLiuInit();
while(1)
{
LedGreen(1);
OSTimeDlyHMSM( 0, 0, 0, 500 );
LedGreen(0);
OSTimeDlyHMSM( 0, 0, 0, 500 );
Getk_adc();
vbat=GetBATE();
gotoxy(0,0);
dprintf("vbat=%0.2f ",vbat);
vbat=GetDC310();
gotoxy(0,2);
dprintf("DC=%0.2f ",vbat);
k=310/vbat;
gotoxy(0,4);
dprintf("k=%0.1f ",k);
k=GetWenDu();
gotoxy(0,6);
dprintf("wen=%0.1f",k);
k=GetElectric();
dprintf(" %0.1f",k);
if(GetAnJian()==0)
{
DCOut(DISABLE);
SPWMState(DISABLE );
OSTimeDlyHMSM( 0, 0, 3, 500 );
Getele();
SaveCanShu();
DCOut(ENABLE);
SPWMState(ENABLE );
}
}
}
復(fù)制代碼 SPWM數(shù)據(jù)生成軟件VB源程序如下:
VERSION 5.00
Begin VB.Form SPWM
Caption = "SPWM數(shù)據(jù)生成軟件(Howe.Chen)"
ClientHeight = 4560
ClientLeft = 120
ClientTop = 450
ClientWidth = 8310
Icon = "SPWM.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4560
ScaleWidth = 8310
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "清空結(jié)果"
Height = 615
Left = 7320
TabIndex = 18
Top = 3600
Width = 855
End
Begin VB.TextBox Text7
Height = 1695
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 17
Top = 2520
Width = 6855
End
Begin VB.TextBox Text4
Height = 375
Left = 6720
TabIndex = 9
Top = 1560
Width = 975
End
Begin VB.Frame Frame1
Caption = "參數(shù)設(shè)置"
Height = 2055
Left = 360
TabIndex = 1
Top = 120
Width = 6015
Begin VB.TextBox Text6
Height = 390
Left = 1560
TabIndex = 16
Top = 1440
Width = 1455
End
Begin VB.TextBox Text5
Height = 375
Left = 4320
TabIndex = 13
Top = 840
Width = 1335
End
Begin VB.TextBox Text3
Height = 375
Left = 1560
TabIndex = 7
Top = 840
Width = 735
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4800
TabIndex = 6
Top = 240
Width = 855
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 3
Top = 240
Width = 735
End
Begin VB.Label Label9
Caption = "調(diào)制度(M)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 15
Top = 1560
Width = 1335
End
Begin VB.Label Label8
Caption = "V"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5760
TabIndex = 14
Top = 960
Width = 255
End
Begin VB.Label Label7
Caption = "交流峰值電壓(Vsin)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2760
TabIndex = 12
Top = 840
Width = 1575
End
Begin VB.Label Label6
Caption = "V"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2400
TabIndex = 11
Top = 960
Width = 375
End
Begin VB.Label Label5
Caption = "直流BUS電壓(Vbus)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 10
Top = 840
Width = 1335
End
Begin VB.Label Label3
Caption = "半周期取樣點數(shù)(N)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 5
Top = 360
Width = 2295
End
Begin VB.Label Label1
Caption = "頻率(F)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 4
Top = 360
Width = 855
End
Begin VB.Label Label2
Caption = "Hz"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1920
TabIndex = 2
Top = 360
Width = 375
End
End
Begin VB.CommandButton CmdOutPut
Caption = "生成(CREATE)"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 6600
TabIndex = 0
Top = 240
Width = 1575
End
Begin VB.Label Label4
Caption = "PWM幅值"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6720
TabIndex = 8
Top = 1200
Width = 1095
End
End
Attribute VB_Name = "SPWM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Freq As Double
Dim Vbus As Double
Dim Vsin As Double
Dim M As Double
Dim N As Double
Dim PwmPeriod As Double
Dim K As Double
Const PI As Double = 3.1415926
Dim Out() As Double
Dim SpwmOut() As Integer
Private Sub CmdOutPut_Click()
On Error GoTo endsub
Dim i As Double
Dim w As Double
Dim temp1 As Double
Dim temp2 As Double
w = Freq * 2 * PI
temp1 = Cos(((1 - 1) * PI) / N)
temp2 = Cos((1 * PI) / N)
Out(1) = (M / w * (temp1 - temp2)) * 1000000
For i = 2 To N Step 1
temp1 = Cos(((i - 1) * PI) / N)
temp2 = Cos((i * PI) / N)
Out(i) = (M / w * (temp1 - temp2)) * 1000000 - Out(1)
Next i
Out(1) = 0
For i = 1 To N Step 1
SpwmOut(i) = CInt(PwmPeriod / (Out(N / 2 + 1)) * Out(i))
Next i
Text7.Text = ""
For i = 1 To N / 2 Step 1
Text7.Text = Text7.Text & "0x" & CStr(Hex(SpwmOut(i))) & ","
Next i
Text7.Text = Text7.Text & vbCrLf
For i = N / 2 + 1 To N - 1 Step 1
Text7.Text = Text7.Text & "0x" & CStr(Hex(SpwmOut(i))) & ","
Next i
Text7.Text = Text7.Text & "0x" & CStr(Hex(SpwmOut(N)))
Exit Sub
endsub:
MsgBox "Error", vbOKOnly, Error
End Sub
Private Sub Command1_Click()
Text7.Text = ""
End Sub
Private Sub Form_Load()
Text1.Text = 50
Text2.Text = 66
Text3.Text = 380
Text4.Text = 255
Text5.Text = 311
End Sub
Private Sub Text1_Change()
Freq = Val(Text1.Text)
End Sub
Private Sub Text2_Change()
N = Val(Text2.Text)
ReDim Out(N)
ReDim SpwmOut(N)
End Sub
Private Sub Text3_Change()
On Error Resume Next
Vbus = Val(Text3.Text)
M = Vsin / Vbus
Text6.Text = CStr(M)
End Sub
Private Sub Text4_Change()
PwmPeriod = Val(Text4.Text)
End Sub
Private Sub Text5_Change()
On Error GoTo endsub
If (Val(Text5.Text) > Vbus) Then
MsgBox "Vsin must be below Vbus", vbOKOnly, "Error"
Text5.Text = CStr(311)
Else
Vsin = Val(Text5.Text)
M = Vsin / Vbus
Text6.Text = CStr(CSng(M))
End If
endsub:
End Sub
Private Sub Text6_Change()
On Error GoTo endsub
If (Val(Text6.Text) > 1) Then
MsgBox "M must be Between 0 to 1", vbOKOnly, "Error"
Text6.Text = CStr(0.818421052631579)
Else
M = Val(Text6.Text)
Vsin = Vbus * M
Text5.Text = CStr(CSng(Vsin))
End If
endsub:
End Sub 復(fù)制代碼
|