What are the scenarios where Triacs can not replace a relay or vice-versa?
Thyristors (triacs and their unidirectional cousins, SCRs) are solid-state devices, whereas relays are electromechanical devices. Triacs can switch both AC and DC, but as XTL said, they will not stop the current flow unless the current between MT1 and MT2 falls below a threshold level, or you forcibly commutate the device off.
(note: I spent 13 years in industrial motor control, we designed equipment which switched up to many thousands of Amps and many thousands of Volts through thyristors.)
Relays are pretty simple devices to use; you energize the coil and the contacts engage. You de-energize the coil and the contacts open. A simple transistor can drive it, but you'll want some snubbering (a reverse-biased diode across the relay coil at a minimum) to prevent your transistor from dying due to inductive kickback. Your control signal and your controlled signal are completely isolated from one another.
Relay contacts aren't invincible; if you open up the contacts under load you can cause them to "ice up" (meaning they won't open up). Also, if you use a relay rated for power and try to switch small signals, the contacts can eventually get dirty and you won't get a good connection between the contacts.
Triacs, being solid-state, are mostly silent. Unless you use a pulse transformer or optoisolator, your control circuit will be at the potential of your controlled circuit (generally the Neutral for your 120/220V circuits). Thyristors can be used to phase-control a load, meaning you can dim lights or (roughly) control the speed of an AC motor. This is pretty much impossible with relays. You can also do neat tricks like allowing only 'x' entire cycles through to do less "noisy" phase control. SCRs are also good for dumping all the energy in a capacitor into a load (flash or railgun type applications). Some power supplies use SCRs as crowbar devices as well; they turn on and short out the supply (blowing the fuse in the process), protecting the load from an overvoltage.
Thyristors don't really enjoy sharp voltage or current spikes when they're turned off; these can cause them to turn on by accident or can destroy the devices. Simple snubbering helps control these failure modes.
Thyristors also don't completely isolate the load from the source; if you measure the voltage on a load with the thyristor off, you'll measure full voltage. They thyristor is off, but off doesn't mean "open" -- it means "high resistance". This can cause trouble with some applications.
If you are switching an AC signal, thyristors are pretty painless; they will shut themselves off around the next zero crossing. If you're controlling DC... again... you have more to think about. DC is also problematic for relays because you will almost always be opening up the relay contacts under load, so you must size your relay for this.
Long story short: Yes, triacs can replace relays in almost every application. If you don't want to bother with the snubbering and isolation you can always buy solid state relays; they're triacs with the appropriate control circuitry to make them work almost the same as relays.
Advantages of the triac
- No mechanical wear-out
- Easier to switch on zero-crossing. (Can also be done with a relay, but less accurate due to the switch-on delay)
- Can be used in dangerous environment, particularly in explosive sensitive environments where sparking relay contacts are absolutely out
- No EMI due to switching sparks/arcs
- No contacts which can weld
- Often more compact
- No magnetic interaction with nearby inductors
Advantages of the relay
- Can handle DC
- Can handle any signal: low and high current, low and high frequency, low and high voltage
- Insulation between control and switched sides
- No leakage when off
- Very low voltage drop when on
- Therefore high currents possible without cooling
- No dV/dT snubber needed
A triac, being a kind of thyristor, will turn off (only) at zero current (zero cross). Its drive requirements are also different.
I guess the most obvious scenario is where you want to turn something, say a motor, on and off at will. A triac by itself can't cut the power like a relay can so you'll need another pass element that you can turn off and thus turn off the triac.
A triac will probably also be destroyed if you take it outside its limits, so there might be some high voltage or current scenario where you can't find a big enough triac, but can find a relay.
Another might be a very delicate signal that can't keep a triac on.
But the clearest difference is that a relay is generally completely isolated between drive and switching sides, a triac will require a bit of current between the two circuits, so it won't be appropriate if you need that particular spot to be isolated. You can possibly isolate the gate drive side, though (and often do, when switching 120/230 VAC).
If I remember correctly a triac is no good on DC, only AC.
But a relay can handle both.
You can combine them both. The power dissipated by SSRs is typically 13W at 10A, probably requiring a heatsink. But by using a mechanical relay you can reduce this to only occur for a few milliseconds whilst the relay is closing. Since the SSR is already on, the voltage across the relay contacts is very low, so no arcing occurs. You'll probably need a small microprocessor because the sequencing of the on/off signals needs to be correct.