# 一種安全可調的穩壓器設計

#### 作者 : Peter Demchenko，University of Vilnius

1顯示了LM350 (LM317)可調穩壓器在需要調整其輸出電壓時的典型應用。

eo = Vref * (R2/R1 + 1)

3中的程式碼給出了R22和R23的計算。

 #-code-begins R11=560   # Ohm Rpot=2180  # Ohm

eo11=1.25  #V eo12=5.6   #V eo21=5.4    #V eo22=23.0   #VVref=1.25  #V print()# Let K12 = eo12/Vref – 1 K21 = eo21/Vref – 1 K22 = eo22/Vref – 1 Rp = Rpot from math import sqrt def checkEq(R11, R22, R23): Rx=R11 – Ra/K12 if Rx != 0: print(“Err R11:”, Rx) Rx=R22*R23/(R22+R23) – K21*(Rp+R11) if Rx != 0:  print(“Err (2):”, Rx) Rx=R11 – (R22*(Rp+R23)/(R22+Rp+R23) / K22) if Rx != 0:  print(“Err (3):”, Rx) return def par(r1,r2): return(r1*r2/(r1+r2)) eo=eo12 R1 = R11 R2 = R1*((eo/Vref) -1) R22 = R2*Rpot / (Rpot – R2) eo=eo21   #5.1V #R1 = R11 + R21*Rpot / (R21 + Rpot) #R2 = R1*(eo/Vref -1) #R23 = R2 #eo=eo22   #24V ?? #R1 = R11 #R2 = R23 + R22*Rpot / (R22 + Rpot) #eo = Vref*(R2/R1 + 1) #eo22 = eo #Let   K12 = eo12/Vref – 1 K21 = eo21/Vref – 1 K22 = eo22/Vref – 1 Rp = Rpot Ra = par(Rp,R22) w3=K22/K21 A=w3*(R22 – K21*Rp) – R22 B=w3*R22*(R22+Rp) – Rp*(w3*K21*(Rp+R22)-R22) – R22*R22 C=Rp*R22*(0-w3*K21*(R22+Rp)-R22) Q=B*B – 4*A*C #print(A, B, C, Q) if Q<0: exit(” Exit: Q<0, try another values for R11, Rpot, or ranges”) R23_1 = (0-B + sqrt(Q)) /2/A R23_2 = (0-B – sqrt(Q)) /2/A print(”   R23_1, R23_2=”, R23_1, R23_2) # since R23 should be > 0:   if R23_1>0:  R23=R23_1 elif R23_2>0:  R23=R23_2 else:  print(“Error: both R23_1, R23_2 are not positives”) # recalc eoij for a coherence check eo12=Vref*(par(Rp,R22)/R11 +1) eo21=Vref*(par(R23,R22)/(Rp+R11) +1) eo22=Vref*(par(R22,R23+Rp)/R11 +1) # update K12 = eo12/Vref – 1 K21 = eo21/Vref – 1 K22 = eo22/Vref – 1 print(“Fig2c:”, f” eo12={eo12:.2f}”, f” eo21={eo21:.2f}”, f” eo22={eo22:.2f}”) print(“Fig2c:”, f” Rpot={Rpot:.1f}”, f” R11={R11:.1f}”, f” R22={R22:.1f}”, f” R23={R23:.1f}”) checkEq(R11, R22, R23) # since the solution we got may be very sensitive due to a possible presence of a singular point in its vicinity (i.e. a small deviation of a resistor’s value can have large impact on the voltage) – hence 2 conclusions follows: # – tolerances of resistors R11, R22, R23 have to be not worse than 1%; # – the solution above has to be considered as a preliminary one, so we’ll make it more precise by the following code:   R23lim=100*R23 R23=R23/3 while R23 < R23lim: eo21_x=Vref*(par(R23,R22)/(Rp+R11) +1) eo22_x=Vref*(par(R22,R23+Rp)/R11 +1) if eo21_x – eo21 > 0.2: break if abs(eo22 – eo22_x) < 0.1: break    # if eo22-x – eo22 < 0.1: break R23 += 10   # +10 Ohm else:  exit(“full cycle”)   print( f” eo21={eo21_x:.2f}”, f” eo22={eo22_x:.2f}”,  f” R23={R23:.1f}”) #-end-of-code-

eoBreak = iA * R22 + Vref

(參考原文：A safe adjustable regulator，by Peter Demchenko)