Code Monkey home page Code Monkey logo

energy-management-sys_communication-sub-sys's Introduction

EnergyManagementSys_CommunicationSubSys

本系统是一个基于Netty开发的远程抄表系统,系统的主要功能有:远程抄表和数据持久化到DB(目前仅支持MySQL),目前的主要开发服务对象是智能电表,智能电表在行业内的远程抄表使用的是DLT/645-1997协议或DLT/645-2007协议,本系统面向后者开发。

如何使用?

调用cn.edu.xust.communication.remote.AmmeterRemoteReader或者cn.edu.xust.communication.AmmeterAutoReader类中的方法即可,下面是一个使用示例:

package cn.edu.xust.controller;

import cn.edu.xust.bean.AmmeterParameter;
import cn.edu.xust.communication.remote.AmmeterRemoteReader;
import cn.edu.xust.mapper.AmmeterParameterMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * @author :huangxin
 * @modified :
 * @since :2020/03/28 17:25
 */
@Controller
public class AmmeterController {

    @Autowired
    private AmmeterParameterMapper ammeterParameterMapper;
    @Autowired
    private AmmeterRemoteReader ammeterRemoteReader;

    @ResponseBody
    @RequestMapping(value = "/test/{ammeterId}")
    public List<AmmeterParameter> controller(@PathVariable(value = "ammeterId") String ammeterId){
        List<String> list = new ArrayList<>();
        list.add(ammeterId);
        return ammeterRemoteReader.realTelemetry(list);
    }


}

功能演示

在启动SpringBoot项目的时候,此通信系统也会跟随自动启动并默认监听9000端口,端口可以在配置文件中通过netty.server.port进行配置,启动成功后会打印Netty Server启动成功的信息

基于示例中的代码,在浏览器地址栏http://127.0.0.1:8080/test/398192000337

(1)可以正常解析DLT/645-2007协议数据(下面是解析了A相电压数据):

(2)解析完成后自动将数据更新到数据库,如下是更新过程打印的日志:

(3)浏览器最终响应结果:

energy-management-sys_communication-sub-sys's People

Contributors

loveriter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.