= #JxnPortable\docs\gallery\SliderAnimation3b_RLC_phasors_curves.jxn

#ifndef owner
owner = @java.awt.Frame( "Reihenschwingkreis | Series RLC Circuit" )
#endif
#JXN:include/SliderInclude.jxn
!
R1  = slider.add( "R",   5., 0., 50. )
XL = slider.add( "XL", 25., 0., 50. )
XC = slider.add( "XC", 15., 0., 50. )
phiU = slider.add( "\#981;u", 0., -360., 360. )
!
Z = R1 + j ( XL - XC )
U = @JxnComplexAlgebra( 25, phiU, true )
I = U / Z
UR = R1 I
UL =  j XL I
UC = -j XC I
pf1 = plot( UL, "UL", C ).apnd( UR, "UR", M ).apnd( UC, "UC", C ).add( 10 I, "10\u183I", R )
pf1.add( U, "U", B ).add( U conj I, "S", G )
pf1.setXYLabels( "re", "im" ).setAutoScale(2)
!
t = 2 t
f = 1
omega = 2 PI f
exp_j_omega_t = exp j omega t
ut = sqrt(2) real U  exp_j_omega_t
it = sqrt(2) real I  exp_j_omega_t
uR = sqrt(2) real UR exp_j_omega_t
uL = sqrt(2) real UL exp_j_omega_t
uC = sqrt(2) real UC exp_j_omega_t
pf2 = plot( t, 10 it, ut, ut it ).add( curve( t, uR, M ) ).add( curve( t, uL, C ) ).add( curve( t, uC, C ) )
pf2.add( @JxnTextPainter( "uC", t[425], uC[425] ).setColor(C) ).add( @JxnTextPainter( "i(t)", t[475], 10 it[475] ).setColor(R) )
pf2.add( @JxnTextPainter( "uL", t[425], uL[425] ).setColor(C) ).add( @JxnTextPainter( "u(t)", t[475], ut[475] ).setColor(B) )
pf2.add( @JxnTextPainter( "uR", t[425], uR[425] ).setColor(M) ).add( @JxnTextPainter( "p(t)", t[475], ut[475] it[475] ).setColor(G) )
pf2.setXYLabels( "t", "u(t), 10\u183i(t)" ).setAutoScale(2)
!
#JXN:include/Grid2Include.jxn
#JXN:include/FrameInclude.jxn