- #1
cooldude489
- 1
- 0
i don't need help writing the c++ code, but i do need help calculating the power through the resistor. P=VI and P = I^2R aren't working, so I'm guessing it's got something to do with circuit analysis, which i haven't been taught yet, and that my c++ class hasn't gone over.
------2 ohms---- ----3 ohms----
| | | |
| | | |
--- ---- -------
| | | | | |
| | | | | |
| ------4 ohms---- -----6 ohms---- |
| |
100 volts 10 - 20 ohms
| |
| |
___ ___
- -
In the above circuit there is a 100 volt DC source, a 2 ohm
resistor in parallel with a 4 ohm resistor, and then those
resistors are in series with a 3 ohm resistor in parallel
with a 6 ohm resistor. The circuit is terminated in a load
whose value varies randomly between 10 and 20 ohms.
If the power dissipated in the 2 ohm resistor goes above 35
watts, the resistor will burn and its resistance will jump
from 2 ohms to 1000000 ohms.
Solve the circuit 100,000 times (using random values for the
load). During the 100,000 simulations, count the number of times that
the 2 ohm resistor burns up. Also, calculate the average
voltage delivered to the load resistor when the 2 ohm
resistor has burned up.
Your program should output only two numbers on separate lines
as follows:
1-Number of times that the 2 ohm resistor burns
2-Average voltage delivered to the load resistor calculated
over the cases where the 2 ohm resistor has burned up
The seed to use for the random number generator is 100000
------2 ohms---- ----3 ohms----
| | | |
| | | |
--- ---- -------
| | | | | |
| | | | | |
| ------4 ohms---- -----6 ohms---- |
| |
100 volts 10 - 20 ohms
| |
| |
___ ___
- -
In the above circuit there is a 100 volt DC source, a 2 ohm
resistor in parallel with a 4 ohm resistor, and then those
resistors are in series with a 3 ohm resistor in parallel
with a 6 ohm resistor. The circuit is terminated in a load
whose value varies randomly between 10 and 20 ohms.
If the power dissipated in the 2 ohm resistor goes above 35
watts, the resistor will burn and its resistance will jump
from 2 ohms to 1000000 ohms.
Solve the circuit 100,000 times (using random values for the
load). During the 100,000 simulations, count the number of times that
the 2 ohm resistor burns up. Also, calculate the average
voltage delivered to the load resistor when the 2 ohm
resistor has burned up.
Your program should output only two numbers on separate lines
as follows:
1-Number of times that the 2 ohm resistor burns
2-Average voltage delivered to the load resistor calculated
over the cases where the 2 ohm resistor has burned up
The seed to use for the random number generator is 100000