Python代写|Python Program that Analyses an Electrical Circuit

这个Python编程课程旨在帮助你提高结构化编程技能,同时解决一个工程难题。该课程的主要目标是开发一个分析电路的程序。

In this lab, some flowcharts that describe each step of the program and how the program works must be determined. First of all, the value of each impedance should be determined. From the data in 4.1.1, each impedance’s resistance, capacitance, conductance and inductance can be found, after that, each component’s impedance can be calculated. Afterwards, its connection type should be determined, to check if it is in series or in parallel. Using a ABCD matrix to get the impedance and a loop to calculate the sum of the impedance in the circuit. Finally, using the results got from the last step like Vin, Iin to calculate the Vout, Iout, Pout, Av, Ai.

在这个实验室中,必须确定一些描述程序的每个步骤和程序如何工作的流程图。首先,应确定每个阻抗的值。从4.1.1的数据中,可以找到每个阻抗的电阻、电容、电导和电感,之后,可以计算每个元件的阻抗。之后,应确定其连接类型,以检查它是串联还是并联。使用ABCD矩阵来获得阻抗,并使用循环来计算电路中的阻抗之和。最后,使用上一步得到的结果,如Vin, Iin,来计算Vout, Iout, Pout, Av, Ai。

Figure 1 displayed how each component is connected, so that in the flowchart the different circumstances should be taken into consideration. That is because the result of the matrix will be different depends on its connection. In case of a series impedance, in the ABCD matrix, A=1, B=Z, C=0, D=1. However, if where the shunt element is an admittance Y=1/Z, A=1, B=0, C=Y, D=1. For example, as is shown in the codes of 4.1.1, when n1=2, n2=0, Z2 and Z1 are in parallel. However, when n1=2, n2=3, Z3 and Z1 are in series.

图1显示了每个组件是如何连接的,因此在流程图中应考虑到不同的情况。这是因为矩阵的结果将取决于其连接方式的不同。如果是串联阻抗,在ABCD矩阵中,A=1,B=Z,C=0,D=1。然而,如果分流元件是一个导纳Y=1/Z,A=1,B=0,C=Y,D=1。例如,如4.1.1的代码所示,当n1=2,n2=0,Z2和Z1是并联的。然而,当n1=2,n2=3时,Z3和Z1是串联的。

As described in the flowchart, the program must perform the following tasks, firstly, read the circuit file. Second, analyse the circuit to evaluate the requested output variables. Finally, write the output variables to a file. Afterwards, entered the circuit block and input n=0 into the impedance array. This array is used to store the value of n, and it is useful in the following steps. In this program, using a loop to determine the impedance. When entered the program, checked if the resistance exists. The resistance needed to be checked first because the impedance is a complex number consists of real part and imaginary part, the resistance stands for the real part while capacitance or inductance stands for the imaginary part. If the resistance exists, the real part can be decided, and then the program is going to find the imaginary part. If the capacitance exists, its capacitive reactance is the imaginary part, which is j/wC. if not, the program will try to find if the inductance exists. If the inductance exists, its inductive reactance is the imaginary part, which is jwL. If not, then the imaginary part does not exist, as well as the resistance. So, the program will find the conductance in the next step, using the formula G=1/R to calculate the resistance. Then came to instruction n=n+1 to start a new cycle from the first judgement condition. Finally, the program got every component’s impedance and stored each of them into the array by order.

如流程图所述,程序必须执行以下任务,首先,读取电路文件。其次,分析电路以评估所要求的输出变量。最后,将输出变量写到文件中。之后,进入电路块,在阻抗数组中输入n=0。这个数组用来存储n的值,它在下面的步骤中很有用。在这个程序中,使用一个循环来确定阻抗。当进入程序后,检查电阻是否存在。首先需要检查电阻,因为阻抗是一个复数,由实部和虚部组成,电阻代表实部,电容或电感代表虚部。如果电阻存在,可以确定实部,然后程序将找到虚部。如果电容存在,它的容抗就是虚部,也就是j/wC。如果不存在,程序将尝试寻找电感是否存在。如果电感存在,它的电抗就是虚部,也就是jwL。如果不存在,那么虚部就不存在,电阻也是如此。所以,程序将在下一步找到电导,用公式G=1/R来计算电阻。然后来到指令n=n+1,从第一个判断条件开始一个新的循环。最后,程序得到每个元件的阻抗,并按顺序将每个元件存入数组中。

n1=1 n2=2 R=8.55
n1=2 n2=0 R=141.9
n1=2 n2=3 R=8.55
n1=3 n2=4 L=1.59e-3
n1=4 n2=0 C=3.18e-9
n1=5 n2=6 G=0.02677
If the lines above are the input, the output will be:
Z1=8.55
Z2=141.9
Z3=8.55
Z4=jw1.59e-3 Z5=j/w3.18e-9
Z6=37.35

asian chinese man working in office with laptop

 

 

contact

Assignment Exmaple

Recent Case

Service Scope

C|C++|Java|Python|Matlab|Android|Jsp|Prolo
g|MIPS|Haskell|R|Linux|C#|PHP|SQL|.Net|Hand
oop|Processing|JS|Ruby|Scala|Rust|Data Mining|数据库|Oracle|Mysql|Sqlite|IOS|Data Mining|网络编程|多线程编程|Linux编程操作系统|计算机网络|留学生|编程|程序|代写|加急|个人代写|作业代写|Assignment

Wechat:maxxuezhang

wechat