Imagine you have a process for each PLC - a GenServer or a gen_statem (or some other state machine representation). Thought you might end up implementing your own controller behaviour that wraps a GenServer.
If you model the connection using a state machine you might have the states disconnected and connected. If you’re connected, you poll the PLC for updates, check what you get back is what you’re expecting and persist it, send it on or whatever. If you’re disconnected, you retry connecting every now and then.
If you want to modify the tags read from that PLC, you send a message to that PLC’s process with the new list (of maps or tuples… e.g.%{tag: "SOME_TAG", type: :dint}). If you want to add another PLC, you add it under a DynamicSupervisor.
You could keep the alarms in :ets.






















