{"id":7643,"date":"2026-05-26T09:56:54","date_gmt":"2026-05-26T12:56:54","guid":{"rendered":"https:\/\/fisica2.fica.unsl.edu.ar\/?page_id=7643"},"modified":"2026-05-27T14:40:56","modified_gmt":"2026-05-27T17:40:56","slug":"circuitos_corriente_alterna","status":"publish","type":"page","link":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/","title":{"rendered":"circuitos_corriente_alterna"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"7643\" class=\"elementor elementor-7643\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8526b6c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8526b6c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-353bf09\" data-id=\"353bf09\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5725b55 elementor-widget elementor-widget-html\" data-id=\"5725b55\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html>\r\n<html lang=\"es\">\r\n<head>\r\n<meta charset=\"UTF-8\">\r\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n<title>LabAC \u2014 Simulador de Circuitos CA<\/title>\r\n<script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\r\n<link href=\"https:\/\/fonts.googleapis.com\/css2?family=Space+Grotesk:wght@400;500;600;700&family=Source+Sans+3:wght@300;400;600;700&display=swap\" rel=\"stylesheet\">\r\n<link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/6.5.0\/css\/all.min.css\">\r\n<style>\r\n:root{--bg:#e4e9f0;--card:#fff;--bdr:#b0bccb;--txt:#111b2a;--mut:#4a5b72;--acc:#0a6e7e;--hdr:#081422;--rC:#b54200;--lC:#086e7e;--cC:#4e22a0;--vC:#0a6e2e;--iC:#a05e00;--pC:#a81228}\r\n*{box-sizing:border-box;margin:0;padding:0}\r\nbody{font-family:'Source Sans 3',sans-serif;background:var(--bg);color:var(--txt);overflow-x:hidden}\r\nh1,h2,h3,h4{font-family:'Space Grotesk',sans-serif}\r\n.hdr{background:var(--hdr);color:#fff;padding:10px 20px;display:flex;align-items:center;gap:12px;position:sticky;top:0;z-index:50;box-shadow:0 2px 16px rgba(0,0,0,.45)}\r\n.hdr h1{font-size:1.15rem;font-weight:700;letter-spacing:-.4px}\r\n.hdr h1 b{color:#22d3ee;font-weight:400}\r\n.hdr .bg{background:var(--acc);color:#fff;font-size:.58rem;padding:2px 7px;border-radius:99px;font-weight:600;letter-spacing:.4px;text-transform:uppercase}\r\n.ml{display:grid;grid-template-columns:305px 1fr;min-height:calc(100vh - 48px)}\r\n.sb{background:#fff;border-right:1px solid var(--bdr);padding:12px 10px;overflow-y:auto;max-height:calc(100vh - 48px);position:sticky;top:48px}\r\n.sb::-webkit-scrollbar{width:4px}\r\n.sb::-webkit-scrollbar-thumb{background:var(--bdr);border-radius:9px}\r\n.va{padding:10px;overflow-y:auto;max-height:calc(100vh - 48px)}\r\n.vg{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:8px;height:calc(100vh - 68px);min-height:520px}\r\n.vc{background:var(--card);border:1px solid var(--bdr);border-radius:10px;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 1px 4px rgba(0,0,0,.06)}\r\n.vch{padding:6px 10px;font-size:.68rem;font-weight:600;color:var(--mut);border-bottom:1px solid var(--bdr);display:flex;align-items:center;gap:6px;font-family:'Space Grotesk',sans-serif;text-transform:uppercase;letter-spacing:.4px;background:#f2f5fa}\r\n.vch i{font-size:.65rem}\r\n.vc canvas{flex:1;width:100%;display:block}\r\n.st{font-size:.62rem;font-weight:700;color:var(--mut);text-transform:uppercase;letter-spacing:.7px;margin:10px 0 5px;font-family:'Space Grotesk',sans-serif}\r\n.st:first-child{margin-top:0}\r\n.tr{display:flex;align-items:center;gap:7px;padding:3px 0}\r\n.tr label{font-size:.8rem;font-weight:500;flex:1;display:flex;align-items:center;gap:5px;cursor:pointer}\r\n.tr label .dt{width:9px;height:9px;border-radius:50%;display:inline-block;flex-shrink:0}\r\n.sw{position:relative;width:36px;height:18px;flex-shrink:0;cursor:pointer}\r\n.sw input{position:absolute;opacity:0;width:100%;height:100%;cursor:pointer;z-index:2;margin:0}\r\n.sw .sl{position:absolute;inset:0;background:#a8b4c4;border-radius:18px;transition:.25s;pointer-events:none}\r\n.sw .sl:before{content:'';position:absolute;height:12px;width:12px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:.25s;box-shadow:0 1px 2px rgba(0,0,0,.15)}\r\n.sw input:checked+.sl{background:var(--acc)}\r\n.sw input:checked+.sl:before{transform:translateX(18px)}\r\n.pr{margin:4px 0}\r\n.pr .ph{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:1px}\r\n.pr .pl{font-size:.75rem;font-weight:600}\r\n.pr .pv{font-size:.75rem;font-weight:700;color:var(--acc);font-family:'Space Grotesk',sans-serif}\r\n.pr input[type=range]{width:100%;height:5px;-webkit-appearance:none;background:#d0d8e6;border-radius:3px;outline:none}\r\n.pr input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border-radius:50%;background:var(--acc);cursor:pointer;border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,.2)}\r\n.rg{display:grid;grid-template-columns:1fr 1fr;gap:1px 8px;font-size:.7rem}\r\n.rg .rk{color:var(--mut);font-weight:500}\r\n.rg .rv{font-weight:700;text-align:right;font-family:'Space Grotesk',sans-serif}\r\n.bt{display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border-radius:6px;font-size:.68rem;font-weight:600;cursor:pointer;border:1px solid var(--bdr);background:#fff;color:var(--txt);transition:.2s;font-family:'Space Grotesk',sans-serif}\r\n.bt:hover{background:var(--acc);color:#fff;border-color:var(--acc)}\r\n.ct{display:inline-block;padding:2px 9px;border-radius:4px;font-size:.66rem;font-weight:700;font-family:'Space Grotesk',sans-serif;background:var(--acc);color:#fff;margin-bottom:4px}\r\n.ib{display:flex;gap:8px;flex-wrap:wrap;padding:3px 10px;background:#f2f5fa;border-top:1px solid var(--bdr);font-size:.66rem;font-family:'Space Grotesk',sans-serif}\r\n.ib .ii{display:flex;align-items:center;gap:3px}\r\n.ib .id{width:7px;height:7px;border-radius:50%}\r\n.ib .iv{font-weight:700}\r\n.fp{background:#f2f5fa;border:1px solid var(--bdr);border-radius:7px;padding:8px;margin-top:6px;font-size:.68rem;line-height:1.55;display:none}\r\n.fp .ft{font-weight:700;color:var(--acc);margin-bottom:2px;font-family:'Space Grotesk',sans-serif;font-size:.7rem}\r\n.fp .fl{color:var(--mut)}\r\n.fp .fl b{color:var(--txt);font-weight:600}\r\n@keyframes fi{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}\r\n.vc{animation:fi .4s ease both}\r\n.vc:nth-child(2){animation-delay:.05s}\r\n.vc:nth-child(3){animation-delay:.1s}\r\n.vc:nth-child(4){animation-delay:.15s}\r\n@media(max-width:1020px){.ml{grid-template-columns:1fr}.sb{position:relative;top:0;max-height:none;border-right:none;border-bottom:1px solid var(--bdr)}.va{max-height:none}.vg{height:auto;grid-template-columns:1fr;grid-template-rows:auto}.vc{min-height:240px}}\r\n<\/style>\r\n<\/head>\r\n<body>\r\n<header class=\"hdr\">\r\n<i class=\"fas fa-bolt\" style=\"color:#22d3ee;font-size:1.1rem\"><\/i>\r\n<h1>Lab<b>AC<\/b><\/h1>\r\n<span class=\"bg\">Simulador<\/span>\r\n<span style=\"font-size:.68rem;color:#6a80a0;margin-left:auto\">Circuitos en Corriente Alterna \u2014 Serie<\/span>\r\n<\/header>\r\n<div class=\"ml\">\r\n<aside class=\"sb\">\r\n<div class=\"st\">Componentes<\/div>\r\n<div id=\"cType\" class=\"ct\">R Serie<\/div>\r\n<div class=\"tr\"><label for=\"tR\"><span class=\"dt\" style=\"background:var(--rC)\"><\/span>Resistencia (R)<\/label><div class=\"sw\"><input type=\"checkbox\" id=\"tR\" checked><span class=\"sl\"><\/span><\/div><\/div>\r\n<div class=\"tr\"><label for=\"tL\"><span class=\"dt\" style=\"background:var(--lC)\"><\/span>Inductancia (L)<\/label><div class=\"sw\"><input type=\"checkbox\" id=\"tL\"><span class=\"sl\"><\/span><\/div><\/div>\r\n<div class=\"tr\"><label for=\"tC\"><span class=\"dt\" style=\"background:var(--cC)\"><\/span>Capacitancia (C)<\/label><div class=\"sw\"><input type=\"checkbox\" id=\"tC\"><span class=\"sl\"><\/span><\/div><\/div>\r\n<div class=\"st\">Parametros de entrada<\/div>\r\n<div class=\"pr\"><div class=\"ph\"><span class=\"pl\">V<sub>rms<\/sub><\/span><span class=\"pv\" id=\"vV\">220.0 V<\/span><\/div><input type=\"range\" id=\"sV\" min=\"1\" max=\"400\" step=\"1\" value=\"220\"><\/div>\r\n<div class=\"pr\"><div class=\"ph\"><span class=\"pl\">Frecuencia f<\/span><span class=\"pv\" id=\"vF\">50.00 Hz<\/span><\/div><input type=\"range\" id=\"sF\" min=\"0.01\" max=\"500\" step=\"0.01\" value=\"50\"><\/div>\r\n<div class=\"pr\" id=\"rR\"><div class=\"ph\"><span class=\"pl\">Resistencia R<\/span><span class=\"pv\" id=\"vR\">100 \u03a9<\/span><\/div><input type=\"range\" id=\"sR\" min=\"1\" max=\"1000\" step=\"1\" value=\"100\"><\/div>\r\n<div class=\"pr\" id=\"rL\"><div class=\"ph\"><span class=\"pl\">Inductancia L<\/span><span class=\"pv\" id=\"vL\">100.0 mH<\/span><\/div><input type=\"range\" id=\"sL\" min=\"0\" max=\"1000\" step=\"1\" value=\"500\"><\/div>\r\n<div class=\"pr\" id=\"rC\"><div class=\"ph\"><span class=\"pl\">Capacitancia C<\/span><span class=\"pv\" id=\"vC\">100.0 \u03bcF<\/span><\/div><input type=\"range\" id=\"sC\" min=\"0\" max=\"1000\" step=\"1\" value=\"750\"><\/div>\r\n<div class=\"pr\"><div class=\"ph\"><span class=\"pl\">Velocidad animacion<\/span><span class=\"pv\" id=\"vSp\">0.40x<\/span><\/div><input type=\"range\" id=\"sSp\" min=\"5\" max=\"300\" step=\"5\" value=\"40\"><\/div>\r\n<div class=\"st\">Resultados calculados<\/div>\r\n<div class=\"rg\" id=\"rG\"><\/div>\r\n<div class=\"st\">Acciones<\/div>\r\n<div style=\"display:flex;flex-wrap:wrap;gap:4px\">\r\n<button class=\"bt\" id=\"bP\"><i class=\"fas fa-pause\"><\/i> Pausar<\/button>\r\n<button class=\"bt\" id=\"bR\"><i class=\"fas fa-wave-square\"><\/i> Resonancia<\/button>\r\n<button class=\"bt\" id=\"bF\"><i class=\"fas fa-square-root-variable\"><\/i> Formulas<\/button>\r\n<\/div>\r\n<div class=\"fp\" id=\"fB\"><\/div>\r\n<\/aside>\r\n<div class=\"va\">\r\n<div class=\"vg\">\r\n<div class=\"vc\"><div class=\"vch\"><i class=\"fas fa-microchip\"><\/i>Esquema del circuito<\/div><canvas id=\"cC\"><\/canvas><\/div>\r\n<div class=\"vc\"><div class=\"vch\"><i class=\"fas fa-compass-drafting\"><\/i>Diagrama fasorial<\/div><canvas id=\"cP\"><\/canvas><\/div>\r\n<div class=\"vc\"><div class=\"vch\"><i class=\"fas fa-chart-line\"><\/i>Formas de onda<\/div><canvas id=\"cW\"><\/canvas><div class=\"ib\" id=\"iB\"><\/div><\/div>\r\n<div class=\"vc\"><div class=\"vch\"><i class=\"fas fa-bolt\"><\/i>Potencia instantanea p(t) = v(t) \u00b7 i(t)<\/div><canvas id=\"cK\"><\/canvas><\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<script>\r\nconst S={V:220,f:50,R:100,L:0.1,C:1e-4,eR:true,eL:false,eC:false,ph:0,paused:false,showF:false,speed:0.4};\r\nfunction s2L(v){return 0.001*Math.pow(10000,v\/1000)}\r\nfunction L2s(l){return 1000*Math.log(l\/0.001)\/Math.log(10000)}\r\nfunction s2C(v){return 1e-7*Math.pow(10000,v\/1000)}\r\nfunction C2s(c){return 1000*Math.log(c\/1e-7)\/Math.log(10000)}\r\n\r\nfunction calc(){\r\n  const w=2*Math.PI*S.f,R=S.eR?S.R:0,XL=S.eL?w*S.L:0;\r\n  const XC=S.eC?1\/(w*Math.max(S.C,1e-12)):0,X=XL-XC;\r\n  const Z=Math.sqrt(R*R+X*X),phi=(R===0&&X===0)?0:Math.atan2(X,R);\r\n  const Irms=S.V\/Math.max(Z,1e-9),Vr=Irms*R,Vl=Irms*XL,Vc=Irms*XC;\r\n  const P=S.V*Irms*Math.cos(phi),Q=S.V*Irms*Math.sin(phi),Sv=S.V*Irms,FP=Math.cos(phi);\r\n  return{w,R,XL,XC,X,Z,phi,Irms,Vr,Vl,Vc,P,Q,S:Sv,FP};\r\n}\r\n\r\nconst $=id=>document.getElementById(id);\r\nfunction fit(cv){\r\n  const dpr=window.devicePixelRatio||1,r=cv.getBoundingClientRect();\r\n  cv.width=r.width*dpr;cv.height=r.height*dpr;\r\n  const ctx=cv.getContext('2d');ctx.scale(dpr,dpr);\r\n  return{ctx,W:r.width,H:r.height};\r\n}\r\nfunction arrow(c,x1,y1,x2,y2,hl){\r\n  hl=hl||8;const a=Math.atan2(y2-y1,x2-x1);\r\n  c.beginPath();c.moveTo(x1,y1);c.lineTo(x2,y2);c.stroke();\r\n  c.beginPath();c.moveTo(x2,y2);\r\n  c.lineTo(x2-hl*Math.cos(a-Math.PI\/6),y2-hl*Math.sin(a-Math.PI\/6));\r\n  c.lineTo(x2-hl*Math.cos(a+Math.PI\/6),y2-hl*Math.sin(a+Math.PI\/6));\r\n  c.closePath();c.fill();\r\n}\r\nfunction toast(m){\r\n  const t=document.createElement('div');\r\n  t.style.cssText='position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#081422;color:#fff;padding:8px 20px;border-radius:8px;font-size:.8rem;z-index:999;box-shadow:0 4px 16px rgba(0,0,0,.4);font-family:Space Grotesk,sans-serif;opacity:0;transition:opacity .3s;max-width:90vw;text-align:center';\r\n  t.textContent=m;document.body.appendChild(t);\r\n  requestAnimationFrame(()=>t.style.opacity='1');\r\n  setTimeout(()=>{t.style.opacity='0';setTimeout(()=>t.remove(),300)},4000);\r\n}\r\nconst COL={v:'#0a6e2e',i:'#a05e00',vr:'#b54200',vl:'#086e7e',vc:'#4e22a0',p:'#a81228',phi:'#a81228'};\r\n\r\nfunction drawCirc(){\r\n  const{ctx,W,H}=fit($('cC'));const c=calc();\r\n  ctx.clearRect(0,0,W,H);ctx.fillStyle='#f4f6fa';ctx.fillRect(0,0,W,H);\r\n  const px=44,lx=px,rx=W-px,ty=H*0.24,by=H*0.76,cy=(ty+by)\/2;\r\n  const co=[];\r\n  if(S.eR)co.push({t:'R',cl:COL.vr,lbl:'R',val:S.R.toFixed(0)+' \u03a9',vr:c.Vr});\r\n  if(S.eL)co.push({t:'L',cl:COL.vl,lbl:'L',val:(S.L*1000).toFixed(1)+' mH',vr:c.Vl});\r\n  if(S.eC)co.push({t:'C',cl:COL.vc,lbl:'C',val:(S.C*1e6).toFixed(1)+' \u03bcF',vr:c.Vc});\r\n  const n=co.length;\r\n  ctx.lineWidth=2.5;ctx.lineCap='round';ctx.lineJoin='round';ctx.strokeStyle='#162032';ctx.fillStyle='#162032';\r\n  const sR=18;\r\n  ctx.beginPath();ctx.moveTo(lx,ty);ctx.lineTo(lx,cy-sR);ctx.stroke();\r\n  ctx.beginPath();ctx.arc(lx,cy,sR,0,2*Math.PI);ctx.stroke();\r\n  ctx.strokeStyle=COL.v;ctx.lineWidth=2.5;\r\n  ctx.beginPath();for(let i=-7;i<=7;i++){const sx=lx+i,sy=cy-5*Math.sin(i*0.55);i===-7?ctx.moveTo(sx,sy):ctx.lineTo(sx,sy);}ctx.stroke();\r\n  ctx.strokeStyle='#162032';ctx.lineWidth=2.5;\r\n  ctx.font='bold 8px Space Grotesk';ctx.fillStyle=COL.v;ctx.textAlign='center';ctx.fillText(S.V.toFixed(0)+'V ~',lx,cy+sR+14);\r\n  ctx.fillStyle='#162032';ctx.beginPath();ctx.moveTo(lx,cy+sR);ctx.lineTo(lx,by);ctx.stroke();\r\n  ctx.beginPath();ctx.moveTo(lx,by);ctx.lineTo(rx,by);ctx.stroke();\r\n  const aR=15;\r\n  ctx.beginPath();ctx.moveTo(rx,ty);ctx.lineTo(rx,cy-aR);ctx.stroke();\r\n  ctx.beginPath();ctx.arc(rx,cy,aR,0,2*Math.PI);ctx.stroke();\r\n  ctx.font='bold 10px Space Grotesk';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillText('A',rx,cy);\r\n  ctx.font='bold 7px Space Grotesk';ctx.fillStyle=COL.i;ctx.fillText(c.Irms<1?c.Irms.toFixed(4)+'A':c.Irms.toFixed(2)+'A',rx,cy+aR+12);\r\n  ctx.fillStyle='#162032';ctx.beginPath();ctx.moveTo(rx,cy+aR);ctx.lineTo(rx,by);ctx.stroke();\r\n  if(n===0){ctx.beginPath();ctx.moveTo(lx,ty);ctx.lineTo(rx,ty);ctx.stroke();return;}\r\n  const topLen=rx-lx,cW=Math.min(60,topLen\/(n*2.2)),totalCW=n*cW,wireLeft=topLen-totalCW,gap=wireLeft\/(n+1);\r\n  let xPos=lx;const compInfo=[];\r\n  co.forEach((comp)=>{const cs=xPos+gap,ce=cs+cW,cm=(cs+ce)\/2;\r\n    ctx.strokeStyle='#162032';ctx.lineWidth=2.5;ctx.beginPath();ctx.moveTo(xPos,ty);ctx.lineTo(cs,ty);ctx.stroke();\r\n    ctx.strokeStyle=comp.cl;ctx.lineWidth=3;\r\n    if(comp.t==='R'){const nz=6,dz=cW\/nz,amp=7;ctx.beginPath();ctx.moveTo(cs,ty);for(let j=0;j<nz;j++){const xp=cs+j*dz;ctx.lineTo(xp+dz\/2,ty+(j%2===0?-amp:amp));ctx.lineTo(xp+dz,ty);}ctx.lineTo(ce,ty);ctx.stroke();}\r\n    else if(comp.t==='L'){const nB=4,dB=cW\/nB,rad=dB\/2;ctx.beginPath();ctx.moveTo(cs,ty);for(let j=0;j<nB;j++){ctx.arc(cs+j*dB+rad,ty,rad,Math.PI,0,false);}ctx.stroke();}\r\n    else{const g=4,pH=14,p1=cm-g,p2=cm+g;ctx.beginPath();ctx.moveTo(cs,ty);ctx.lineTo(p1,ty);ctx.stroke();ctx.beginPath();ctx.moveTo(p1,ty-pH);ctx.lineTo(p1,ty+pH);ctx.stroke();ctx.beginPath();ctx.moveTo(p2,ty-pH);ctx.lineTo(p2,ty+pH);ctx.stroke();ctx.beginPath();ctx.moveTo(p2,ty);ctx.lineTo(ce,ty);ctx.stroke();}\r\n    ctx.font='bold 9px Space Grotesk';ctx.textAlign='center';ctx.fillStyle=comp.cl;ctx.fillText(comp.lbl+' = '+comp.val,cm,ty-18);\r\n    compInfo.push({cs,ce,cm,cl:comp.cl,vr:comp.vr,lbl:comp.lbl});xPos=ce;});\r\n  ctx.strokeStyle='#162032';ctx.lineWidth=2.5;ctx.beginPath();ctx.moveTo(xPos,ty);ctx.lineTo(rx,ty);ctx.stroke();\r\n  compInfo.forEach(ci=>{const vmR=11,vmY=ty+50,jY=ty+10;\r\n    ctx.setLineDash([3,3]);ctx.strokeStyle='#5a6e86';ctx.lineWidth=1.2;\r\n    ctx.beginPath();ctx.moveTo(ci.cs,ty);ctx.lineTo(ci.cs,jY);ctx.lineTo(ci.cm-vmR,vmY);ctx.stroke();\r\n    ctx.beginPath();ctx.moveTo(ci.ce,ty);ctx.lineTo(ci.ce,jY);ctx.lineTo(ci.cm+vmR,vmY);ctx.stroke();ctx.setLineDash([]);\r\n    ctx.strokeStyle='#162032';ctx.lineWidth=1.5;ctx.beginPath();ctx.arc(ci.cm,vmY,vmR,0,2*Math.PI);ctx.stroke();\r\n    ctx.font='bold 8px Space Grotesk';ctx.textAlign='center';ctx.textBaseline='middle';ctx.fillStyle='#162032';ctx.fillText('V',ci.cm,vmY);\r\n    ctx.font='bold 8px Space Grotesk';ctx.fillStyle=COL.v;ctx.fillText('V'+ci.lbl+'='+ci.vr.toFixed(1)+'V',ci.cm,vmY+vmR+10);ctx.fillStyle='#162032';});\r\n}\r\n\r\nfunction drawPhasor(){\r\n  const{ctx,W,H}=fit($('cP'));const c=calc();\r\n  ctx.clearRect(0,0,W,H);ctx.fillStyle='#f4f6fa';ctx.fillRect(0,0,W,H);\r\n  const cx=W\/2,cy=H\/2,maxR=Math.min(W,H)\/2-30;\r\n  const maxVMag=Math.max(S.V,c.Vr,c.Vl,c.Vc,1),vSc=maxR\/maxVMag;\r\n  const iVis=maxR*0.55,iSc=c.Irms>1e-9?iVis\/c.Irms:0;const rot=S.ph;\r\n  ctx.strokeStyle='#d8e0ea';ctx.lineWidth=0.5;for(let r=0.25;r<=1;r+=0.25){ctx.beginPath();ctx.arc(cx,cy,maxR*r,0,2*Math.PI);ctx.stroke();}\r\n  ctx.strokeStyle='#b0bccb';ctx.lineWidth=0.8;\r\n  ctx.beginPath();ctx.moveTo(cx-maxR-8,cy);ctx.lineTo(cx+maxR+8,cy);ctx.stroke();\r\n  ctx.beginPath();ctx.moveTo(cx,cy-maxR-8);ctx.lineTo(cx,cy+maxR+8);ctx.stroke();\r\n  ctx.font='7px Source Sans 3';ctx.fillStyle='#7a8da4';ctx.textAlign='center';ctx.textBaseline='middle';\r\n  ctx.fillText('0\u00b0',cx+maxR+18,cy);ctx.fillText('90\u00b0',cx,cy-maxR-14);ctx.fillText('180\u00b0',cx-maxR-20,cy);ctx.fillText('270\u00b0',cx,cy+maxR+14);\r\n  const phasors=[];\r\n  if(S.eR)phasors.push({mag:c.Vr,ang:rot-c.phi,cl:COL.vr,lb:'V_R',lw:2.8,tp:'v'});\r\n  if(S.eL)phasors.push({mag:c.Vl,ang:rot-c.phi+Math.PI\/2,cl:COL.vl,lb:'V_L',lw:2.8,tp:'v'});\r\n  if(S.eC)phasors.push({mag:c.Vc,ang:rot-c.phi-Math.PI\/2,cl:COL.vc,lb:'V_C',lw:2.8,tp:'v'});\r\n  phasors.push({mag:S.V,ang:rot,cl:COL.v,lb:'V',lw:3.5,tp:'v'});\r\n  phasors.push({mag:c.Irms,ang:rot-c.phi,cl:COL.i,lb:'I',lw:2.8,tp:'i'});\r\n  phasors.forEach(p=>{const sc=p.tp==='i'?iSc:vSc;const len=p.mag*sc;if(len<2)return;\r\n    const ex=cx+len*Math.cos(p.ang),ey=cy-len*Math.sin(p.ang);\r\n    ctx.fillStyle=p.cl;ctx.strokeStyle=p.cl;ctx.lineWidth=p.lw;\r\n    if(p.tp==='i')ctx.setLineDash([6,4]);else ctx.setLineDash([]);\r\n    arrow(ctx,cx,cy,ex,ey,p.lb==='V'?11:8);ctx.setLineDash([]);\r\n    const off=Math.max(14,len*0.12),lx2=cx+(len+off)*Math.cos(p.ang),ly2=cy-(len+off)*Math.sin(p.ang);\r\n    const deg=((p.ang*180\/Math.PI)%360+360)%360;\r\n    ctx.textAlign=(deg>100&&deg<260)?'right':'left';\r\n    ctx.textBaseline=(deg>10&&deg<170)?'bottom':(deg>190&&deg<350)?'top':'middle';\r\n    ctx.font='bold 10px Space Grotesk';ctx.fillStyle=p.cl;ctx.fillText(p.lb,lx2,ly2);});\r\n  if(Math.abs(c.phi)>0.03){const arcR=Math.min(30,maxR*0.16);ctx.strokeStyle=COL.phi;ctx.lineWidth=1.8;ctx.setLineDash([]);\r\n    ctx.beginPath();ctx.arc(cx,cy,arcR,-rot,-(rot-c.phi),c.phi>0);ctx.stroke();\r\n    const mA=rot-c.phi\/2;ctx.font='bold 9px Space Grotesk';ctx.fillStyle=COL.phi;ctx.textAlign='center';ctx.textBaseline='middle';\r\n    ctx.fillText('\u03c6='+(c.phi*180\/Math.PI).toFixed(1)+'\u00b0',cx+arcR*2.2*Math.cos(mA),cy-arcR*2.2*Math.sin(mA));}\r\n  const bx=5,by2=5,lh=13;\r\n  const infoLines=[{lb:'V',val:S.V.toFixed(1)+' V',cl:COL.v},...(S.eR?[{lb:'VR',val:c.Vr.toFixed(1)+' V',cl:COL.vr}]:[]),...(S.eL?[{lb:'VL',val:c.Vl.toFixed(1)+' V',cl:COL.vl}]:[]),...(S.eC?[{lb:'VC',val:c.Vc.toFixed(1)+' V',cl:COL.vc}]:[]),{lb:'I',val:c.Irms.toFixed(3)+' A',cl:COL.i},{lb:'\u03c6',val:(c.phi*180\/Math.PI).toFixed(1)+'\u00b0',cl:COL.phi}];\r\n  const boxH=infoLines.length*lh+6;ctx.fillStyle='rgba(244,246,250,0.88)';ctx.fillRect(bx,by2,90,boxH);ctx.strokeStyle='#c8d2de';ctx.lineWidth=0.5;ctx.strokeRect(bx,by2,90,boxH);\r\n  infoLines.forEach((ln,i)=>{ctx.font='bold 8px Space Grotesk';ctx.textAlign='left';ctx.textBaseline='top';ctx.fillStyle=ln.cl;ctx.fillText(ln.lb+'='+ln.val,bx+4,by2+3+i*lh);});\r\n  ctx.font='7px Source Sans 3';ctx.fillStyle='#7a8da4';ctx.textAlign='right';ctx.textBaseline='bottom';ctx.fillText('\u03c9t='+((S.ph*180\/Math.PI)%360).toFixed(0)+'\u00b0',W-6,H-4);\r\n}\r\n\r\nfunction drawWave(){\r\n  const{ctx,W,H}=fit($('cW'));const c=calc();\r\n  ctx.clearRect(0,0,W,H);ctx.fillStyle='#f4f6fa';ctx.fillRect(0,0,W,H);\r\n  const pL=50,pR=50,pT=30,pB=28,gw=W-pL-pR,gh=H-pT-pB,yM=pT+gh\/2,nCyc=3,angBase=S.ph;\r\n  ctx.strokeStyle='#9aacbe';ctx.lineWidth=1;ctx.beginPath();ctx.moveTo(pL,pT);ctx.lineTo(pL,pT+gh);ctx.lineTo(pL+gw,pT+gh);ctx.stroke();\r\n  ctx.strokeStyle='#c8d2de';ctx.lineWidth=0.5;ctx.beginPath();ctx.moveTo(pL,yM);ctx.lineTo(pL+gw,yM);ctx.stroke();\r\n  const Vp=S.V*Math.SQRT2,Ip=c.Irms*Math.SQRT2;\r\n  const VRp=c.Vr*Math.SQRT2,VLp=c.Vl*Math.SQRT2,VCp=c.Vc*Math.SQRT2;\r\n  const maxVp=Math.max(Vp,S.eR?VRp:0,S.eL?VLp:0,S.eC?VCp:0,0.01);\r\n  const vFrac=0.88,iFrac=0.55;\r\n  ctx.font='bold 8px Space Grotesk';ctx.fillStyle=COL.v;ctx.textAlign='right';\r\n  ctx.fillText('+'+maxVp.toFixed(0)+'V',pL-4,pT+8);ctx.fillText('0',pL-4,yM+4);ctx.fillText('-'+maxVp.toFixed(0)+'V',pL-4,pT+gh-2);\r\n  const iPeakY=yM-(gh\/2)*iFrac,iNegY=yM+(gh\/2)*iFrac;\r\n  ctx.fillStyle=COL.i;ctx.textAlign='left';\r\n  ctx.fillText('+'+Ip.toFixed(2)+'A',pL+gw+4,iPeakY+4);ctx.fillText('0',pL+gw+4,yM+4);ctx.fillText('-'+Ip.toFixed(2)+'A',pL+gw+4,iNegY+2);\r\n  ctx.strokeStyle='rgba(160,94,0,0.15)';ctx.lineWidth=0.5;ctx.setLineDash([2,4]);\r\n  ctx.beginPath();ctx.moveTo(pL,iPeakY);ctx.lineTo(pL+gw,iPeakY);ctx.stroke();\r\n  ctx.beginPath();ctx.moveTo(pL,iNegY);ctx.lineTo(pL+gw,iNegY);ctx.stroke();ctx.setLineDash([]);\r\n  const T=1\/Math.max(S.f,0.01);ctx.fillStyle='#6b7d94';ctx.textAlign='center';ctx.font='7px Source Sans 3';\r\n  for(let i=0;i<=nCyc;i++){const x=pL+gw*i\/nCyc;ctx.fillText((i*T*1000).toFixed(1)+'ms',x,pT+gh+14);}\r\n  ctx.font='bold 8px Space Grotesk';ctx.textBaseline='middle';\r\n  let legX=pL;const legY=pT-12;\r\n  [{col:COL.v,lbl:'V(t)'},{col:COL.vr,lbl:'VR(t)',on:S.eR},{col:COL.vl,lbl:'VL(t)',on:S.eL},{col:COL.vc,lbl:'VC(t)',on:S.eC},{col:COL.i,lbl:'I(t)',dash:true}].forEach(lg=>{if(lg.on===false)return;\r\n    ctx.strokeStyle=lg.col;ctx.lineWidth=2.5;\r\n    if(lg.dash)ctx.setLineDash([5,3]);else ctx.setLineDash([]);\r\n    ctx.beginPath();ctx.moveTo(legX,legY);ctx.lineTo(legX+16,legY);ctx.stroke();ctx.setLineDash([]);\r\n    ctx.fillStyle=lg.col;ctx.textAlign='left';ctx.fillText(lg.lbl,legX+19,legY);legX+=ctx.measureText(lg.lbl).width+30;});\r\n  ctx.strokeStyle=COL.v;ctx.lineWidth=2.8;ctx.setLineDash([]);ctx.beginPath();\r\n  for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI;const y=yM-(Vp*Math.sin(ang)\/maxVp)*(gh\/2)*vFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();\r\n  if(S.eR){ctx.strokeStyle=COL.vr;ctx.lineWidth=2.4;ctx.setLineDash([]);ctx.beginPath();\r\n    for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI-c.phi;const y=yM-(VRp*Math.sin(ang)\/maxVp)*(gh\/2)*vFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();}\r\n  if(S.eL){ctx.strokeStyle=COL.vl;ctx.lineWidth=2.4;ctx.setLineDash([]);ctx.beginPath();\r\n    for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI-c.phi+Math.PI\/2;const y=yM-(VLp*Math.sin(ang)\/maxVp)*(gh\/2)*vFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();}\r\n  if(S.eC){ctx.strokeStyle=COL.vc;ctx.lineWidth=2.4;ctx.setLineDash([]);ctx.beginPath();\r\n    for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI-c.phi-Math.PI\/2;const y=yM-(VCp*Math.sin(ang)\/maxVp)*(gh\/2)*vFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();}\r\n  ctx.strokeStyle=COL.i;ctx.lineWidth=2.8;ctx.setLineDash([7,5]);ctx.beginPath();\r\n  for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI-c.phi;const y=yM-Math.sin(ang)*(gh\/2)*iFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();ctx.setLineDash([]);\r\n  const ib=$('iB');let ih='';\r\n  ih+=`<span class=\"ii\"><span class=\"id\" style=\"background:${COL.v}\"><\/span>V(t)=<span class=\"iv\">${(Vp*Math.sin(S.ph)).toFixed(2)} V<\/span><\/span>`;\r\n  if(S.eR)ih+=`<span class=\"ii\"><span class=\"id\" style=\"background:${COL.vr}\"><\/span>VR=<span class=\"iv\">${(VRp*Math.sin(S.ph-c.phi)).toFixed(2)} V<\/span><\/span>`;\r\n  if(S.eL)ih+=`<span class=\"ii\"><span class=\"id\" style=\"background:${COL.vl}\"><\/span>VL=<span class=\"iv\">${(VLp*Math.sin(S.ph-c.phi+Math.PI\/2)).toFixed(2)} V<\/span><\/span>`;\r\n  if(S.eC)ih+=`<span class=\"ii\"><span class=\"id\" style=\"background:${COL.vc}\"><\/span>VC=<span class=\"iv\">${(VCp*Math.sin(S.ph-c.phi-Math.PI\/2)).toFixed(2)} V<\/span><\/span>`;\r\n  ih+=`<span class=\"ii\"><span class=\"id\" style=\"background:${COL.i}\"><\/span>I(t)=<span class=\"iv\">${(Ip*Math.sin(S.ph-c.phi)).toFixed(4)} A<\/span><\/span>`;\r\n  ib.innerHTML=ih;\r\n}\r\n\r\nfunction drawPower(){\r\n  const{ctx,W,H}=fit($('cK'));const c=calc();\r\n  ctx.clearRect(0,0,W,H);ctx.fillStyle='#f4f6fa';ctx.fillRect(0,0,W,H);\r\n  const pL=50,pR=14,pT=30,pB=50,gw=W-pL-pR,gh=H-pT-pB,yM=pT+gh\/2,nCyc=3,angBase=S.ph;\r\n  const Vp=S.V*Math.SQRT2,Ip=c.Irms*Math.SQRT2,pMax=Math.max(Vp*Ip,0.01);\r\n  ctx.strokeStyle='#9aacbe';ctx.lineWidth=1;ctx.beginPath();ctx.moveTo(pL,pT);ctx.lineTo(pL,pT+gh);ctx.lineTo(pL+gw,pT+gh);ctx.stroke();\r\n  ctx.strokeStyle='#c8d2de';ctx.lineWidth=0.5;ctx.beginPath();ctx.moveTo(pL,yM);ctx.lineTo(pL+gw,yM);ctx.stroke();\r\n  const vFrac=0.50,iFrac=0.35,pFrac=0.82;\r\n  ctx.font='bold 8px Space Grotesk';ctx.fillStyle=COL.v;ctx.textAlign='right';\r\n  ctx.fillText('+'+Vp.toFixed(0)+'V',pL-4,pT+6);ctx.fillText('0',pL-4,yM+4);ctx.fillText('-'+Vp.toFixed(0)+'V',pL-4,pT+gh-2);\r\n  const iPeakY=yM-(gh\/2)*iFrac,iNegY=yM+(gh\/2)*iFrac;\r\n  ctx.fillStyle=COL.i;ctx.textAlign='left';\r\n  ctx.fillText('+'+Ip.toFixed(2)+'A',pL+gw+4,iPeakY+4);ctx.fillText('0',pL+gw+4,yM+4);ctx.fillText('-'+Ip.toFixed(2)+'A',pL+gw+4,iNegY+2);\r\n  ctx.strokeStyle='rgba(160,94,0,0.12)';ctx.lineWidth=0.5;ctx.setLineDash([2,4]);\r\n  ctx.beginPath();ctx.moveTo(pL,iPeakY);ctx.lineTo(pL+gw,iPeakY);ctx.stroke();\r\n  ctx.beginPath();ctx.moveTo(pL,iNegY);ctx.lineTo(pL+gw,iNegY);ctx.stroke();ctx.setLineDash([]);\r\n  ctx.font='bold 8px Space Grotesk';ctx.textBaseline='middle';\r\n  let legX=pL;const legY=pT-12;\r\n  [{col:COL.v,lbl:'v(t)'},{col:COL.i,lbl:'i(t)',dash:true},{col:COL.p,lbl:'p(t)=v\u00b7i'}].forEach(lg=>{\r\n    ctx.strokeStyle=lg.col;ctx.lineWidth=2.5;\r\n    if(lg.dash)ctx.setLineDash([5,3]);else ctx.setLineDash([]);\r\n    ctx.beginPath();ctx.moveTo(legX,legY);ctx.lineTo(legX+16,legY);ctx.stroke();ctx.setLineDash([]);\r\n    ctx.fillStyle=lg.col;ctx.textAlign='left';ctx.fillText(lg.lbl,legX+19,legY);legX+=ctx.measureText(lg.lbl).width+30;});\r\n  ctx.strokeStyle=COL.v;ctx.lineWidth=2.4;ctx.globalAlpha=0.7;ctx.setLineDash([]);ctx.beginPath();\r\n  for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI;const y=yM-Math.sin(ang)*(gh\/2)*vFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();ctx.globalAlpha=1;\r\n  ctx.strokeStyle=COL.i;ctx.lineWidth=2.4;ctx.globalAlpha=0.7;ctx.setLineDash([7,5]);ctx.beginPath();\r\n  for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI-c.phi;const y=yM-Math.sin(ang)*(gh\/2)*iFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();ctx.setLineDash([]);ctx.globalAlpha=1;\r\n  ctx.strokeStyle=COL.p;ctx.lineWidth=3;ctx.beginPath();\r\n  for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI;const v=Vp*Math.sin(ang);const i=Ip*Math.sin(ang-c.phi);const y=yM-(v*i\/pMax)*(gh\/2)*pFrac;x===0?ctx.moveTo(pL+x,y):ctx.lineTo(pL+x,y);}ctx.stroke();\r\n  ctx.fillStyle='rgba(168,18,40,0.07)';ctx.beginPath();ctx.moveTo(pL,yM);\r\n  for(let x=0;x<=gw;x++){const ang=angBase-(1-x\/gw)*nCyc*2*Math.PI;const v=Vp*Math.sin(ang);const i=Ip*Math.sin(ang-c.phi);const y=yM-(v*i\/pMax)*(gh\/2)*pFrac;ctx.lineTo(pL+x,y);}\r\n  ctx.lineTo(pL+gw,yM);ctx.closePath();ctx.fill();\r\n  if(Math.abs(c.P)>0.1){const pAvgY=yM-(c.P\/pMax)*(gh\/2)*pFrac;\r\n    ctx.strokeStyle=COL.v;ctx.lineWidth=1.5;ctx.setLineDash([6,4]);ctx.beginPath();ctx.moveTo(pL,pAvgY);ctx.lineTo(pL+gw,pAvgY);ctx.stroke();ctx.setLineDash([]);\r\n    ctx.font='bold 8px Space Grotesk';ctx.fillStyle=COL.v;ctx.textAlign='left';ctx.fillText('Pmed='+c.P.toFixed(1)+'W',pL+4,pAvgY-5);}\r\n  const iY=pT+gh+14;ctx.font='bold 8px Space Grotesk';ctx.textAlign='left';\r\n  ctx.fillStyle=COL.v;ctx.fillText('P(act)='+c.P.toFixed(1)+'W',pL+2,iY);\r\n  ctx.fillStyle=COL.p;ctx.fillText('Q(react)='+c.Q.toFixed(1)+'VAR',pL+110,iY);\r\n  ctx.fillStyle=COL.vc;ctx.fillText('S(apar)='+c.S.toFixed(1)+'VA',pL+240,iY);\r\n  ctx.fillStyle=COL.vl;ctx.fillText('FP='+c.FP.toFixed(3),pL+370,iY);\r\n  const iY2=iY+13;ctx.font='bold 8px Space Grotesk';ctx.textAlign='center';\r\n  if(c.phi>0.03){ctx.fillStyle=COL.vl;ctx.fillText('Circuito INDUCTIVO \u2014 I retrasa respecto a V',W\/2,iY2);}\r\n  else if(c.phi<-0.03){ctx.fillStyle=COL.vc;ctx.fillText('Circuito CAPACITIVO \u2014 I adelanta a V',W\/2,iY2);}\r\n  else{ctx.fillStyle=COL.v;ctx.fillText('Circuito RESISTIVO \u2014 V e I en fase',W\/2,iY2);}\r\n}\r\n\r\nfunction updRes(){\r\n  const c=calc();const g=$('rG');const pd=c.phi*180\/Math.PI;\r\n  const f0=S.eL&&S.eC?(1\/(2*Math.PI*Math.sqrt(S.L*S.C))):null;\r\n  let extra='';\r\n  if(f0!==null){extra=`<span class=\"rk\">f\u2080 res.<\/span><span class=\"rv\" style=\"color:var(--pC)\">${f0.toFixed(2)} Hz<\/span>`;}\r\n  g.innerHTML=[\r\n    ['I<sub>rms<\/sub>',c.Irms<1?c.Irms.toFixed(4)+' A':c.Irms.toFixed(2)+' A'],\r\n    ['Z',c.Z.toFixed(2)+' \u03a9'],['X<sub>L<\/sub>',S.eL?c.XL.toFixed(2)+' \u03a9':'\u2014'],['X<sub>C<\/sub>',S.eC?c.XC.toFixed(2)+' \u03a9':'\u2014'],\r\n    ['X<sub>net<\/sub>',(S.eL||S.eC)?c.X.toFixed(2)+' \u03a9':'\u2014'],\r\n    ['\u03c6',pd.toFixed(2)+'\u00b0'],['FP',c.FP.toFixed(4)],['P',c.P.toFixed(2)+' W'],['Q',c.Q.toFixed(2)+' VAR'],\r\n    ['S',c.S.toFixed(2)+' VA'],['V<sub>R<\/sub>',S.eR?c.Vr.toFixed(2)+' V':'\u2014'],\r\n    ['V<sub>L<\/sub>',S.eL?c.Vl.toFixed(2)+' V':'\u2014'],['V<sub>C<\/sub>',S.eC?c.Vc.toFixed(2)+' V':'\u2014'],\r\n  ].map(r=>`<span class=\"rk\">${r[0]}<\/span><span class=\"rv\">${r[1]}<\/span>`).join('')+extra;\r\n}\r\nfunction updType(){const t=[];if(S.eR)t.push('R');if(S.eL)t.push('L');if(S.eC)t.push('C');$('cType').textContent=(t.length?t.join(''):'\u2014')+' Serie';}\r\nfunction updVis(){$('rR').style.opacity=S.eR?1:0.3;$('rR').style.pointerEvents=S.eR?'auto':'none';$('rL').style.opacity=S.eL?1:0.3;$('rL').style.pointerEvents=S.eL?'auto':'none';$('rC').style.opacity=S.eC?1:0.3;$('rC').style.pointerEvents=S.eC?'auto':'none';}\r\nfunction updFml(){const b=$('fB');if(!S.showF){b.style.display='none';return;}b.style.display='block';const c=calc();\r\n  b.innerHTML=`<div class=\"ft\">Expresiones<\/div><div class=\"fl\"><b>X<sub>L<\/sub>=2\u03c0fL<\/b> = 2\u03c0\u00b7${S.f.toFixed(2)}\u00b7${(S.L*1000).toFixed(1)}mH = <b>${c.XL.toFixed(2)} \u03a9<\/b><\/div><div class=\"fl\"><b>X<sub>C<\/sub>=1\/(2\u03c0fC)<\/b> = 1\/(2\u03c0\u00b7${S.f.toFixed(2)}\u00b7${(S.C*1e6).toFixed(1)}\u03bcF) = <b>${c.XC.toFixed(2)} \u03a9<\/b><\/div><div class=\"fl\"><b>X=X<sub>L<\/sub>\u2212X<sub>C<\/sub><\/b> = ${c.XL.toFixed(2)}\u2212${c.XC.toFixed(2)} = <b>${c.X.toFixed(2)} \u03a9<\/b><\/div><div class=\"fl\"><b>Z=\u221a(R\u00b2+X\u00b2)<\/b> = \u221a(${c.R}\u00b2+${c.X.toFixed(2)}\u00b2) = <b>${c.Z.toFixed(2)} \u03a9<\/b><\/div><div class=\"fl\"><b>\u03c6=arctan(X\/R)<\/b> = <b>${(c.phi*180\/Math.PI).toFixed(2)}\u00b0<\/b><\/div><div class=\"fl\"><b>I=V\/Z<\/b> = ${S.V}\/${c.Z.toFixed(2)} = <b>${c.Irms.toFixed(4)} A<\/b><\/div><div class=\"fl\"><b>P=VIcos\u03c6<\/b> = <b>${c.P.toFixed(2)} W<\/b><\/div>${S.eL&&S.eC?`<div class=\"fl\"><b>f\u2080=1\/(2\u03c0\u221aLC)<\/b> = <b>${(1\/(2*Math.PI*Math.sqrt(S.L*S.C))).toFixed(2)} Hz<\/b><\/div>`:''}`;}\r\nfunction refresh(){updRes();updType();updVis();updFml();}\r\n\r\nfunction bSl(sid,vid,prop,fmt,toS,frS){const sl=$(sid),vl=$(vid);sl.addEventListener('input',()=>{S[prop]=toS?toS(+sl.value):+sl.value;vl.textContent=fmt(S[prop]);refresh();});vl.textContent=fmt(S[prop]);if(frS)sl.value=frS(S[prop]);}\r\nfunction init(){\r\n  ['R','L','C'].forEach(k=>{const el=$('t'+k);el.addEventListener('change',()=>{S['e'+k]=el.checked;if(!S.eR&&!S.eL&&!S.eC){S['e'+k]=true;el.checked=true;toast('Al menos un componente debe estar activo');}refresh();});});\r\n  bSl('sV','vV','V',v=>v.toFixed(1)+' V');\r\n  bSl('sF','vF','f',v=>v.toFixed(2)+' Hz');  \/* 2 decimales para precision de resonancia *\/\r\n  bSl('sR','vR','R',v=>v.toFixed(0)+' \u03a9');\r\n  bSl('sL','vL','L',v=>(v*1000).toFixed(1)+' mH',s2L,L2s);\r\n  bSl('sC','vC','C',v=>(v*1e6).toFixed(1)+' \u03bcF',s2C,C2s);\r\n  const sSp=$('sSp'),vSp=$('vSp');sSp.addEventListener('input',()=>{S.speed=+sSp.value\/100;vSp.textContent=S.speed.toFixed(2)+'x';});vSp.textContent=S.speed.toFixed(2)+'x';sSp.value=S.speed*100;\r\n  $('bP').addEventListener('click',()=>{S.paused=!S.paused;$('bP').innerHTML=S.paused?'<i class=\"fas fa-play\"><\/i> Reanudar':'<i class=\"fas fa-pause\"><\/i> Pausar';});\r\n  \/* Resonancia: ajusta f exactamente a f\u2080 con precision de 0.01 Hz *\/\r\n  $('bR').addEventListener('click',()=>{\r\n    if(!S.eL||!S.eC){toast('Active L y C para calcular la resonancia');return;}\r\n    const f0=1\/(2*Math.PI*Math.sqrt(S.L*S.C));\r\n    \/* Redondear a 0.01 Hz (step del slider) *\/\r\n    S.f=Math.round(f0*100)\/100;\r\n    S.f=Math.min(Math.max(S.f,0.01),500);\r\n    $('sF').value=S.f;$('vF').textContent=S.f.toFixed(2)+' Hz';\r\n    refresh();\r\n    const c2=calc();\r\n    toast('f\u2080 = '+f0.toFixed(2)+' Hz \u2192 f = '+S.f.toFixed(2)+' Hz | XL = '+c2.XL.toFixed(2)+' \u03a9 | XC = '+c2.XC.toFixed(2)+' \u03a9 | Z = '+c2.Z.toFixed(2)+' \u03a9 | \u03c6 = '+(c2.phi*180\/Math.PI).toFixed(2)+'\u00b0');\r\n  });\r\n  $('bF').addEventListener('click',()=>{S.showF=!S.showF;updFml();});\r\n  window.addEventListener('resize',refresh);refresh();\r\n  let last=0;function loop(ts){if(!last)last=ts;const dt=Math.min((ts-last)\/1000,0.05);last=ts;if(!S.paused)S.ph+=2*Math.PI*S.speed*dt;drawCirc();drawPhasor();drawWave();drawPower();requestAnimationFrame(loop);}\r\n  requestAnimationFrame(loop);\r\n}\r\ninit();\r\n<\/script>\r\n<\/body>\r\n<\/html>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>LabAC \u2014 Simulador de Circuitos CA LabAC Simulador Circuitos en Corriente Alterna \u2014 Serie Componentes R Serie Resistencia (R) Inductancia (L) Capacitancia (C) Parametros de&hellip;<\/p>\n","protected":false},"author":7,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-7643","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>circuitos_corriente_alterna - F\u00edsica 2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"circuitos_corriente_alterna - F\u00edsica 2\" \/>\n<meta property=\"og:description\" content=\"LabAC \u2014 Simulador de Circuitos CA LabAC Simulador Circuitos en Corriente Alterna \u2014 Serie Componentes R Serie Resistencia (R) Inductancia (L) Capacitancia (C) Parametros de&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/\" \/>\n<meta property=\"og:site_name\" content=\"F\u00edsica 2\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-27T17:40:56+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/index.php\\\/circuitos_corriente_alterna\\\/\",\"url\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/index.php\\\/circuitos_corriente_alterna\\\/\",\"name\":\"circuitos_corriente_alterna - F\u00edsica 2\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/#website\"},\"datePublished\":\"2026-05-26T12:56:54+00:00\",\"dateModified\":\"2026-05-27T17:40:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/index.php\\\/circuitos_corriente_alterna\\\/#breadcrumb\"},\"inLanguage\":\"es-AR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/index.php\\\/circuitos_corriente_alterna\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/index.php\\\/circuitos_corriente_alterna\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Inicio\",\"item\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"circuitos_corriente_alterna\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/#website\",\"url\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/\",\"name\":\"F\u00edsica 2\",\"description\":\"FICA - UNSL\",\"publisher\":{\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es-AR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/#organization\",\"name\":\"SAC- Secretar\u00eda General FICA\",\"url\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es-AR\",\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/SG-Logo.png\",\"contentUrl\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/SG-Logo.png\",\"width\":4483,\"height\":1231,\"caption\":\"SAC- Secretar\u00eda General FICA\"},\"image\":{\"@id\":\"https:\\\/\\\/fisica2.fica.unsl.edu.ar\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"circuitos_corriente_alterna - F\u00edsica 2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/","og_locale":"es_ES","og_type":"article","og_title":"circuitos_corriente_alterna - F\u00edsica 2","og_description":"LabAC \u2014 Simulador de Circuitos CA LabAC Simulador Circuitos en Corriente Alterna \u2014 Serie Componentes R Serie Resistencia (R) Inductancia (L) Capacitancia (C) Parametros de&hellip;","og_url":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/","og_site_name":"F\u00edsica 2","article_modified_time":"2026-05-27T17:40:56+00:00","twitter_card":"summary_large_image","twitter_misc":{"Tiempo de lectura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/","url":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/","name":"circuitos_corriente_alterna - F\u00edsica 2","isPartOf":{"@id":"https:\/\/fisica2.fica.unsl.edu.ar\/#website"},"datePublished":"2026-05-26T12:56:54+00:00","dateModified":"2026-05-27T17:40:56+00:00","breadcrumb":{"@id":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/#breadcrumb"},"inLanguage":"es-AR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/circuitos_corriente_alterna\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Inicio","item":"https:\/\/fisica2.fica.unsl.edu.ar\/"},{"@type":"ListItem","position":2,"name":"circuitos_corriente_alterna"}]},{"@type":"WebSite","@id":"https:\/\/fisica2.fica.unsl.edu.ar\/#website","url":"https:\/\/fisica2.fica.unsl.edu.ar\/","name":"F\u00edsica 2","description":"FICA - UNSL","publisher":{"@id":"https:\/\/fisica2.fica.unsl.edu.ar\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fisica2.fica.unsl.edu.ar\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es-AR"},{"@type":"Organization","@id":"https:\/\/fisica2.fica.unsl.edu.ar\/#organization","name":"SAC- Secretar\u00eda General FICA","url":"https:\/\/fisica2.fica.unsl.edu.ar\/","logo":{"@type":"ImageObject","inLanguage":"es-AR","@id":"https:\/\/fisica2.fica.unsl.edu.ar\/#\/schema\/logo\/image\/","url":"https:\/\/fisica2.fica.unsl.edu.ar\/wp-content\/uploads\/2021\/11\/SG-Logo.png","contentUrl":"https:\/\/fisica2.fica.unsl.edu.ar\/wp-content\/uploads\/2021\/11\/SG-Logo.png","width":4483,"height":1231,"caption":"SAC- Secretar\u00eda General FICA"},"image":{"@id":"https:\/\/fisica2.fica.unsl.edu.ar\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/pages\/7643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/comments?post=7643"}],"version-history":[{"count":28,"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/pages\/7643\/revisions"}],"predecessor-version":[{"id":7687,"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/pages\/7643\/revisions\/7687"}],"wp:attachment":[{"href":"https:\/\/fisica2.fica.unsl.edu.ar\/index.php\/wp-json\/wp\/v2\/media?parent=7643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}