circuit

This is a discussion on circuit within the C++ Programming forums, part of the General Programming Boards category; i need help with this \; how will anyone write a program for a circuit like this : [code] |-------------------{Resistor}--------------| ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    2

    Cool circuit

    i need help with this \;
    how will anyone write a program for a circuit
    like this :

    [code]
    |-------------------{Resistor}--------------|
    | |
    voltageSource| |Capacitor|
    | |
    |-----------------------------------------------|
    using varous voltages;
    such as v(t) = 12exp(t/RC)*sin((2*PI)/P);
    P = period = 0 to 2.
    wHO'S INTERESTING IN A CHALLENGE?
    WHO IS WILLING TO TRY TO SOLVE THE SAME PROBLEM USING THIS.
    TYPE | VOLTAGE SOURCE | DURATION APLIED(SEC)
    1 | Vs = 12 | CASE 1;2
    | | CASE 2; 0.4
    _____|__________________________|_________________ _
    | |
    2 |Vs = v(t) = 12exp(t/RC)*sin((2*PI)/P | CASE 1; 2
    | | CASE 2 ; 0.4
    | | CASE 3; 2
    _____ |_____________________________|_______________
    3 |Vs = 12)*sin((2*PI)/P) | CASE 1; 2
    | | CASE 2; 0.4
    | | CASE 3; 2
    _____ |_____________________________|_______________
    4 | Vs = 0 t= 0 |
    | Vs =12 0<=t>=0.2 | CASE 1;2
    | Vs = 0 0.2<=t>= 0.4 | CASE 2; 0.4
    | |
    <------------------------------------------------------------------------------->


    THIS HERE IS A TABLE(BELOW) WHICH YOU HAVE TO FOLLOW FOR EACH CASE.
    HERE I HAVE R,C, t, P DEFINE IN THE TABLE BELOW FOR EACH CASE #

    CASE| R | C | Vc (VOLTS) | P(SEC) | final (SEC)
    1 | 0.3 | 1 | calculate | 2 | 2
    2 | 0.05 | 1 | calculate | 0.03 | 0.4
    3 | 0.3 | 1 | calculate | 0.03 | 2


    this are your properties. who is up to the challenge?
    who ever is teach how to! please!
    I will appreciate.
    tank you
    HERE IS YOU HAVE TO FOLLOW THE PROPERTIES ABOVE

    #include<theOracle> [U]CASE |
    Last edited by theOracle; 05-19-2003 at 02:33 AM.

  2. #2
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    do you need the formula? your formula in C++ would be:

    Code:
    Vt = pow(12,(t/RC))*sin((2*3.14159/P);
    you would need to have t,RC, and P defined before it goes into this equation, and it would give you V(t)...

    what are you trying to find in that system? I couldn't really follow your forumula...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    17
    Not quite.
    Code:
    Vt = 12*pow(M_E,(t/RC))*sin((2*3.14159/P);
    Don't forget to include cmath.h for the pow() function and the value of e, represented by M_E.

    But I'm as confused as major_small : what are you trying to compute ? Voltage, current, ... ?
    Using Dev-C++ beta under Win XP Pro. That or g++ on Mandrake Linux 9.0 .

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>Don't forget to include cmath.h for the pow() function and the value of e, represented by M_E.

    Acutally, its just #include <cmath>.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    417
    Originally posted by major_small
    3.14159
    3.1415926535 is a little more accurate

    And yes, I do have that memorized.

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    126
    Make a "Circuit" object. Make a member function called voltage or something that returns the voltage of the circuit based in it's current resistor, capacitor, and whatver 'P' is in your formula states(make them private data members)

    How bout a little bit of this action:

    Code:
    const double PI = 3.1415926525;
    Actually, on second thought, I think pi might be defined in <cmath> as M_PI or something...

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Originally posted by Trauts
    3.1415926535 is a little more accurate

    And yes, I do have that memorized.
    Memorize this:
    Code:
    #include <cmath>
    using namespace std;
    .
    .
    .
    cout << "PI:" << setprecision(50) << M_PI << endl;

  8. #8
    Registered User
    Join Date
    Sep 2002
    Posts
    417
    My memory isn't that good... and I only memorized that part of pi because I was bored in math.

    That was good tho :-)

  9. #9
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >My memory isn't that good... and I only memorized that part of pi because I was bored in math.

    >That was good tho :-)

    Your memory is better than mine!!! I think me and the major tied.

  10. #10
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    i did have 3.1415926535 memorized at one point, but i forgot because of calculators... boredom does strange things to you sometimes...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  11. #11
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    I never knew that there was a constant defined for PI. Cool. I always just used 4 * atan( 1 ).
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  12. #12
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    me neither... but i'll still be using the number... less steps...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  13. #13
    Registered User
    Join Date
    Jun 2002
    Posts
    17
    Sorry, theOracle, even with your edit I have trouble understanding what you're looking for. Maybe the value of the RC constant ? Or the period ? Or maybe both ?
    Using Dev-C++ beta under Win XP Pro. That or g++ on Mandrake Linux 9.0 .

  14. #14
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    yeah, your edit didn't help that much... and include the closing [code] tag... the tags don't work if you only open it and never close them
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Circuit Reliability program
    By Northstar in forum C Programming
    Replies: 1
    Last Post: 12-04-2007, 02:01 AM
  2. C Programming for LED circuit
    By vivharv in forum C Programming
    Replies: 4
    Last Post: 09-18-2007, 05:34 AM
  3. logic circuit truth table
    By botakis in forum C Programming
    Replies: 3
    Last Post: 11-18-2004, 11:02 AM
  4. eulers circuit
    By zarganah in forum C++ Programming
    Replies: 4
    Last Post: 11-15-2004, 06:25 PM
  5. Circuit Boards - probably a dumb question
    By sean in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-09-2003, 06:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21