ClearAll[Evaluate[Context[]<>"*"]];
SetDirectory[NotebookDirectory[]];

iD[uD_]:=(10^(-7))*(Exp[19uD]-1);
Plot[iD[uD],{uD,-0.1,1}];
Plot[iD[uD],{uD,-0.1,0.1}];
u[t_]:=15*Sin[2.Pi*50*t];
R=20;
μF=(10^(-6));
c=5*4700μF;

D[i[t]==iD[uD[t]],t]

eqns={D[u[t]==uD[t]+uRC[t],{t,1}],
i[t]==iC[t]+iR[t],
iC[t]==c*uRC'[t],
iR[t]==((uRC[t])/R),
D[i[t]==iD[uD[t]],t],
Wdiode'[t]==i[t]*uD[t]
};
unknowns=Cases[eqns,_Symbol[t],{0,∞}]//Union;
inits=Cases[eqns,a_'[t]:>a[0]==0,{0,∞}]//Union;
tmax=0.1;
sol=NDSolve[Union[eqns,inits],Union[unknowns,{Wdiode}],{t,0,tmax},StartingStepSize->(10^(-12)),MaxSteps->(10^6)][[1]];
T=0.02;
Plot[i[t]/.sol,{t,0,0.5T}];
FindMaximum[i[t]/.sol,{t,0,0.5T}]
Plot[Wdiode[t]/.sol,{t,0,tmax},PlotRange->All];
Print["Power of heat= ",((Wdiode[tmax]-Wdiode[tmax-T])/T)/.sol," W"]