Skip to content

Commit

Permalink
burn version v1.5.0
Browse files Browse the repository at this point in the history
 1. Add SkinDepth Calculate
 2. Add ResistanceDC Calculate
 3. Add SkineffectFactor Calculate
 4. Add ResistanceAC Calculate
 5. Add Quality factor(Q) Calculate
  • Loading branch information
sndnvaps committed Apr 4, 2019
1 parent ba78d4e commit 9e9f669
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 33 deletions.
8 changes: 2 additions & 6 deletions README.md
Expand Up @@ -16,13 +16,9 @@ go-bindata -pkg main -o images_bindata.go images #生成文件为images_bindata
3. 计算次级线圈与初级线圈的耦合系数
4. 计算电弧长度
5. 计算顶端电容(球形,环形顶端电容)
6. 计算品质系数Q

准备添加的功能:

1. 添加计算次级线圈品质系数(Q)的计算功能, 公式为
Q = (2*Pi*f*L)/R



Support platform(Qt 5.11.1)
```
Linux
Expand Down
214 changes: 187 additions & 27 deletions SecCoilInfo.go
Expand Up @@ -62,8 +62,8 @@ import (
* s3 = 次级线圈寄生电容 (pf)
* s4 = 在不加均压环的状态下的 谐振频率 (hz)
*/
func SecCoilInfoCal(IFormHight, IFormDiameter, IWireDiameter string) [4]string {
var output [4]string = [4]string{"0.0", "0.0", "0.0", "0.0"} //默认初始化值为全部 0.0
func SecCoilInfoCal(IFormHight, IFormDiameter, IWireDiameter string) [9]string {
var output [9]string = [9]string{"0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0"} //默认初始化值为全部 0.0
//当三个参数,都不为空的时候
if (strings.Compare(IFormHight, "") != 0) && (strings.Compare(IFormDiameter, "") != 0) && (strings.Compare(IWireDiameter, "") != 0) {
IFormHight_x, _ := strconv.ParseFloat(IFormHight, 32)
Expand All @@ -73,30 +73,43 @@ func SecCoilInfoCal(IFormHight, IFormDiameter, IWireDiameter string) [4]string {
turns := SecCoilTurns(IFormHight_x, IWireDiameter_z) //箍数
Induct := SecInduct(turns, IFormHight_x, IFormDiameter_y) //电感
Cap := SecCap(IFormHight_x, IFormDiameter_y) //电容
Resonant := SecResonant(Cap, Induct)
Resonant := SecResonant(Cap, Induct) //Frequency
skindepth := SkinDepth(Resonant)
resistanceDC := ResitanceDC(IWireDiameter,IFormDiameter,turns)
skinEffectFactor := SkinEffecFactor(IWireDiameter,skindepth)
resistanceAC := ResitanceAC(skinEffectFactor,resistanceDC)

QFactor := SecQFactor(Resonant,Induct,resistanceAC) //Sec Coil Quality Factor

output[0] = turns
output[1] = Induct
output[2] = Cap
output[3] = Resonant
output[4] = skindepth
output[5] = resistanceDC
output[6] = skinEffectFactor
output[7] = resistanceAC
output[8] = QFactor

return output
}
//返回 slice string
return [4]string{"0.0", "0.0", "0.0", "0.0"}
return [9]string{"0.0", "0.0", "0.0", "0.0", "0.0","0.0","0.0", "0.0", "0.0"}
}

/*
*@parame
* FormHight -> 线圈的高度, 单位 cm
* WireDiameter -> 次级线圈的线径, 单位 mm
* Wire spacing = WireDiameter / 10
*@return
* string -> 次级线圈的箍数 (FormHight * 10 / (WireDiameter + 0.01))* 0.97 //此处的0.97为修正系数,因为考虑的手工绕线的情况
* string -> 次级线圈的箍数 (FormHight * 10 / (WireDiameter + WireDiameter/10))//此处的0.97为修正系数,因为考虑的手工绕线的情况
*/

func SecCoilTurns(FormHight, WireDiameter float64) string {
MagnetWireDiameter := WireDiameter //毫米
IFormHeight := (FormHight * 10.0) //将厘米转换成 毫米
output := (1 / (MagnetWireDiameter + 0.01)) * IFormHeight * 0.97
output := (1 / (MagnetWireDiameter + MagnetWireDiameter/10 )) * IFormHeight
return fmt.Sprintf("%0.6f", output)
}

Expand All @@ -113,7 +126,7 @@ func SecCap(FormHight, FormDiameter float64) string {
IFormHeight := (float64)(FormHight * 10.0) //将厘米转换成 毫米
IFormDiameter := (float64)(FormDiameter) // 毫米
Radius := IFormDiameter / 2 //线管的半径,单位毫米
cs := 5.08 * Radius / u * (0.0563*((IFormHeight/u)/(Radius/u)) + 0.08 + 0.38*math.Sqrt(1/((IFormHeight/u)/(Radius/u))))
cs := 5.08 * (Radius / u )* (0.0563*((IFormHeight/u)/(Radius/u)) + 0.08 + 0.38*math.Sqrt(1/((IFormHeight/u)/(Radius/u))))
return fmt.Sprintf("%0.6f", cs)
}

Expand Down Expand Up @@ -147,6 +160,93 @@ func SecResonant(SecCap, SecInduct string) string {
output := (float64)(1 / (2 * math.Pi * math.Sqrt((seccap_x*math.Pow(10, -12.0))*(secinduct_y*math.Pow(10, -6.0))))) //谐振频率 (hz)
return fmt.Sprintf("%0.6f", output)
}

/*
*@parame
* Fres -> Frequency of sec coil(hz)
* return
* string -> skin depth (m)
* output = math.Sqrt((0.0179*math.Pow(10,-6)/(math.Pi*math.Pow(10,-7))))*(1/(math.Sqrt(Fres)))
*/
func SkinDepth(Fres string) string {

fres,_ := strconv.ParseFloat(Fres,64)
output := math.Sqrt((0.0179*math.Pow(10,-6))/(4*math.Pi*math.Pi*math.Pow(10,-7)))*(1/(math.Sqrt(fres)))
return fmt.Sprintf("%0.8f", output)
}

/*
*@parame
* WireDia -> mm
* CoilDia -> mm
*
*/
func ResitanceDC(WireDia,CoilDia,Turns string) string {
CoilDia_x, _ := strconv.ParseFloat(CoilDia,64)
Turns_x, _ := strconv.ParseFloat(Turns,64)
WireDia_x, _ := strconv.ParseFloat(WireDia,64)
output := (4*(CoilDia_x/1000)* Turns_x *(0.0179*math.Pow(10,-6)))/((WireDia_x/1000)*(WireDia_x/1000))
return fmt.Sprintf("%0.8f", output)
}


/*
*@parame
* WireDia -> mm
* SiknDepth -> m
*return
* output ->
* if(SkinDepth * 1000) > (WireDia/2) ->= 1
* else
(((WireDia/1000)^2)/(4*(((WireDia/1000)*SkinDepth) - (SkinDepth^2))))
*
*/
func SkinEffecFactor(WireDia,SkinDepth string) string {
WireDia_x, _ := strconv.ParseFloat(WireDia,64)
SkinDepth_x, _ := strconv.ParseFloat(SkinDepth,64)
var output float64 = 0.0
if (SkinDepth_x * 1000) > (WireDia_x/2) {
output = 1.0
} else {
output = math.Pow((WireDia_x/1000.0),2)/(4*(((WireDia_x/1000.0)*SkinDepth_x) - (math.Pow(SkinDepth_x,2))))
}
return fmt.Sprintf("%0.6f", output)
}


/*
*@parame
* skinEffectFactor ->
* resitanceDC-> ohm
*@return
* output -> ohm
*
*/
func ResitanceAC(skinEffectFactor,ResistanceDC string) string {

skineffect, _ := strconv.ParseFloat(skinEffectFactor,64)
resistanceDC, _ := strconv.ParseFloat(ResistanceDC,64)
output := resistanceDC * skineffect * 3
return fmt.Sprintf("%0.4f", output)
}

/*
*@parame
* Fres -> hz
* Induct -> uH
* ResitanceAC -> ohm
*@return
* output -> Quality Factor of Secondaly coil -> Q
* output = (2 * math.Pi * Fres *(Induct/1000000))/ResitanceAC
*/
func SecQFactor(Fres,Induct,ResitanceAC string) string {
fres, _ := strconv.ParseFloat(Fres,64)
induct, _ := strconv.ParseFloat(Induct,64)
resitanceAC, _ := strconv.ParseFloat(ResitanceAC,64)
output := (2 * math.Pi * fres *(induct/1000000))/resitanceAC
return fmt.Sprintf("%0.4f", output)
}

func SecCoilInfoForm() {

label := ui.NewLabel()
Expand All @@ -166,23 +266,48 @@ func SecCoilInfoForm() {

label4 := ui.NewLabel()
label4.SetText("次级箍数")
inputbox4 := ui.NewLineEdit()
inputbox4.SetReadOnly(true)
outputbox1 := ui.NewLineEdit()
outputbox1.SetReadOnly(true)

label5 := ui.NewLabel()
label5.SetText("次级线圈电感(μH)")
inputbox5 := ui.NewLineEdit()
inputbox5.SetReadOnly(true)
outputbox2 := ui.NewLineEdit()
outputbox2.SetReadOnly(true)

label6 := ui.NewLabel()
label6.SetText("次级线圈寄生电容(pf)")
inputbox6 := ui.NewLineEdit()
inputbox6.SetReadOnly(true)
outputbox3 := ui.NewLineEdit()
outputbox3.SetReadOnly(true)

label7 := ui.NewLabel()
label7.SetText("不加均压环的谐振频率(Hz)")
inputbox7 := ui.NewLineEdit()
inputbox7.SetReadOnly(true)
outputbox4 := ui.NewLineEdit()
outputbox4.SetReadOnly(true)

label8 := ui.NewLabel()
label8.SetText("趋肤深度(m)")
outputbox5 := ui.NewLineEdit()
outputbox5.SetReadOnly(true)

label9 := ui.NewLabel()
label9.SetText("次级电阻值(ohm)")
outputbox6 := ui.NewLineEdit()
outputbox6.SetReadOnly(true)

label10 := ui.NewLabel()
label10.SetText("趋肤效应因子")
outputbox7 := ui.NewLineEdit()
outputbox7.SetReadOnly(true)

label11 := ui.NewLabel()
label11.SetText("交变阻抗(ohm)")
outputbox8 := ui.NewLineEdit()
outputbox8.SetReadOnly(true)

label12 := ui.NewLabel()
label12.SetText("Q值(Q)")
outputbox9 := ui.NewLineEdit()
outputbox9.SetReadOnly(true)

//计算结果
CalBtn := ui.NewPushButton()
Expand All @@ -192,10 +317,15 @@ func SecCoilInfoForm() {
//当两个都不为空的时候,弹出显示框
if (strings.Compare(inputBox.Text(), "") != 0) && (strings.Compare(inputBox2.Text(), "") != 0) && (strings.Compare(inputBox3.Text(), "") != 0) {
output := SecCoilInfoCal(inputBox.Text(), inputBox3.Text(), inputBox2.Text())
inputbox4.SetText(output[0])
inputbox5.SetText(output[1])
inputbox6.SetText(output[2])
inputbox7.SetText(output[3])
outputbox1.SetText(output[0])
outputbox2.SetText(output[1])
outputbox3.SetText(output[2])
outputbox4.SetText(output[3])
outputbox5.SetText(output[4])
outputbox6.SetText(output[5])
outputbox7.SetText(output[6])
outputbox8.SetText(output[7])
outputbox9.SetText(output[8])

} else {
messagebox := ui.NewMessageBox()
Expand All @@ -204,10 +334,15 @@ func SecCoilInfoForm() {
inputBox.Clear()
inputBox2.Clear()
inputBox3.Clear()
inputbox4.Clear()
inputbox5.Clear()
inputbox6.Clear()
inputbox7.Clear()
outputbox1.Clear()
outputbox2.Clear()
outputbox3.Clear()
outputbox4.Clear()
outputbox5.Clear()
outputbox6.Clear()
outputbox7.Clear()
outputbox8.Clear()
outputbox9.Clear()
}

})
Expand All @@ -229,19 +364,39 @@ func SecCoilInfoForm() {

hbox5 := ui.NewHBoxLayout()
hbox5.AddWidget(label4)
hbox5.AddWidget(inputbox4)
hbox5.AddWidget(outputbox1)

hbox6 := ui.NewHBoxLayout()
hbox6.AddWidget(label5)
hbox6.AddWidget(inputbox5)
hbox6.AddWidget(outputbox2)

hbox7 := ui.NewHBoxLayout()
hbox7.AddWidget(label6)
hbox7.AddWidget(inputbox6)
hbox7.AddWidget(outputbox3)

hbox8 := ui.NewHBoxLayout()
hbox8.AddWidget(label7)
hbox8.AddWidget(inputbox7)
hbox8.AddWidget(outputbox4)

hbox9 := ui.NewHBoxLayout()
hbox9.AddWidget(label8)
hbox9.AddWidget(outputbox5)

hbox10 := ui.NewHBoxLayout()
hbox10.AddWidget(label9)
hbox10.AddWidget(outputbox6)

hbox11 := ui.NewHBoxLayout()
hbox11.AddWidget(label10)
hbox11.AddWidget(outputbox7)

hbox12 := ui.NewHBoxLayout()
hbox12.AddWidget(label11)
hbox12.AddWidget(outputbox8)

hbox13 := ui.NewHBoxLayout()
hbox13.AddWidget(label12)
hbox13.AddWidget(outputbox9)

vbox := ui.NewVBoxLayout()
vbox.AddLayout(hbox)
Expand All @@ -252,6 +407,11 @@ func SecCoilInfoForm() {
vbox.AddLayout(hbox6)
vbox.AddLayout(hbox7)
vbox.AddLayout(hbox8)
vbox.AddLayout(hbox9)
vbox.AddLayout(hbox10)
vbox.AddLayout(hbox11)
vbox.AddLayout(hbox12)
vbox.AddLayout(hbox13)

widget := ui.NewWidget()
widget.SetLayout(vbox)
Expand Down

0 comments on commit 9e9f669

Please sign in to comment.