1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <math.h>
#define Pi 3.1415
#include <iomanip>
using namespace std;
class Kompleks
{
public:
Kompleks (double r=0, double i=0) : _Re(r),_Im(i)
{}
double Re() const
{ return _Re; }
double Im() const
{ return _Im; }
double Ro() const
{return this->Moduo();}
double Fi() const
{
if (Re()) return atan(Im()/Re());
else return Im()<0 ? -Pi/2 : Pi/2;
}
double Moduo () const
{
return sqrt(Re()*Re()+Im()*Im());
}
Kompleks operator +(const Kompleks& c) const
{
return Kompleks(Re() + c.Re(), Im() + c.Im());
}
Kompleks operator -(const Kompleks& c) const
{
return Kompleks( Re() - c.Re(), Im() - c.Im() );
}
Kompleks operator *(const Kompleks& c) const
{
return Kompleks( Re() * c.Re() - Im() * c.Im(), Re() * c.Im() + Im() * c.Re());
}
Kompleks operator * (const double d) const
{
return Kompleks (Re()*d,Im()*d);
}
Kompleks operator /(const Kompleks& c) const
{
return Kompleks( (Re() * c.Re() + Im() * c.Im())/(c.Re() * c.Re() + c.Im() * c.Im())
,(Im() * c.Re() - Re() * c.Im())/(c.Re() * c.Re() + c.Im() * c.Im()));
}
Kompleks operator ~() const
{
return Kompleks(Re() , -Im());
}
istream& Citaj (istream &ul)
{
char c, i;
ul >> _Re >> c >> _Im >> i;
if (c=='-')
_Im=-_Im;
return ul;
}
ostream& Pisi (ostream &izl) const
{
char c = Im()<0 ? '-' : '+';
return izl <<Re() << c << abs(Im()) << 'i';
}
private:
double _Re;
double _Im;
};
istream& operator >> (istream& str, Kompleks& c)
{ return c.Citaj(str);}
ostream& operator << (ostream& str, const Kompleks& c)
{ return c.Pisi(str); }
main ()
{
Kompleks Re(4.3,0);
Kompleks Xe(0,8.07);
Kompleks Snp(31500000,0);
Kompleks Sns(31500000,0);
Kompleks Snt(10500000,0);
Kompleks Vnp(110000,0);
Kompleks Vns(20000,0);
Kompleks Vnt(10000,0);
double Ukps=12.7;
double Ukpt=9.2l;
double Ukst=2.4;
Kompleks Pcups(131000,0);
Kompleks Pcupt(0,0);
Kompleks Pcust(0,0);
Kompleks Pfe(40000,0);
double Jfe=0.0004;
Kompleks Sn(1000000,0);
Kompleks V1n(20000,0);
Kompleks V2n(400,0);
double Uk=5;
Kompleks Pcu(8550,0);
Kompleks Pfet(2200,0);
Kompleks Ife(0.008,0);
double L4001=1;
double L4002=2;
double L4003=4;
double L4004=1;
double L4005=2.5;
double L4006=2;
double L4007=1;
double L4008=2;
double L4009=2;
double L4010=2;
klasa complex c++
Kompleks r(0.209,0);
Kompleks x(0,0.117);
Kompleks g(0,0);
Kompleks b(0,0.000116);
Kompleks Rks=r*1.4;
Kompleks r0(0.75,0);
Kompleks x0(0,0.112);
Kompleks Rksmin0=r0*1.4;
Kompleks g0(0,0);
Kompleks b0(0,0.0000696);
Kompleks Zps=((Vnp*Vnp)/Snp)*(Ukps/100);
Kompleks Zpt=((Vnp*Vnp)/Snt)*(Ukpt/100);
Kompleks Zst=((Vnp*Vnp)/Snt)*(Ukst/100);
Kompleks Zp=(Zps+Zpt-Zst)/2;
Kompleks Zs=(Zps-Zpt+Zst)/2;
Kompleks Zt=(Zpt-Zps+Zst)/2;
Kompleks Z1=(r+x)*L4001;
cout << "resenje=" << Z1 << endl;
return 0;
}
|