Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave

a) Use Kirchhoff's voltage law to develop standard mesh equations in a form suitable for solution using Cramer's Rule, according to the following 
b) Create function(s) to calculate the coefficient values for equations to be used in part 2 later.
c) Calculate Rx shown in figure 2 within the program

a) Design test data (e.g. values for the variables shown in figures 1 and 2) that should be listed in a table. Testing strategy needs to be explained including assumptions made for the process.
b) Write a main program to invoke the functions developed in Part 1 to test the correctness of calculated coefficients for the standard equations.
c) Test the developed program that can display the results of ix, iy, and vz, on the screen or save them into a file.
d) When the processing is complete, offer the user the option of displaying the results on the screen or writing the results to a user specified data file. Credit will be awarded for a solution that allows the user to make a choice.It is acceptable, if the input values, such as v1, v2, R1, R2, R3, Ry and Rz are not by a prompt but by a default value. However, more marks will be awarded for

a program that prompts for the user to enter the values of v1, v2, R1, R2, R3, Ry and Rz.
i) A record in your logbook of the design, development and testing of each
program.
i) Clear program listings for each version of the programs.
ii) Well designed testing data and explanations for any assumption used.
iii) Summarised test results in your logbook for each version, in tabular form.
iv) A CD containing the source and EXE versions of each program together with the data file containing the results of testing each program.


For each program, marks will be awarded for good design, good style and layout, use of comments as well correctness together with testing and clearly summarising the test results.To be eligible for full marks the solution to this assignment must be based on functions and proper testing procedures.However, if you are unable to solve this assignment using functions you may receive a maximum mark of 65% for using a solution not based on functions.

Part 1: Calculating the Value of Equation Coefficients

Calculating the value of equation coefficients

Iz = Ix + Iy;

V1 = (Rx * Ix) + Vz;

V2 = (Ry * Iy) + Vz;

Vz = Rz * Iz;

The crammers rule is like below:

Ax + By = Z1;

Cx + Dy = Z2;

If Matrix M =

D|M| = (a*d)-(b*c);

According to crammers rule

M =     Aug =

Now made new matrix M1 like below

Mx =

Now x = (D|Mx| / D|M|);

My =

Now y = (D|My| / D|M|);

In our case

(Rx + Rz) * Ix + Rz * Iy = V1;

Rx * Ix + ( Ry + Rz ) *Iy = V2;

We need to find Ix and Iy;

Now M =    , Aug =  

D|M| = (( Rx + Rz ) * ( Ry + Rz)) – ( Rx * Rz);

D|M1| = (V1 * (Ry + Rz)) – (V2 * Rz);

M2 =  

D|M2| = ( (Rx + Rz)* V2 ) – (Rx * V1)

Ix = D|M1| / D|M|;

Iy = D|M2| / D|M|;

Here we have V1, V2 and Ry, Rz but not Rx, below is the equation to calculate the Rx

Rx = (R1 + ((R2 * R3) / (R2 + R3))) // R1 and R2 and R3 are given

Code and Implementation:

Below is the code to do above things * Calculating x and y using crammers rule void cal_x_and_y_crammers_rule(double mainM[2][2], double augM[2], double *x, double *y){

        double Dx;

        double Dy;

        double D;

        D = ((mainM[0][0] * mainM[1][1]) - (mainM[1][0] * mainM[0][1]));

        Dx = ( (augM[0] * mainM[1][1]) - (augM[1] * mainM[0][1]) );

        Dy = ( (mainM[0][0] * augM[1]) - (mainM[1][0] * augM[0]) );

        *x = (Dx/D);

        *y = (Dy/D);

* Calculating the Rx from R1, R2, R3

double cal_Rx(double R1, double R2, double R3){

        return (R1 + ((R2 * R3) / (R2 + R3))); // Rx = R1 + (R2 * R3)/(R2 + R3)

Design:

Now after having calculated values Ix, Iy now calculate Iz and Vz

Iz = Ix + Iy;

Vz = Rz * Iz; // Rz is given

Code and Implementation:

double cal_IZ(double Ix, double Iy){

        return (Ix + Iy);*

* Calculating Vz using Iz and Rz

double cal_Vz(double Iz, double Rz){

        return (Rz * Iz);       // Vz = (Iz * Rz);

Testing Modules:

Test data:

R1 = 0.6

R2 = 6;

R3 = 4;

Ry = 5;

Rz = 1;

Part 2: Designing and Testing Modules

V1 = 15;

V2 = 2;

Assumptions is given value are greater than zero. No validation done for the values

Design:

Main program:

  1. Read value R1, R2, R3 and call cal_Rx to calculate Rx. Read Ry, Rz, V1, V2, call cal_x_and_y_crammers_rule to calculate Ix and Iy.
  2. Call cal_IZ to calculate Iz and call cal_Vz to calculate Vz.
  3. Ask the user to display the results or write to file.

Code:

* Calculating the Iz = Ix + Iy

double cal_IZ(double Ix, double Iy){

        return (Ix + Iy);/*

* Calculating Vz using Iz and Rz

double cal_Vz(double Iz, double Rz){

        return (Rz * Iz);       // Vz = (Iz * Rz);

* Calculating x and y using crammers rule

void cal_x_and_y_crammers_rule(double mainM[2][2], double augM[2], double *x, double *y){

        double Dx;

        double Dy;

        double D;

        D = ((mainM[0][0] * mainM[1][1]) - (mainM[1][0] * mainM[0][1]));

        Dx = ( (augM[0] * mainM[1][1]) - (augM[1] * mainM[0][1]) );

        Dy = ( (mainM[0][0] * augM[1]) - (mainM[1][0] * augM[0]) );

        *x = (Dx/D);

        *y = (Dy/D);

* Calculating the Rx from R1, R2, R3

* */

double cal_Rx(double R1, double R2, double R3){

        return (R1 + ((R2 * R3) / (R2 + R3))); // Rx = R1 + (R2 * R3)/(R2 + R3)

* The main program

int main(int argc, char *argv[]){

        double R1;

        double R2;

        double R3;

        double Rx;

        double Ry;

        double Rz;

        double V1;

        double V2;

        double Vz;

        double Ix;

        double Iy;

        double Iz;

        double mainM[2][2];

        double augM[2];

FILE *fp=NULL;

int choice;

printf("nn");

printf("*********************PART1*************************");

printf("nEnter R1: ");

scanf("%lg", &R1);

//R1 = 0.6;

printf("Enter R2: ");

scanf("%lg", &R2);

//R2 = 6;

printf("Enter R3: ");

scanf("%lg", &R3);

//R3 = 4;

Rx = cal_Rx(R1, R2, R3);

printf("nnRx calculated: %.2fnn", Rx);

printf("Enter Ry: ");

scanf("%lg", &Ry);

//Ry = 5;

printf("Enter Rz: ");

scanf("%lg", &Rz);

//Rz = 1;

        printf("Enter V1: ");

        scanf("%lg", &V1);

//V1 = 15;

        printf("Enter V2: ");

        scanf("%lg", &V2);

//V2 = 2;

print_equations();

mainM[0][0] = (Rx + Rz);

mainM[0][1] = Rz;

mainM[1][0] = Rz;

mainM[1][1] = (Ry + Rz);

augM[0] = V1;

augM[1] = V2;

print_coeffficients_matrices(mainM, augM);

printf("*********************PART2 & PART3 ****************");

        cal_x_and_y_crammers_rule(mainM, augM, &Ix, &Iy);

printf("nIx and Iy are calculated, Vz = ( Rz * Iz) = ( Rz * (Ix + Iy))nn");

printf("Enter details 1.display to screen, details 2.saved to screen: ");

scanf("%d", &choice);

Vz = (Rz * (Ix + Iy));

if(choice == 1){

         printf("nIx=%.2f, Iy=%.2f, Vz=%.2fn", Ix, Iy, Vz);

}else{

fp = fopen("output.txt", "a+");

fprintf(fp, "%.2f,%.2f,%.2fn", Ix, Iy, Vz);

printf("Ix, Iy, Iz are saved to filen");

fclose(fp);

printf("n");

Test results:

  1. Given default values in the program and written the result to file

given default values in the program and written the result to screen

  • Asking from user all the values in the program and written the result to file

  • Asking from user all the values in the program and written the result to screen

Test data:

Calculating the value of equation coefficients

Iz = Ix + Iy;

V1 = (Rx * Ix) + Vz;

V2 = (Ry * Iy) + Vz;

Vz = Rz * Iz;

R1 = 1.2; R2 = 10; R3 = 6;

Ry = 4; Rz = 3;

V1 = 25;

V2 = 10;

Assumptions is given value are greater than zero. No validation done for the values

Ix = 3.11;

Iy = 0.10;

Vz = 9.61;

Test case data:

Calculating the value of equation coefficients

Iz = Ix + Iy;

V1 = (Rx * Ix) + Vz;

V2 = (Ry * Iy) + Vz;

Vz = Rz * Iz;

R1 = 0.6; R2 = 6; R3 = 4; Ry = 5; Rz = 1; V1 = 15; V2 = 2;

Assumptions is given value are greater than zero. No validation done for the values

Ix = 3.11;

Iy = 0.10;

Vz = 9.61;

Cite This Work

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2021). Designing And Testing An Essay On Kirchhoff's Voltage Law.. Retrieved from https://myassignmenthelp.com/free-samples/cfs2155-computer-programming/voltage-law.html.

"Designing And Testing An Essay On Kirchhoff's Voltage Law.." My Assignment Help, 2021, https://myassignmenthelp.com/free-samples/cfs2155-computer-programming/voltage-law.html.

My Assignment Help (2021) Designing And Testing An Essay On Kirchhoff's Voltage Law. [Online]. Available from: https://myassignmenthelp.com/free-samples/cfs2155-computer-programming/voltage-law.html
[Accessed 19 April 2024].

My Assignment Help. 'Designing And Testing An Essay On Kirchhoff's Voltage Law.' (My Assignment Help, 2021) <https://myassignmenthelp.com/free-samples/cfs2155-computer-programming/voltage-law.html> accessed 19 April 2024.

My Assignment Help. Designing And Testing An Essay On Kirchhoff's Voltage Law. [Internet]. My Assignment Help. 2021 [cited 19 April 2024]. Available from: https://myassignmenthelp.com/free-samples/cfs2155-computer-programming/voltage-law.html.

Get instant help from 5000+ experts for
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing: Proofread your work by experts and improve grade at Lowest cost

loader
250 words
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Plagiarism checker
Verify originality of an essay
essay
Generate unique essays in a jiffy
Plagiarism checker
Cite sources with ease
support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close