00001 #ifndef CResistor_HH 00002 #define CResistor_HH 00003 00004 #include <electro/CElement.hh> 00005 #include <vector> 00006 00010 class CResistor : public CElementPasive 00011 { 00012 public: 00022 CResistor(std::string name,float r,int x=0,int y=0,int rot=0) : CElementPasive("RES",name,x,y,rot) { 00023 m_r=r; 00024 for(int i=0;i<2;i++) 00025 pins.push_back(new CPin()); 00026 m_unitSymbol = "Ohm"; 00027 m_valueSymbol = "R"; 00028 } 00033 ~CResistor(){} 00039 void setR(float r){m_r=r;} 00045 float getR(void ){return m_r;} 00046 00053 Complex getZc(double omega){return Complex(m_r,0);} 00060 Complex getYc(double omega){return Complex(1/m_r,0);} 00061 00062 00063 double getValue() {return getR();} 00064 void draw(); 00065 protected: 00067 float m_r; 00068 }; 00069 #endif 00070