2

I need to find out the DC voltage required at Base of a Bipolar transistor,(Vbb is DC voltage required at Base) to operate it in three conditions mentioned below

  1. At Vbe = 0.7, Vce = 5, Beta = 50 Transistor in active region

  2. At Vbe = 0.7, Vce = 0.3, Beta = 50 Transistor operating at edge of saturation

  3. At Vbe = 0.7, Vce = 0.2, Beta(forced) = 10 Transistor operating in deep in saturation.

The formulas are given in the code shown below and are correct. My question is should i need to use three separate objects of class BJT to calculate the Vbb for three separate conditions given above or this task can be done with a single object?

#include<iostream>
using namespace std;
const float Rb=10000.0;
const float Rc=1000.0;
const float Vcc=10.0;
class BJT
{
private:
    float Vbe;
    float Vce;
    float Ic;
    float Ib;
    float Beta;
    float Vbb;
    void calculate()
    {
       Ic=(Vcc-Vce)/Rc;
       Ib=Ic/Beta;
       Vbb=(Ib*Rb)+Vbe;
    }
francesco
  • 7,189
  • 7
  • 22
  • 49
  • Never use ```using namespace std;``` in the header, see [here](https://stackoverflow.com/a/5849668/8769985) – francesco May 14 '19 at 09:18

1 Answers1

1

If you want to hold these values in a class but have full access to them freely in any time, you can declare them public:

class BJT
{
    public:
    float Vbe;
    float Vce;
    float Ic;
    float Ib;
    float Beta;
    float Vbb;

    void calculate()
    {
       Ic=(Vcc-Vce)/Rc;
       Ib=Ic/Beta;
       Vbb=(Ib*Rb)+Vbe;
    }
}

However, if you need to keep them private you can provide "get" function for each required data member.

  • i want to keep them private . Just need to know for 3 different situations .... what should i do... 3 separate objects .... or i can achive the results with a single object. –  May 14 '19 at 08:00