Small Hydro Power Plant with Elixir
Part 2
Nerves Conf EU
2025/09/10
1
Outline
2
System map
3
MODBUS devices
MODBUS devices
Hub
Hub
Erlang Cluster
SDC
PGC
DIO
Temp
Volt
RPM
DIO
Volt
SoC
optical fiber
turbidity, water level
SoC: battery’s State of Charge [%]
Control Plant
Collects and pushes data to WEB
4
PGC
Hub
Bus line Multimeter
Gen line Multimeter
Rotation meter
DIOs
DIOs, temps
Modbus TCP
Device
Modbus TCP/RTU Converter
RS-485 bus
Why we chose MODBUS TCP
5
Momentary switches without interrupts
The switches on panel can work with 100ms data polling loop.
For this system, this duration is sufficient.
6
Which MODBUS TCP library we use
We choose our own way.
Make things under control, this is the core library of our system.
If there is a bug, that’s our bug. ��We can immediately fix it ourselves.
7
Give it a try�and give us feedback
8
Modbuzz
TCP
Client
Modbuzz
RTU
Client
Any
TCP/RTU
Client
Modbuzz
TCP/RTU
Server
Modbuzz
TCP
Server
Modbuzz
RTU
Client
Any
TCP
Client
Communication between nodes
9
MODBUS devices
MODBUS devices
Erlang Cluster
SDC
PGC
DIO
Temp
Volt
RPM
DIO
Volt
SOC
GenServer.call with {:global, term}
:erpc.call(node, module, function, args)
Let’s dig in about control
We don't use any PLCs to control. �So, how do we control the plant?
10
Input Valve
Needle Valve
Writing `Sequence` with GenServer
11
part of Run sequence
12
part of Run sequence
How it works
13
Generator
Power
Bus
Power
Adjust to sync with the bus line
14
AVR
actuator
automatic synchronizer
CB
Fault monitor checks ex.
Check their values and run the fault sequence if needed.
15
But what if the fault monitor crashes?
Stop safely even if what happens 1
16
FM
FMM
Fault Monitor Monitor
FM
FMM
FMM detects it and
invokes `EmergencyStop` sequence
Stop safely even if what happens 2
17
Make heartbeats and monitors them with primitive devices.
When the beats stopped, invoke `EmergencyStop` circuit.
Off-site working
18
test target�
ex)
needle valve
sequence
device’s mock
interface
On-site working
19
20
PGC
21
Processes tab
Our happy moment
22
Let’s keep building fun things with Nerves.
Thank you.
23