Skip to content

Commit 4d9cc1a

Browse files
committed
Minor updates.
1 parent dbc343c commit 4d9cc1a

File tree

2 files changed

+63
-70
lines changed

2 files changed

+63
-70
lines changed

app/dmrecv.f90

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ integer function open_file(path, replace, unit) result(rc)
107107
position='append', status='unknown')
108108
end if
109109

110-
if (stat /= 0) return
111-
rc = E_NONE
110+
if (stat == 0) rc = E_NONE
112111
end function open_file
113112

114113
integer function read_args(app) result(rc)
@@ -243,15 +242,14 @@ integer function read_config(app) result(rc)
243242
end function read_config
244243

245244
integer function recv_log(app, mqueue) result(rc)
246-
type(app_type), intent(inout) :: app
247-
type(mqueue_type), intent(inout) :: mqueue
245+
type(app_type), intent(inout) :: app !! App type.
246+
type(mqueue_type), intent(inout) :: mqueue !! Message queue type.
248247

249248
character(len=NML_LOG_LEN) :: log_nml
250249
integer :: unit, stat
251250
type(log_type) :: log
252251

253252
unit = stdout
254-
255253
call logger%debug('waiting for log on mqueue /' // app%name)
256254

257255
! Read log from POSIX message queue (blocking).
@@ -304,12 +302,12 @@ integer function recv_log(app, mqueue) result(rc)
304302
return
305303
end if
306304

307-
call logger%debug('log ' // trim(log%id) // ' written to ' // app%output)
305+
if (app%file) call logger%debug('log ' // trim(log%id) // ' written to ' // app%output)
308306
end function recv_log
309307

310308
integer function recv_observ(app, mqueue) result(rc)
311-
type(app_type), intent(inout) :: app
312-
type(mqueue_type), intent(inout) :: mqueue
309+
type(app_type), intent(inout) :: app !! App type.
310+
type(mqueue_type), intent(inout) :: mqueue !! Message queue type.
313311

314312
character(len=NML_OBSERV_LEN) :: observ_nml
315313
integer :: unit
@@ -318,7 +316,6 @@ integer function recv_observ(app, mqueue) result(rc)
318316
type(observ_type) :: observ
319317

320318
unit = stdout
321-
322319
call logger%debug('waiting for observ on mqueue /' // app%name)
323320

324321
! Read observation from POSIX message queue (blocking).
@@ -385,7 +382,7 @@ integer function recv_observ(app, mqueue) result(rc)
385382
return
386383
end if
387384

388-
call logger%debug('observ ' // trim(observ%id) // ' written to ' // app%output)
385+
if (app%file) call logger%debug('observ ' // trim(observ%id) // ' written to ' // app%output)
389386

390387
! Forward observation to next receiver.
391388
if (app%forward) then
@@ -410,8 +407,8 @@ end subroutine halt
410407

411408
subroutine run(app, mqueue)
412409
!! Event loop that receives logs or observations.
413-
type(app_type), intent(inout) :: app
414-
type(mqueue_type), intent(inout) :: mqueue
410+
type(app_type), intent(inout) :: app !! App type.
411+
type(mqueue_type), intent(inout) :: mqueue !! Message queue type.
415412

416413
integer :: rc
417414

@@ -424,11 +421,8 @@ subroutine run(app, mqueue)
424421
end select
425422

426423
select case (rc)
427-
case (E_IO)
428-
exit ipc_loop
429-
case (E_MQUEUE)
430-
call dm_sleep(5)
431-
cycle ipc_loop
424+
case (E_IO); exit ipc_loop
425+
case (E_MQUEUE); call dm_sleep(5)
432426
end select
433427
end do ipc_loop
434428
end subroutine run

guide/guide.adoc

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,57 +2634,56 @@ following VE.Direct fields are supported, depending on the device:
26342634

26352635
[cols="1,1,5,1,1"]
26362636
|===
2637-
| Name | Unit | Description | MPPT | Shunt
2638-
2639-
| `Alarm` | – | Alarm condition active (on/off). | | ✓
2640-
| `AR` | – | Alarm reason. | | ✓
2641-
| `CE` | mAh | Consumed amp hours. | | ✓
2642-
| `CS` | – | State of operation. | ✓ |
2643-
| `DM` | ‰ | Mid-point deviation of the battery bank. | | ✓
2644-
| `ERR` | – | Error code. | ✓ |
2645-
| `H1` | mAh | Depth of the deepest discharge. | | ✓
2646-
| `H2` | mAh | Depth of the last discharge. | | ✓
2647-
| `H3` | mAh | Depth of the average discharge. | | ✓
2648-
| `H4` | – | Number of charge cycles. | | ✓
2649-
| `H5` | – | Number of full discharges. | | ✓
2650-
| `H6` | mAh | Cumulative amp hours drawn. | | ✓
2651-
| `H7` | mV | Minimum main (battery) voltage. | | ✓
2652-
| `H8` | mV | Maximum main (battery) voltage. | | ✓
2653-
| `H9` | sec | Number of seconds since last full charge. | | ✓
2654-
| `H10` | – | Number of automatic synchronisations. | | ✓
2655-
| `H11` | – | Number of low main voltage alarms. | | ✓
2656-
| `H12` | – | Number of high main voltage alarms. | | ✓
2657-
| `H15` | mV | Minimum auxiliary (battery) voltage. | | ✓
2658-
| `H16` | mV | Maximum auxiliary (battery) voltage. | | ✓
2659-
| `H17` | kWh/100 | Amount of produced energy. | | ✓
2660-
| `H18` | kWh/100 | Amount of consumed energy. | | ✓
2661-
| `H19` | kWh/100 | Yield total (user resettable counter). | ✓ |
2662-
| `H20` | kWh/100 | Yield today. | ✓ |
2663-
| `H21` | W | Maximum power today. | ✓ |
2664-
| `H22` | kWh/100 | Yield yesterday. | ✓ |
2665-
| `H23` | W | Maximum power yesterday. | ✓ |
2666-
| `HSDS` | – | Day sequence number (0 to 364). | ✓ |
2667-
| `I` | mA | Main or channel 1 battery current. | ✓ | ✓
2668-
| `IL` | mA | Load current. | ✓ |
2669-
| `LOAD` | – | Load output state (on/off). | ✓ |
2670-
| `MON` | – | DC monitor mode. | | ✓
2671-
| `MPPT` | – | Tracker operation mode. | ✓ |
2672-
| `OR` | – | Off reason. | ✓ |
2673-
| `P` | W | Instantaneous power. | | ✓
2674-
| `PPV` | W | Panel power. | ✓ |
2675-
| `Relay` | – | Relay state (on/off). | ✓ | ✓
2676-
| `SOC` | ‰ | State-of-charge. | | ✓
2677-
| `T` | °C | Battery temperature. | | ✓
2678-
| `TTG` | min | Time-to-go. | | ✓
2679-
| `V` | mV | Main or channel 1 (battery) voltage. | ✓ | ✓
2680-
| `VM` | mV | Mid-point voltage of the battery bank. | | ✓
2681-
| `VPV` | mV | Panel voltage. | ✓ |
2682-
| `VS` | mV | Auxiliary (starter) voltage. | | ✓
2683-
|===
2684-
2685-
The response names of the created observations equal the field names in
2686-
lower-case. Observations are sent to the receiver via message queue in the
2687-
specified interval.
2637+
| Response | Unit | Description | MPPT | Shunt
2638+
2639+
| `alarm` | – | Alarm condition active (on/off). | | ✓
2640+
| `ar` | – | Alarm reason. | | ✓
2641+
| `ce` | mAh | Consumed amp hours. | | ✓
2642+
| `cs` | – | State of operation. | ✓ |
2643+
| `dm` | ‰ | Mid-point deviation of the battery bank. | | ✓
2644+
| `err` | – | Error code. | ✓ |
2645+
| `h1` | mAh | Depth of the deepest discharge. | | ✓
2646+
| `h2` | mAh | Depth of the last discharge. | | ✓
2647+
| `h3` | mAh | Depth of the average discharge. | | ✓
2648+
| `h4` | – | Number of charge cycles. | | ✓
2649+
| `h5` | – | Number of full discharges. | | ✓
2650+
| `h6` | mAh | Cumulative amp hours drawn. | | ✓
2651+
| `h7` | mV | Minimum main (battery) voltage. | | ✓
2652+
| `h8` | mV | Maximum main (battery) voltage. | | ✓
2653+
| `h9` | sec | Number of seconds since last full charge. | | ✓
2654+
| `h10` | – | Number of automatic synchronisations. | | ✓
2655+
| `h11` | – | Number of low main voltage alarms. | | ✓
2656+
| `h12` | – | Number of high main voltage alarms. | | ✓
2657+
| `h15` | mV | Minimum auxiliary (battery) voltage. | | ✓
2658+
| `h16` | mV | Maximum auxiliary (battery) voltage. | | ✓
2659+
| `h17` | kWh/100 | Amount of produced energy. | | ✓
2660+
| `h18` | kWh/100 | Amount of consumed energy. | | ✓
2661+
| `h19` | kWh/100 | Yield total (user resettable counter). | ✓ |
2662+
| `h20` | kWh/100 | Yield today. | ✓ |
2663+
| `h21` | W | Maximum power today. | ✓ |
2664+
| `h22` | kWh/100 | Yield yesterday. | ✓ |
2665+
| `h23` | W | Maximum power yesterday. | ✓ |
2666+
| `hsds` | – | Day sequence number (0 to 364). | ✓ |
2667+
| `i` | mA | Main or channel 1 battery current. | ✓ | ✓
2668+
| `il` | mA | Load current. | ✓ |
2669+
| `load` | – | Load output state (on/off). | ✓ |
2670+
| `mon` | – | DC monitor mode. | | ✓
2671+
| `mppt` | – | Tracker operation mode. | ✓ |
2672+
| `or` | – | Off reason. | ✓ |
2673+
| `p` | W | Instantaneous power. | | ✓
2674+
| `ppv` | W | Panel power. | ✓ |
2675+
| `relay` | – | Relay state (on/off). | ✓ | ✓
2676+
| `soc` | ‰ | State-of-charge. | | ✓
2677+
| `t` | °C | Battery temperature. | | ✓
2678+
| `ttg` | min | Time-to-go. | | ✓
2679+
| `v` | mV | Main or channel 1 (battery) voltage. | ✓ | ✓
2680+
| `vm` | mV | Mid-point voltage of the battery bank. | | ✓
2681+
| `vpv` | mV | Panel voltage. | ✓ |
2682+
| `vs` | mV | Auxiliary (starter) voltage. | | ✓
2683+
|===
2684+
2685+
The values are captured every second. An observation containing the responses of
2686+
the device is sent in the specified interval to the configured receiver.
26882687

26892688
[discrete]
26902689
==== Command-Line Options
@@ -2695,14 +2694,14 @@ specified interval.
26952694

26962695
| `--config _file_` | `-c` | – | Path to configuration file.
26972696
| `--debug` | `-D` | off | Forward log messages of level _debug_ (if logger is set).
2698-
| `--device _name_` | `-d` | – | Type of connected device (`mppt`, `shunt`).
2697+
| `--device _name_` | `-d` | – | Type of connected device (`mppt` or `shunt`).
26992698
| `--help` | `-h` | – | Output available command-line arguments and quit.
27002699
| `--interval _seconds_` | `-I` | 60 | Observation emit interval in seconds.
27012700
| `--logger _name_` | `-l` | – | Optional name of logger. If set, sends logs to <<dmlogger>> process of given name.
27022701
| `--name _name_` | `-n` | `dmved` | Name of instance and table in configuration.
27032702
| `--node _id_` | `-N` | – | Optional node id.
27042703
| `--path _path_` | `-p` | – | Path to TTY device (for example, `/dev/ttyUSB0`).
2705-
| `--receiver _name_` | `-r` | – | Name of receiver/message queue.
2704+
| `--receiver _name_` | `-r` | – | Name of observation receiver/message queue.
27062705
| `--sensor _id_` | `-S` | – | Sensor id.
27072706
| `--target _id_` | `-T` | – | Target id.
27082707
| `--verbose` | `-V` | off | Print log messages to _stderr_.

0 commit comments

Comments
 (0)