【电子电路计算公式】 导线流过电流计算工具,我已经做成一个小工具了(源代码)

我想,在PCB设计中,导线的宽度选择很重要,如果知道导线最大能够流过多少电流的话,就方便多了。最近正打算设计一个温控器电路,用于控制【自制小冰箱】,其中功率是400W, 电流最大为33A, 电流很大,PCB设计的时候比较头痛,不过已经解决掉了。

直接在VS200X 中创建一个控制台项目(懒得做成界面了),建立一个C++源代码文件,编译,运行就OK了。

//------------------------------------------------------//
//(C)Copyright Debug 2009
//------------------------------------------------------//
//TODO: 计算导线所能流过的电流
//DATE: 2009/10
//REVR: 1.0
//------------------------------------------------------//
#include <stdio.h>
#include <math.h>

//----------------------------------------------//
//Attention: 这里是根据 IEC R40 表获得
// 2.11A/(mm * mm)
//----------------------------------------------//
#define C_LINE_A 2.11
#define PI 3.14159265358979

typedef struct _tag_cir_line
{
double s;//面积
double i;//所能流过的电流
}CIR_LINE, *LPCIR_LINE;

//-------------------------------------------------//
//Round
//-------------------------------------------------//

LPCIR_LINE ComputeRoundLineByRound(double r)
{
LPCIR_LINE bk = new CIR_LINE;

double s = PI * (r * r);

bk->s = s;
bk->i = s * C_LINE_A;

return bk;
}

LPCIR_LINE ComputeLineByA(double i)
{
LPCIR_LINE bk = new CIR_LINE;

double s = i / C_LINE_A;

bk->s = s;
bk->i = i;

return bk;
}

LPCIR_LINE ComputeRectLineByRect(double w, double h)
{
LPCIR_LINE bk = new CIR_LINE;

bk->s = w * h;
bk->i = bk->s * C_LINE_A;

return bk;
}

double ComputeRoundLineP(double inV, double inA, double r)
{
LPCIR_LINE bk = ComputeRoundLineByRound(r);

double p = inV * (inA - bk->i);

delete bk;

return p;
}

void main()
{
int sel = 0;
LPCIR_LINE tmp;
double r, i;

while (sel != 4){
fflush(stdin);
printf("(1) Compute By Round\r\n");
printf("(2) Compute By A\r\n");
printf("(3) Compute By Width Or Hight\r\n");
printf("(4) Exit\r\n");
printf("Please input your answer: ");
scanf("%d", &sel);

switch (sel)
{
case 1:
{
printf("\r\nInput Round: ");
scanf("%lf", &r);

tmp = ComputeRoundLineByRound(r);
printf("> R = %0.2f A = %0.2f S = %0.2f mm*mm\r\n\r\n", r, tmp->i, tmp->s);
delete tmp;

break;
}
case 2:
{
printf("\r\nInput A: ");
scanf("%lf", &i);

tmp = ComputeLineByA(i);
printf("> A = %0.2f S = %0.2f mm*mm\r\n", tmp->i, tmp->s);

printf("If this line is round, then r = %0.2f mm\r\n", sqrt(tmp->s/PI));
printf("Else this line is rectangle and height = 0.1mm then width = %0.2f mm\r\n", tmp->s/0.1);
//-----------//
//计算需要增厚厚度
printf("[矩形]\r\n");
printf("下面将要计算增厚厚度,所以请输入pcb导线宽度: ");
scanf("%lf", &i);
double s = i * 0.1;
s = tmp->s - s;
printf("以pcb导线宽度的80%%计算, 高度 %0.2f mm\r\n\r\n", s / (i * 0.8));
printf("[圆形]\r\n");
printf("直径 %0.2f mm\r\n\r\n", 2*sqrt(s/PI));

delete tmp;

break;
}
case 3:
{
printf("\r\nInput Width: ");
scanf("%lf", &r);
printf("\r\nInput Height: ");
scanf("%lf", &i);

tmp = ComputeRectLineByRect(r, i);
printf("> A = %0.2f S = %0.2f mm*mm\r\n\r\n", tmp->i, tmp->s);
delete tmp;

break;
}
case 4:
return;
}
}
}

你可能感兴趣的:(C++,c,C#)