[Electronic circuit calculation formula] the current calculation tool for wire flow, I have made a small tool (source code)

Source: Internet
Author: User

I think in PCB design, it is very important to select the width of the wire. It is much easier to know how much current the wire can flow at the maximum. Recently, I am planning to design a thermostat circuit for controlling the self-made small refrigerator. The power is 400 W, the current is 33a, the current is very high, and the PCB design is a headache, but it has been fixed.

 

Directly create a console project in vs200x (too lazy to create an interface), create a C ++ source code file, compile and run it.

 

//------------------------------------------------------//
// (C) Copyright debug 2009
//------------------------------------------------------//
// Todo: Calculate the current that can flow through the wire.
// Date: 2009/10
// Revr: 1.0
//------------------------------------------------------//
# Include <stdio. h>
# Include <math. h>

//----------------------------------------------//
// Attention: Obtained from IEC R40
// 2.11a/(mm * mm)
//----------------------------------------------//
# Define c_line_a 2.11
# Define PI 3.14159265358979

Typedef struct _ tag_cir_line
{
Double S; // Area
Double I; // current that can flow through
} 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 :");
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 );
//-----------//
// Calculate the thickness needed for thickening
Printf ("[rectangle]/R/N ");
Printf ("the following will calculate the thickening thickness, So enter the PCB wire width :");
Scanf ("% lf", & I );
Double S = I * 0.1;
S = TMP-> S-S;
Printf ("calculated based on 80% % of PCB wire width, height % 0.2f mm/R/n/R/N", S/(I * 0.8 ));
Printf ("[Circular]/R/N ");
Printf ("diameter % 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;
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.