Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having trouble with a C programming / electronics project: [Vcc Rint 50%] G

ID: 2083593 • Letter: I

Question

I am having trouble with a C programming / electronics project: [Vcc Rint 50%]

Goal: Develop a program that will automatically adjust a variable resistor until the maximum power is transferred to a load resistor.
Purpose: For this project, you will create a prototype of a circuit designed to transfer the maximum power to a load. The program will receive a keyboard input representing the value of the power supply (VCC) and the size of the load resistor (RL). The program will simulate driving a motor controlled variable resistor (Rint) by incrementally changing the value of the variable resistor.
Requirements: Analyze the following program requirements. -You are designing a circuit that will automatically adjust circuit resistance until the maximum power is delivered to the load.   -The circuit consists of a programmable power supply (VCC), a variable internal resistor (Rint), and a programmable load resistor (RL). Examine the schematic:  

   -The user will enter the value of the VCC and the value of Rint. The program must automatically adjust RL until the maximum power is transferred. RL is a 100 to 10k ohm potentiometer that is controlled by the program.
-The Programmable Power Supply has a range of 1 to 15 VDC. Rint has a range of 200 Ohms to 5 kOhms and is accurate to 1 Ohm. Values that are not within range will damage the equipment and cannot be accepted.    -After valid values are entered, the program will automatically adjust RL as follows:   --The beginning value for RL will be 100 ohms below the value of Rint --RL will be incremented 1 ohm at a time and the power dissipated by both Rint and RL will be calculated at each increment of RL. --The final value of RL will be 100 ohms above Rint

-The program will then use the calculated values to determine the value of RL that delivers the maximum power to RL.

Vcc Rint RL. 50%

Explanation / Answer

Given, Vcc=15V. Let us assume Rint=200 Ohms and RL=5Kohms:

C Program:

#include <math.h>
#include <stdio.h>
int main()

{
double motor, Psupply, current, Res1,Res2, Res2Power, motorPower, resistors1And2, MaxPower;
while ( Res2 < 1)

{
Psupply = 15;
current = 0;
Res2 = 5*1000;
motor = 0;
Res2Power = 0;
motorPower = 0;
resistors1And2 = 0;

printf (" New Voltage and the Load: ");
Res1 = 200;

/* Input voltage entered must be in the range. If not means loop until an input within the range is entered*/

while (( Psupply < 1) || (Psupply > 14))

{                                              // Check voltage range
printf (" Enter the value of Power supply among 1 to 15 in volts ");
scanf ("%lf", &Psupply);
if (( Psupply < 1) || (Psupply > 15))

{

printf (" %.1lf volts ", Psupply);
printf ("Input voltage is out of the range means may damage the equipment ");

}
}

while (motor < 100 || motor > 5000)

{
printf (" Enter the value for the motor between 100 to 5000 ");
scanf ("%lf", &motor);
if (motor < 100 || motor > 5000)

{                                              //Check, if correct value for the RL is entered or not
printf ("%.0lf ohms ", motor);   
printf ("Value for the input RL is out of the range and may damage the equipment ");

}
}

Res2 = motor;               

while (Res2 >= 0)

{                                             
resistors1And2 = Res1 + Res2;    
current = Psupply / (resistors1And2 + motor);                  
Res2Power = current * Res2 * current;                
motorPower = current * motor * current;
printf ("Output: %.0f R1 and R2: %.0f RL: %.0f R2 Power: %.15lf ", Res2, resistors1And2, motor, Res2Power);
printf (" Motor Power: %.15lf %c", motorPower);

if (resistors1And2 == motor)

{                                  //Check whether value of Rint and RL are equal
printf (" Equal ");                             
}
if (resistors1And2 != motor)

{
printf (" Unequal ");                            
}
Res2 = Res2 - 1;                                    
}
if (motorPower > .001)

{
MaxPower = motorPower * 1000;
printf ("Max power transferred to RL: %f m Watts ", MaxPower);
}
if (motorPower < .001)

{
MaxPower = motorPower * 1000000;
printf ("Max power transferred to RL: %f u Watts ", MaxPower);
}
}
return (0);
}

(Or)

Simple C program to get the maximum power delivered to the load:

#include <stdio.h>

#define R1 200

double main()

{

    double ResLD;

    printf("Enter ResLD to find R2 ");

    scanf("%lf", &ResLD);

    printf("Enter %lf ", ResLD);

    double R2 = 0;

    while((R1 + R2) != ResLD)

{

        while((R1 + R2) < ResLD)

{

R2 += 1000; printf("%lf ",R2);

}

        while((R1 + R2) > ResLD)

{

R2 -= 100;

printf("%lf ",R2);

}

while((R1 + R2) < ResLD)

{

R2 += 10;

printf("%lf ",R2);

}

while((R1 + R2) > ResLD)

{

R2 -= 1; printf("%lf ",R2);

}

}

printf("R2 Value for ResLD:");

return(0);

}