DL/T 645-2007 Slave (Electricity Meter Simulator) GenServer.
Simulates an actual electricity meter responding to DL/T 645 master requests over physical serial ports, in-memory virtual buses, or TCP sockets.
Maintains internal registers/state for energy, voltage, current, power, parameters, and responds automatically to standard DL/T 645 function codes.
Summary
Functions
Returns the meter's current communication address.
Returns a specification to start this module under a supervisor.
Retrieves the value for a given Data Identifier from the meter's internal state.
Updates the meter's communication address.
Sets the value for a given Data Identifier in the meter's internal state.
Starts a DL/T 645 Slave GenServer.
Stops the Slave GenServer process.
Types
Functions
Returns the meter's current communication address.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec get_value(slave_ref(), non_neg_integer() | binary() | String.t()) :: {:ok, term()} | :error
Retrieves the value for a given Data Identifier from the meter's internal state.
Updates the meter's communication address.
@spec set_value(slave_ref(), non_neg_integer() | binary() | String.t(), term()) :: :ok
Sets the value for a given Data Identifier in the meter's internal state.
Starts a DL/T 645 Slave GenServer.
Parameters
:address- 12-digit meter address string (e.g."123456789012").:tty- Serial device or virtual bus (e.g."virtual").:transport- Optional explicit Transport module.:data- Map of initial data items%{di => value}.
@spec stop(slave_ref()) :: :ok
Stops the Slave GenServer process.