Technically, when the phototransistor is ON (input LED is lit) the circuit applies a logic 0 to the input of the first inverter. That inverter will respond by making its output '1' (5V). At that point, the 'OK' relay will turn OFF (5V on both of its inputs - a net 0 volts). The '1' from the first inverter is also applied to the input of the second inverter. That inverter will respond by making its output a logic 0 (0V). It does this by turning on an internal transistor to ground - so it sinks current. That ALARM relay will then have 5V on its + input and ground on its (-) input (through the inverter's output transistor), a net 5V and it turns ON.If the photocoupler is on (5v), then the +5v logic will go to logic ground and not the inverter?
The 24V stuff happens at the relay outputs as in your original drawing. Presumably, when the relay is ON, a 24V (from a separate 24V supply) light/buzzer etc. gets turned on. You need the relays as the logic is 5V only - attempting to switch 24V with TTL logic lets the smoke out.Also, would I be able to add another opto at the end of the inverters to output the final 24vdc I need? Just wire the logic signal to the ground and have the positive signal as +24vdc from a power supply?