I want to connect to my home install of phpmyadmin. I restricted the connection for this to my 2 IPs.

But I don't really understand this whole OSI layering. I do know that the IP is saved in the second layer, and I guess that the IP restriction will just look for this layer. 

Is it possible to read out the password from the 7th layer, even if I have an IP restriction?


Question: Triac circuit confusion
Answer: As Gabe already indicated, the circuit shown is a standard chopper/dimmer circuit, as is also commonly used in lighting applications. The goal of the circuit is to control the current supplied to the battery, as indicated in the problem statement. To achieve this goal, it does not matter whether one controls the power into the transformer/rectifier combination, or one controls the amount of power going from the rectifier to the battery.

You asked in a comment why you need to reduce the power to the transformer. The easy answer is: Because the problem tells you that the power to the battery should be controlled. The complicated answer involves battery charging algorithms and explains why you would want to control power to the battery. I consider that answer out-of-scope.

You also asked in a comment, why you don't use a simple resistor. That's actually a good question, as a resistor could provide similar results. But the circuit shown is far more efficient. The circuit shown has the pass element, in this case the triac, either open (like an open switch, a very high resistance one can assume to be infinity) or closed (like a closed switch, which can be treated like a short circuit between the terminals as a very coarse approach).


While the triac is turned off, there is no loss (voltage multiplied by current) in the triac, as the current is zero.
While the triac is turned on, there is low loss in the triac, as the voltage is quite low (likely 1 to 2 volts). In the extremely simplified version of a short circuit for the triac after ignition, there would be no loss, as the voltage is zero.


If the output power should be reduced to the half of what you get if the triac circuit was not there, the triac would be on 50% of the time and off 50% of the time.

In a resistor-based solution to that problem, to reduce the current, one would need to permanently remove the excess voltage on the primary side (it would work on the secondary as well) by dropping it across the resistor. In this case, the resistor is the "pass element" and has a considerable voltage and current at the same time, so it causes losses. (I.e. the resistor gets hot, and you built yourself not just a battery charger, but also an electric heater).

Basically, what you see in that circuit is a very simple form of a switching or switch-mode power reduction circuit which is more efficient thant the typical linear power reduction methode obtained by using a resistor.

You furthermore ask in your question about the R/C-combination to the right. That combination is a snubber circuit. You need it because every real transformer (and even idealised transformers in most cases) have an inductance. The triac turns off each cycle shortly before the current through the transformer reaches zero. The inductance of the transformer tries to keep the current flowing, and would create the well-known inductive voltage spike if there was no way for the current to go. That's what the capacitor is for: it catches the excess current when the switch is off. The resistor is to waste the energy that comes from the transformer due to its inductance. If it were missing, you would get an LC tank circuit that oscillates (and might cause electo-magnetic interference).

Finally, you might wonder why one would perform power-control on the primary side of the transformer instead of the secondary side. There are two considerations:


The "diac-triac"-dimmer only works on AC current, as it is about cutting AC line cycles, so you can't put this kind of circuit past the rectifier
The typical diac breakdown voltage is 33V, so to get good performance out of that circuit, you need an input voltage that exceeds 33V significantly. You don't have such high voltages on the secondary side in typical charger applications. Also, losses of the dimmer circuit are dominated by the triac pass voltage, which is not that much dependent on current. So a lower current causes lower losses. As the primary side (typically) operates at a higher voltage, you have less current and thus less losses on the primary side.