Categorygithub.com/alex11prog/ups-imitator
module
0.0.0-20240818183358-2ecf27686e20
Repository: https://github.com/alex11prog/ups-imitator.git
Documentation: pkg.go.dev

# README

Ups-imitator

Simulates the operation of UPS, calculates and loads current parameter values ​into it via Modbus
Intended for testing the monitoring system

Work scheme
scheme

In this work was used mock ups controller

Operating modes

  1. Auto
    Work in cycle:

    • q0 — The electrical network is connected, the battery is charged;
    • q1 — The electrical network is turned off, the battery is discharging;
    • q2 — The electrical network is turned off, the battery is discharged;
    • q3 — The electrical network is connected, the battery is charging.

    auto-mode-cycle

  2. Manual

    Manually changing parameters via rest api
    Swagger documentation swagger

Getting started

  1. Prepare config
    example:

     ups_addr = "127.0.0.1:1502"
     rest_api_bind_addr = ":8080"
     ups_sync_interval = 30 # sec
    
     cycle_change_timeout = 3600 # sec
    
     default_input_ac_voltage    = 220   # V
     max_bat_group_voltage       = 54    # V
     min_bat_group_voltage       = 42    # V
     load_power                  = 1000  # W
     default_bat_capacity        = 50    # Ah
     charge_current_limit        = 20    # A
     low_soc_trigger_alarm       = 0.1   # from 0 to 1, 1: 100%
    
  2. Build

    make
    
  3. Run

    ./bin/ups-imitator
    

Testing

make test

Results of work in auto mode

  1. Launch mock ups controller;
  2. Launch ups-imitator (pre-specify the mock-ups address in the config);
  3. Launch ups-agent to read data from the UPS.

Result of loop in grafana
grafana-cycle

Graph with marked transitions of automatic mode states
grafana-cycle-transitions

# Packages

No description provided by the author
Package docs Code generated by swaggo/swag.