pom=pom;
Remove["Global`*"];
Off[FindMinimum::sszero,General::"obspkg"];
$HistoryLength=2;
SetDirectory[NotebookDirectory[]];
cm=0.01;
mm=0.1cm;
<<PhysicalConstants`;
myr:=0.1*Round[(10^1)#]&;

γIngot=12*(10^6);
γCivka=57*(10^6);
μ=N[VacuumPermeability][[1]];
σ=StefanConstant[[1]];
ϵ=1;
d1=20cm;
delka=80cm;
tMezera=2cm;
tizol=3cm;
λizol=0.3;
T1=20;
T2=800;
TCivka=80;
cas=500;
c=300;
ρ=7800;
Pohrev=delka*((d1^2)/4)*ρ*c*(T2-T1)*(1/cas);
Print["Pohrev= ",(10^(-3))Pohrev,"  kW"]

f=50.;
ω=2*Pi*f;
a[γ_]:=(Sqrt[(2/(ω*γ*μ))]);
{aIngot,aCivka}=a/@{γIngot,γCivka};
d2=d1+2*(tizol+tMezera);
Rth=(1/(2*Pi*delka*λizol))*Log[(d2/(d2-2*tizol))];
Pztraty=Q/.FindRoot[{Q==((T2-TCivka)/Rth),Q==ϵ*σ*d1*Pi*delka*((((T2+273))^4)-(((Tiz+273))^4))},{Q,1000},{Tiz,T2-100}];
Pcelkem=Pztraty+Pohrev;
Print["Pcelkem= ",myr@((10^(-3))Pcelkem),"  kW"]

D1=d1-aIngot;
D2=d2+aCivka;
s[d_]:=Pi*((d^2)/4);
αCivka=0.98;
αIngot=0.99;
F=0.99;
kPlneni=1.2;
L2=αIngot*s[D1]*(μ/delka);
L1=(n1^2)*αCivka*s[D2]*(μ/delka);
M=F*n1*s[D1]*(μ/delka);
R2=((Pi*D1)/(aIngot*delka*γIngot));
R1=kPlneni*(n1^2)*((Pi*D2)/(aCivka*delka*γCivka));

U=48;
rceLin={U==i1*(R1+I*ω*L1)+i2*I*ω*M,0==i2*(R2+I*ω*L2)+i1*I*ω*M};
rceVykon={R2*(((Abs[i2]))^2)==Pcelkem};
dosn1=(FindRoot[rceVykon/.Solve[rceLin,{i1,i2}][[1]],{n1,20}])/.{n1->b_}:>{n1->Floor[b]};
Print["volime n1= ",n1/.dosn1," zavitu"]

dosProudy=Solve[rceLin/.dosn1,{i1,i2}][[1]];
Icinny=Re[i1/.dosProudy];
Ijalovy=Im[i1/.dosProudy];
PztratyCivka=R1*((Abs[i1/.dosProudy])^2)/.dosn1;
Pchlazeni=Pztraty+PztratyCivka;
Print["uchladit musim ",myr@((10^(-3))Pchlazeni),"  kW"]

cKomp=cap/.Solve[-I*Ijalovy==I*U*ω*cap][[1]]//Chop;
Print["C komp= ",myr@((10^6)*cKomp)," μF,  ale budeme symetrizovat!"]