├── .classpath ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── README.md ├── Reference_jar ├── c3p0-0.9.5.2.jar ├── commons-beanutils-1.8.0.jar ├── commons-collections-3.2.1.jar ├── commons-lang-2.5.jar ├── commons-logging-1.1.1.jar ├── ezmorph-1.0.6.jar ├── json-lib-2.4-jdk15.jar ├── mchange-commons-java-0.2.11.jar └── mysql-connector-java-5.1.39-bin.jar ├── bin ├── .gitignore ├── c3p0-config.xml ├── cause.properties ├── dao │ ├── DevControlDao.class │ ├── PVAnalogQuantityData1Dao.class │ ├── PVAnalogQuantityData2Dao.class │ └── PVDigitalQuantityDataDao.class ├── dev.json ├── iec104 │ ├── Apdu$ApciType.class │ ├── Apdu.class │ ├── Asdu.class │ ├── Client$1.class │ ├── Client$2.class │ ├── Client$3.class │ ├── Client.class │ ├── IeAbstractQuality.class │ ├── IeQualifierOfInterrogation.class │ ├── IeQuality.class │ ├── IeScaled.class │ ├── IeShortFloat.class │ ├── IeSinglePointWithQuality.class │ ├── InformationElement.class │ ├── InformationObject.class │ ├── Init$1.class │ ├── Init$2.class │ ├── Init$3.class │ ├── Init.class │ └── util │ │ ├── ChangeUtils.class │ │ └── FileUtils.class ├── jdbc │ └── C3P0Utils.class ├── model │ ├── DevControl.class │ ├── PVAnalogQuantityData1.class │ ├── PVAnalogQuantityData2.class │ └── PVDigitalQuantityData.class ├── remote_adjust.json ├── remote_control.json ├── remote_measure.json ├── remote_signal.json └── typeId.properties ├── projectInstruction └── picture │ ├── IEC104主目录结构.png │ ├── IEC104主站响应发送遥控、遥调命令图.png │ ├── IEC104帧格式.png │ ├── IEC104配置文件目录.png │ ├── IEC主站程序流程图.png │ ├── I帧格式.png │ ├── PMA从站遥控、遥调信息接收图.png │ ├── PMA遥信图.png │ ├── PMA遥信数据详情.png │ ├── S帧格式.png │ ├── U帧格式.png │ ├── Web对应遥信显示.png │ ├── Web控制信息命令下发图.png │ ├── dev.json数据格式.png │ ├── 主从站建立链路图(PMA).png │ ├── 主站遥信解析图.png │ ├── 数据库设备操作类.png │ ├── 数据库设备模型.png │ ├── 遥信、遥测json数据格式.png │ ├── 遥信数据库对应更新.png │ ├── 遥控、遥调json数据格式.png │ └── 遥控、遥调定义字典图.png ├── resources ├── cause.properties ├── dev.json ├── remote_adjust.json ├── remote_control.json ├── remote_measure.json ├── remote_signal.json └── typeId.properties └── src ├── c3p0-config.xml ├── dao ├── DevControlDao.java ├── PVAnalogQuantityData1Dao.java ├── PVAnalogQuantityData2Dao.java └── PVDigitalQuantityDataDao.java ├── iec104 ├── Apdu.java ├── Asdu.java ├── Client.java ├── IeAbstractQuality.java ├── IeQualifierOfInterrogation.java ├── IeQuality.java ├── IeScaled.java ├── IeShortFloat.java ├── IeSinglePointWithQuality.java ├── InformationElement.java ├── InformationObject.java ├── Init.java └── util │ ├── ChangeUtils.java │ └── FileUtils.java ├── jdbc └── C3P0Utils.java └── model ├── DevControl.java ├── PVAnalogQuantityData1.java ├── PVAnalogQuantityData2.java └── PVDigitalQuantityData.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | IEC104 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IEC104_microgrid 2 | iec104协议主站客户端程序,属于[微电网管理系统](https://github.com/msun1996/Microgrid)一部分 3 | ## 一 IEC104协议介绍 4 | ### 1 IEC104简要说明 5 | IEC104是一种基于TCP/IP的电力行业通信协议,主要用于数据远程监控等功能。通信有一般有主要发送数据、接收命令的从站服务端和接收数据、发送命令的主站客户端构成。采用应答式数据传输,一般上行数据为遥信、遥测,下行信息为遥控、遥调。 6 | ### 2 IEC104帧格式 7 | IEC104的通用帧格式如图 8 | ![IEC104帧格式](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/IEC104%E5%B8%A7%E6%A0%BC%E5%BC%8F.png) 9 | 其中APCI为控制信息部分,ASDU为存储数据单元,APDU为长度等于APCI+ASDU-2,即减去起始字节和APDU长度字节。 10 | IEC104有3种帧格式,分别为U帧即控制报文帧、S帧即监视帧和I帧即信息传输帧。 11 | 1)U帧:只包括APCI部分,主要有启动帧、停止帧、测试帧。U帧具体格式如图 12 | ![U帧格式](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/U%E5%B8%A7%E6%A0%BC%E5%BC%8F.png) 13 | 2)S帧:只包含APCI部分。S帧格式如图 14 | ![S帧格式](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/S%E5%B8%A7%E6%A0%BC%E5%BC%8F.png) 15 | 3)I帧:包含APCI+APDU部分。I帧格式如图 16 | ![I帧格式](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/I%E5%B8%A7%E6%A0%BC%E5%BC%8F.png) 17 | 发送序号和接收序列号是保证数据完整性的条件。 18 | 类型标识定义发送数据的格式。 19 | 可变结构体定义发送数据信息是有序还是无序,有序即一个信息体地址,元素的对应地址会在此信息地址基础上依次加1。无序即1个地址对应一个元素。 20 | 传输原因定义记录传送的原因,用以对传输数据进行归类。 21 | 22 | ### 3 IEC104规约流程 23 | 1.由客户端向服务器建立连接,同时,发送链路启动帧。 24 | 2.服务端在收到链路启动帧后,向客户端发送启动确认帧。 25 | 3.客户端收到启动确认帧后,发送总召唤命令数据请求帧。 26 | 4.服务端收到总召唤命令数据请求后,发送总召唤命令数据响应帧,然后继续发送总召唤命令数据。总召唤命令数据发送完成后,发送总召唤命令数据结束帧。 27 | 5.客户端在收到总召唤命令数据结束帧后,发送对时请求帧。 28 | 6.服务器收到对时请求帧后,发送对时响应帧。 29 | 7.由服务器主动向客户端发送变化数据帧。同时,收到客户端发送的控制类命令,回复相应的操作结果。 30 | 8.客户端等到下一个数据总召唤命令数据周期,重复第4步之后的流程。 31 | ## 二 IEC104通信主站程序总体设计实现 32 | 根据项目需求和IEC104通信规约设计,主要包括遥信、遥测的解析程序功能,遥控、遥调的组合程序功能,数据库并发操作。涉及技术Java面对对象编程,多线程,socket编程,JDBC数据库操作映射API,C3P0高并发数据库连接池。 33 | 首先设计如图的目录结构: 34 | ![主目录结构](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/IEC104%E4%B8%BB%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84.png) 35 | 其中jdbc 库文件存储数据库连接相关配置的类文件,model库文件存储着数据库的对应模型的类结构文件,dao库文件存储着数据库操作的类函数文件,iec104.util存储着程序处理中所用到的工具类,iec104为程序逻辑主体,存储着程序的主要处理类函数文件。 36 | 设计如图的配置文件目录 37 | ![配置文件目录](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/IEC104%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E7%9B%AE%E5%BD%95.png) 38 | 其中typeId.properties存储着功能类型的数字对应信息汉字关系,cause.properties存储着原因类型数字对应信息汉字关系,用于帧格式解析。remote_signal、remote_measure、remote_control、remote_adjust是存储信息体地址和对应存储数据库字段关系文件,用于将设备状态信息存储到数据库对应数据模型或从对应数据进行数据提取。 39 | 设计主体程序有3部分构成,主程序包括配置信息初始化,Socket端口连接初始化,数据库连接配置初始化,线程定时器初始化,启动链路,接收遥信、遥测帧信息解析缓存到对应对象结构体;定时将缓存在遥信、遥测对象结构体的数据写入数据库;遥控、遥调定时器程序包括根据读取数据库对应数据信息与缓存字典比较,发现变化信息组合帧信息并发送。设计总体流程图如图 40 | ![IEC104主站程序流程图](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/IEC%E4%B8%BB%E7%AB%99%E7%A8%8B%E5%BA%8F%E6%B5%81%E7%A8%8B%E5%9B%BE.png) 41 | ## 三 IEC104主站数据库相关程序设计 42 | ### 1 设备数据库模型类实现 43 | IEC104数据库与Web管理系统共用一个数据库,IEC104需建立的数据库模型与web模型的属性、字段都相同,在此基础建立数据库映射操作库model中的映射实现类如图 44 | ![数据设备模型](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E5%A4%87%E6%A8%A1%E5%9E%8B.png) 45 | 其中DevControl为存储所有设备信息及其控制部分的映射实现类,PVAnalogQuantotyData1, PVAnalogQuantotyData1,PVDigtialQuantityData为具体设备(光伏逆变器)类的数字信息和模拟量信息映射实现类。 46 | ### 2 IEC104设备数据库操作类实现 47 | model每个类文件会对应数据库操作dao库中一个类文件,dao的类中会记录数据库操作所需要执行的增删改查操作。目录结构如图: 48 | ![数据库设备操作类](https://github.com/msun1996/IEC104_microgrid/blob/master/projectInstruction/picture/%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E5%A4%87%E6%93%8D%E4%BD%9C%E7%B1%BB.png) 49 | 以DevControlDao实现类为例简要说明: 50 | 添加设备实现函数核心sql操作语句 51 | ``` 52 | Strning sql = "insert into microgrids_devcontrol (num, dev_type) values(?,?)"; 53 | ``` 54 | 更新设备类型号码实现函数核心sql操作语句 55 | ``` 56 | Strning sql = "update microgrids_devcontrol set dev_type=? where num=?"; 57 | ``` 58 | 删除设备类实现函数核心sql操作语句 59 | ``` 60 | String sql="delete from microgrid_devcontrol where num=?" 61 | ``` 62 | 查询设备是否存在函数的核心sql操作语句 63 | ``` 64 | String sql="select num from microgrid_devcontrol where num=?" 65 | ``` 66 | ### 3 IEC104数据库连接初始化 67 | 数据库为考虑大量数据写入时的性能要求,使用了C3P0数据库连接池的方法来增强数据库操作的性能。其中C3P0连接池初始化获得mysql操作对象的类为jdbc包的C3P0Utils类 68 | ``` 69 | public class C3P0Utils { 70 | private static ComboPooledDataSource dataSource = new ComboPooledDataSource("mysql"); 71 | public static DataSource getDataSource() { 72 | return dataSource; 73 | } 74 | public static Connection getConnection() { 75 | try { 76 | return dataSource.getConnection(); 77 | }catch (SQLException e) { 78 | throw new RuntimeException(e); 79 | } 80 | } 81 | } 82 | ``` 83 | 其中,系统会调用主目录下的c3p0-config.xml文件进行数据库初始化配置,包括连接数据库地址,数据库用户和密码。 84 | ## 四 主站核心程序设计 85 | ### 1 主站设备信息初始化 86 | 首先,程序会在初始化完成时加载配置文件dev.json,dev.json数据格式为设备编号,设备名,设备类型编号。(设备类型对应编号在Django model中进行定义,这里写入是为便于Web管理操作) 87 | ``` 88 | { 89 | "PVI0101":{"name":"光伏1区光伏逆变器1号", "DEV_TYPE":1}, 90 | } 91 | ``` 92 | 根据配置文件的设备信息会去更新数据库DevControl中的设备信息,对配置信息存在数据库却不存在的设备使用dao库DevControl类下的addDev方法进行添加,对配置信息中不存在设备数据库却存在的设备使用delDev方法进行删除。根据设备类型编号去创建对应设备遥信,遥测需要的设备信息结构体,以便在后面获取数据存入对应结构体存储。 93 | ### 2 主站遥信、遥测程序设计实现 94 | 首先,程序会在初始化加载remote_signal.json、remote_measure.json、遥信、遥测配置文件,配置信息格式主要为信息体地址,对应数据库字段名,对应数据库表单名,对应数据库设备编号。 95 | ``` 96 | { 97 | "14":{"field":"status_down","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_停机","注释":""}, 98 | } 99 | ``` 100 | 然后,使用多线程Runable类定义遥信、遥测数据写入数据库的方法即将设备对应数据信息结构体(在设备信息初始化中产生)使用对应sql方法写入数据库。使用ScheduledExecutorService类初始化遥信、遥测的多线程定时器得到对象service,再使用service下的scheduleAtFixedRate方法定时执行信息结构体数据写入数据库方法。 101 | 程序在发送完总召唤命令后会一直使用socket的方法去读取从站发送过来的帧数据并进行解析,首先会使用Apdu类下的Apdu方法进行解析,获得帧的启动帧,APDU长度,发送序号,接收序列号,控制域信息,根据控制域信息会进行判断帧类型,即为I帧,S帧,还是U帧。如果是S帧,或U帧获取后基本不做处理,主要会进行I帧解析。再判断是I帧后,会使用Asdu类下的Asdu进行解析,获取帧的类型标识,传输原因,公共地址,可变结构体等信息,然后使用InformationObject类的InformationObject方法去根据帧的类型标识去把数据信息存入到InformationElement,再获取存在信息体地址和数据的InformationObject对象。最后,再使用Client类中handleData方法,根据信息体地址从遥信、遥测配置文件获取其在数据库的表单名,对应字段,对应设备,把信息体对应的数据写入到对应的设备信息结构体中。 102 | 使用PMA软件模拟从站进行遥信测试如下: 103 | 首先启动程序建立链接,并发送总召唤命令,如图 104 | 主从站建立链路图(PMA) 105 | 从站PMA地址发送地址为14,值为0的遥信数据(逆变器PV0101停机信号),如图 106 | PMA遥信图 107 | PMA遥信数据详情 108 | 主站接收遥信帧并进行解析,打印解析信息如图 109 | 主站遥信解析图 110 | 数据库对应更新遥调信息所需要修改数据库数据如图 111 | 遥信数据库对应数据更新 112 | web管理系统界面PVI0101对应数据信息改变如图 113 | Web对应遥信显示 114 | 115 | ### 3 主站遥控、遥调程序设计实现 116 | 首先,程序会在初始化加载remote_control.json、remote_adjust.json、遥控、遥调配置文件,配置信息格式主要为信息体地址,对应数据库字段名,对应数据库设备编号。 117 | ``` 118 | { 119 | "25089":{"field":"active_power","num":"PVI0101","descript":"西科逆变器1_有功功率遥调值","注释":""}, 120 | } 121 | ``` 122 | 然后,定义存储遥控、遥调信息即地址信息和数据信息实时值的字典(记录实时值,是为了只在数据库数据状态改变的情况下,才会去发送遥控或遥信命令) 123 | ``` 124 | // 记录存储遥控、遥调实时值 125 | Map remoteControlValues = new HashMap(); 126 | Map remoteAdjustVlaues = new HashMap(); 127 | ``` 128 | 之后,会使用多线程Runable类定义遥控、遥调信息帧组合并发送的runnable_db_send方法。同样使用ScheduledExecutorService类初始化遥信、遥测的多线程定时器得到对象service_A,再使用service_A下的scheduleAtFixedRate方法定时执行。 129 | Runnable_db_send方法会提取remote_control.json、remote_adjust.json配置文件信息,根据地址信息的字段和编号去数据库对应的表单下去提取数据,对比remoteControlValues、remoteAdjustVlaues字典,如果和字典中信息不同,则更新字典信息并发送遥控、遥调命令。 130 | 使用PMA模拟从站测试如下: 131 | Web管理界面修改逆变器PV0101的控制信息(会更改对应数据库数据),如图 132 | Web控制信息命令下发图 133 | IEC104主站发送相关遥控、遥调命令,并打印信息,如图 134 | IEC104主站响应发送遥控、遥调命令图 135 | 136 | PMA从站会接收到IEC104主站的遥控、遥调信息,如图 137 | PMA从站遥控、遥调信息接收图 138 | 139 | #### 程序参考学习修改自 [huarda / IEC104-1](https://github.com/huarda/IEC104-1) 140 | -------------------------------------------------------------------------------- /Reference_jar/c3p0-0.9.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/c3p0-0.9.5.2.jar -------------------------------------------------------------------------------- /Reference_jar/commons-beanutils-1.8.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/commons-beanutils-1.8.0.jar -------------------------------------------------------------------------------- /Reference_jar/commons-collections-3.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/commons-collections-3.2.1.jar -------------------------------------------------------------------------------- /Reference_jar/commons-lang-2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/commons-lang-2.5.jar -------------------------------------------------------------------------------- /Reference_jar/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /Reference_jar/ezmorph-1.0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/ezmorph-1.0.6.jar -------------------------------------------------------------------------------- /Reference_jar/json-lib-2.4-jdk15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/json-lib-2.4-jdk15.jar -------------------------------------------------------------------------------- /Reference_jar/mchange-commons-java-0.2.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/mchange-commons-java-0.2.11.jar -------------------------------------------------------------------------------- /Reference_jar/mysql-connector-java-5.1.39-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/Reference_jar/mysql-connector-java-5.1.39-bin.jar -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | /iec104/ 2 | /dao/ 3 | /remote_control.json 4 | /remote_adjust.json 5 | -------------------------------------------------------------------------------- /bin/c3p0-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.mysql.jdbc.Driver 6 | jdbc:mysql://116.196.107.225:3306/microgriddata?useSSL=false 7 | microgrid 8 | microgridpasswd 9 | 10 | 11 | 12 | com.mysql.jdbc.Driver 13 | jdbc:mysql://116.196.107.225:3306/microgriddata?useSSL=false 14 | microgrid 15 | microgridpasswd 16 | 17 | 10 18 | 19 | 30 20 | 21 | 100 22 | 23 | 10 24 | 25 | 200 26 | 27 | 3000 28 | 29 | 5 30 | 31 | 0 32 | 33 | 1000 34 | 35 | false 36 | 37 | Test 38 | 39 | false 40 | 41 | 60 42 | 43 | 0 44 | 45 | -------------------------------------------------------------------------------- /bin/cause.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/cause.properties -------------------------------------------------------------------------------- /bin/dao/DevControlDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/dao/DevControlDao.class -------------------------------------------------------------------------------- /bin/dao/PVAnalogQuantityData1Dao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/dao/PVAnalogQuantityData1Dao.class -------------------------------------------------------------------------------- /bin/dao/PVAnalogQuantityData2Dao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/dao/PVAnalogQuantityData2Dao.class -------------------------------------------------------------------------------- /bin/dao/PVDigitalQuantityDataDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/dao/PVDigitalQuantityDataDao.class -------------------------------------------------------------------------------- /bin/dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "PVI0101":{"name":"光伏1区光伏逆变器1号", "DEV_TYPE":1 }, 3 | "PVI0102":{"name":"光伏1区光伏逆变器2号", "DEV_TYPE":1 }, 4 | "PVI0201":{"name":"光伏2区光伏逆变器1号", "DEV_TYPE":1 }, 5 | "PVI0202":{"name":"光伏2区光伏逆变器2号", "DEV_TYPE":1 }, 6 | "HS01":{"name":"高压负荷开关1号(间隔区)", "DEV_TYPE":20 }, 7 | "HS1011":{"name":"高压负荷开关1号(光伏1区)", "DEV_TYPE":20 }, 8 | "HS1021":{"name":"高压负荷开关1号(光伏2区)", "DEV_TYPE":20 }, 9 | "BS101011":{"name":"断路器1号(光伏1区逆变器1)", "DEV_TYPE":22 }, 10 | "BS101021":{"name":"断路器1号(光伏1区逆变器2)", "DEV_TYPE":22 }, 11 | "BS102011":{"name":"断路器1号(光伏2区逆变器1)", "DEV_TYPE":22 }, 12 | "BS102021":{"name":"断路器1号(光伏2区逆变器2)", "DEV_TYPE":22 } 13 | } -------------------------------------------------------------------------------- /bin/iec104/Apdu$ApciType.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Apdu$ApciType.class -------------------------------------------------------------------------------- /bin/iec104/Apdu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Apdu.class -------------------------------------------------------------------------------- /bin/iec104/Asdu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Asdu.class -------------------------------------------------------------------------------- /bin/iec104/Client$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Client$1.class -------------------------------------------------------------------------------- /bin/iec104/Client$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Client$2.class -------------------------------------------------------------------------------- /bin/iec104/Client$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Client$3.class -------------------------------------------------------------------------------- /bin/iec104/Client.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Client.class -------------------------------------------------------------------------------- /bin/iec104/IeAbstractQuality.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/IeAbstractQuality.class -------------------------------------------------------------------------------- /bin/iec104/IeQualifierOfInterrogation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/IeQualifierOfInterrogation.class -------------------------------------------------------------------------------- /bin/iec104/IeQuality.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/IeQuality.class -------------------------------------------------------------------------------- /bin/iec104/IeScaled.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/IeScaled.class -------------------------------------------------------------------------------- /bin/iec104/IeShortFloat.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/IeShortFloat.class -------------------------------------------------------------------------------- /bin/iec104/IeSinglePointWithQuality.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/IeSinglePointWithQuality.class -------------------------------------------------------------------------------- /bin/iec104/InformationElement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/InformationElement.class -------------------------------------------------------------------------------- /bin/iec104/InformationObject.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/InformationObject.class -------------------------------------------------------------------------------- /bin/iec104/Init$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Init$1.class -------------------------------------------------------------------------------- /bin/iec104/Init$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Init$2.class -------------------------------------------------------------------------------- /bin/iec104/Init$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Init$3.class -------------------------------------------------------------------------------- /bin/iec104/Init.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/Init.class -------------------------------------------------------------------------------- /bin/iec104/util/ChangeUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/util/ChangeUtils.class -------------------------------------------------------------------------------- /bin/iec104/util/FileUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/iec104/util/FileUtils.class -------------------------------------------------------------------------------- /bin/jdbc/C3P0Utils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/jdbc/C3P0Utils.class -------------------------------------------------------------------------------- /bin/model/DevControl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/model/DevControl.class -------------------------------------------------------------------------------- /bin/model/PVAnalogQuantityData1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/model/PVAnalogQuantityData1.class -------------------------------------------------------------------------------- /bin/model/PVAnalogQuantityData2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/model/PVAnalogQuantityData2.class -------------------------------------------------------------------------------- /bin/model/PVDigitalQuantityData.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/model/PVDigitalQuantityData.class -------------------------------------------------------------------------------- /bin/remote_adjust.json: -------------------------------------------------------------------------------- 1 | { 2 | "25089":{"field":"active_power","num":"PVI0101","descript":"西科逆变器1_有功功率遥调值","注解":""}, 3 | "25090":{"field":"reactive_power","num":"PVI0101","descript":"西科逆变器1_无功功率遥调值","注解":""}, 4 | "25091":{"field":"active_power","num":"PVI0102","descript":"西科逆变器2_有功功率遥调值","注解":""}, 5 | "25092":{"field":"reactive_power","num":"PVI0102","descript":"西科逆变器2_无功功率遥调值","注解":""}, 6 | "25093":{"field":"","num":"","descript":"","注解":""}, 7 | "25094":{"field":"","num":"","descript":"","注解":""}, 8 | "25095":{"field":"","num":"","descript":"","注解":""}, 9 | "25096":{"field":"","num":"","descript":"","注解":""}, 10 | "25097":{"field":"powerfactor","num":"PVI0101","descript":"西科逆变器1_功率因数遥调值","注解":""}, 11 | "25098":{"field":"powerfactor","num":"PVI0102","descript":"西科逆变器2_功率因数遥调值","注解":""}, 12 | "25099":{"field":"","num":"","descript":"","注解":""}, 13 | "25100":{"field":"","num":"","descript":"","注解":""} 14 | } -------------------------------------------------------------------------------- /bin/remote_control.json: -------------------------------------------------------------------------------- 1 | { 2 | "24577":{"field":"switch_status","num":"BS101011","descript":"1#断路器","注解":""}, 3 | "24578":{"field":"switch_status","num":"BS101021","descript":"2#断路器","注解":""}, 4 | "24579":{"field":"switch_status","num":"HS1011","descript":"高压负荷开关","注解":""}, 5 | "24580":{"field":"switch_status","num":"PVI0101","descript":"西科逆变器1_开关机命令","注解":""}, 6 | "24581":{"field":"switch_status","num":"PVI0102","descript":"西科逆变器2_开关机命令","注解":""}, 7 | "24582":{"field":"","num":"","descript":"","注解":""}, 8 | "24583":{"field":"","num":"","descript":"","注解":""}, 9 | "24584":{"field":"","num":"","descript":"","注解":""}, 10 | "24585":{"field":"","num":"","descript":"","注解":""}, 11 | "24586":{"field":"","num":"","descript":"","注解":""}, 12 | "24587":{"field":"","num":"","descript":"","注解":""}, 13 | "24588":{"field":"","num":"","descript":"","注解":""} 14 | } -------------------------------------------------------------------------------- /bin/remote_measure.json: -------------------------------------------------------------------------------- 1 | { 2 | "16385":{"field":"","num":"","table_name":"","descript":"","注释":""}, 3 | "16386":{"field":"","num":"","table_name":"","descript":"","注释":""}, 4 | "16387":{"field":"","num":"","table_name":"","descript":"","注释":""}, 5 | "16388":{"field":"","num":"","table_name":"","descript":"","注释":""}, 6 | "16389":{"field":"","num":"","table_name":"","descript":"","注释":""}, 7 | "16390":{"field":"","num":"","table_name":"","descript":"","注释":""}, 8 | "16391":{"field":"","num":"","table_name":"","descript":"","注释":""}, 9 | "16392":{"field":"","num":"","table_name":"","descript":"","注释":""}, 10 | "16393":{"field":"","num":"","table_name":"","descript":"","注释":""}, 11 | "16394":{"field":"","num":"","table_name":"","descript":"","注释":""}, 12 | "16395":{"field":"","num":"","table_name":"","descript":"","注释":""}, 13 | "16396":{"field":"","num":"","table_name":"","descript":"","注释":""}, 14 | "16397":{"field":"","num":"","table_name":"","descript":"","注释":""}, 15 | "16398":{"field":"","num":"","table_name":"","descript":"","注释":""}, 16 | "16399":{"field":"","num":"","table_name":"","descript":"","注释":""}, 17 | "16400":{"field":"","num":"","table_name":"","descript":"","注释":""}, 18 | "16401":{"field":"","num":"","table_name":"","descript":"","注释":""}, 19 | "16402":{"field":"","num":"","table_name":"","descript":"","注释":""}, 20 | "16403":{"field":"","num":"","table_name":"","descript":"","注释":""}, 21 | "16404":{"field":"","num":"","table_name":"","descript":"","注释":""}, 22 | "16405":{"field":"","num":"","table_name":"","descript":"","注释":""}, 23 | "16406":{"field":"","num":"","table_name":"","descript":"","注释":""}, 24 | "16407":{"field":"","num":"","table_name":"","descript":"","注释":""}, 25 | "16408":{"field":"matrix_volt","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_阵列电压","注释":""}, 26 | "16409":{"field":"matrix_cur","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_阵列电流","注释":""}, 27 | "16410":{"field":"matrix_power_in","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_阵列输入功率","注释":""}, 28 | "16411":{"field":"grid_volt_ab","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网AB线电压","注释":""}, 29 | "16412":{"field":"grid_volt_bc","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网BC线电压","注释":""}, 30 | "16413":{"field":"grid_volt_ca","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网CA线电压","注释":""}, 31 | "16414":{"field":"on_grid_cur_a","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_A相并网电流","注释":""}, 32 | "16415":{"field":"on_grid_cur_b","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_B相并网电流","注释":""}, 33 | "16416":{"field":"on_grid_cur_c","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_C相并网电流","注释":""}, 34 | "16417":{"field":"power_factor_a","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_A相功率因数","注释":""}, 35 | "16418":{"field":"power_factor_b","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_B相功率因数","注释":""}, 36 | "16419":{"field":"power_factor_c","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_C相功率因数","注释":""}, 37 | "16420":{"field":"grid_freq","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网频率","注释":""}, 38 | "16421":{"field":"on_grid_p","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_并网有功功率","注释":""}, 39 | "16422":{"field":"on_grid_q","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_并网无功功率","注释":""}, 40 | "16423":{"field":"on_grid_s","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_并网视在功率","注释":""}, 41 | "16424":{"field":"day_runtime","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_日运行时间","注释":""}, 42 | "16425":{"field":"inv_cabin_temp","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_逆变器机柜温度","注释":""}, 43 | "16426":{"field":"","num":"","table_name":"","descript":"","注释":""}, 44 | "16427":{"field":"","num":"","table_name":"","descript":"","注释":""}, 45 | "16428":{"field":"","num":"","table_name":"","descript":"","注释":""}, 46 | "16429":{"field":"","num":"","table_name":"","descript":"","注释":""}, 47 | "16430":{"field":"","num":"","table_name":"","descript":"","注释":""}, 48 | "16431":{"field":"","num":"","table_name":"","descript":"","注释":""}, 49 | "16432":{"field":"","num":"","table_name":"","descript":"","注释":""}, 50 | "16433":{"field":"","num":"","table_name":"","descript":"","注释":""}, 51 | "16434":{"field":"","num":"","table_name":"","descript":"","注释":""}, 52 | "16435":{"field":"","num":"","table_name":"","descript":"","注释":""}, 53 | "16436":{"field":"day_gen_power","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_系统日发电量","注释":""}, 54 | "16437":{"field":"total_gen_power","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_系统累计发电量","注释":""}, 55 | "16438":{"field":"co2_reduce","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_CO2减排量","注释":""}, 56 | "16439":{"field":"total_runtime","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_总运行时间","注释":""}, 57 | "16440":{"field":"","num":"","table_name":"","descript":"","注释":""}, 58 | "16441":{"field":"","num":"","table_name":"","descript":"","注释":""}, 59 | "16442":{"field":"","num":"","table_name":"","descript":"","注释":""}, 60 | "16443":{"field":"","num":"","table_name":"","descript":"","注释":""}, 61 | "16444":{"field":"","num":"","table_name":"","descript":"","注释":""}, 62 | "16445":{"field":"","num":"","table_name":"","descript":"","注释":""}, 63 | "16446":{"field":"","num":"","table_name":"","descript":"","注释":""}, 64 | "16447":{"field":"","num":"","table_name":"","descript":"","注释":""}, 65 | "16448":{"field":"","num":"","table_name":"","descript":"","注释":""}, 66 | "16449":{"field":"","num":"","table_name":"","descript":"","注释":""}, 67 | "16450":{"field":"","num":"","table_name":"","descript":"","注释":""} 68 | } -------------------------------------------------------------------------------- /bin/remote_signal.json: -------------------------------------------------------------------------------- 1 | { 2 | "1":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 3 | "2":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 4 | "3":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 5 | "4":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 6 | "5":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 7 | "6":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 8 | "7":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 9 | "8":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 10 | "9":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 11 | "10":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 12 | "11":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 13 | "12":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 14 | "13":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 15 | "14":{"field":"status_down","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_停机","注解":""}, 16 | "15":{"field":"status_standby","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_待机","注解":""}, 17 | "16":{"field":"status_selftest","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_自检","注解":""}, 18 | "17":{"field":"status_ongrid","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_并网","注解":""}, 19 | "18":{"field":"locking_self","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_闭锁未自锁","注解":""}, 20 | "19":{"field":"","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_有无开关机命令","注解":""}, 21 | "20":{"field":"emergency_stop","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_急停按下未按下","注解":""}, 22 | "21":{"field":"remote_local","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_远程本地","注解":""}, 23 | "22":{"field":"reactive_power_compensation","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_夜间无功补偿","注解":""}, 24 | "23":{"field":"smoke_alarm","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_烟感报警","注解":""}, 25 | "24":{"field":"DC_lightning_protection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_直流防雷故障","注解":""}, 26 | "25":{"field":"AC_lightning_protection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_交流防雷故障","注解":""}, 27 | "26":{"field":"PV_reverse_connection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_PV反接","注解":""}, 28 | "27":{"field":"PV_insulation_resistance","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_PV对地绝缘阻抗异常","注解":""}, 29 | "28":{"field":"DC_overvoltage","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_直流过压","注解":""}, 30 | "29":{"field":"power_voltage","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_电网电压异常","注解":""}, 31 | "30":{"field":"grid_frequency","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_电网频率异常","注解":""}, 32 | "31":{"field":"grid_reverse_order","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_电网反序","注解":""}, 33 | "32":{"field":"inverter_overload","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_逆变器过载","注解":""}, 34 | "33":{"field":"inverter_overheating","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_逆变器过热","注解":""}, 35 | "34":{"field":"ambient_temperature_overheating","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_环境温度过热","注解":""}, 36 | "35":{"field":"inverter_short_circuit","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_逆变器短路","注解":""}, 37 | "36":{"field":"island_protection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_孤岛保护","注解":""}, 38 | "37":{"field":"","num":"","table_name":"","descript":"","注解":""}, 39 | "38":{"field":"","num":"","table_name":"","descript":"","注解":""}, 40 | "39":{"field":"","num":"","table_name":"","descript":"","注解":""}, 41 | "40":{"field":"","num":"","table_name":"","descript":"","注解":""} 42 | } -------------------------------------------------------------------------------- /bin/typeId.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/bin/typeId.properties -------------------------------------------------------------------------------- /projectInstruction/picture/IEC104主目录结构.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/IEC104主目录结构.png -------------------------------------------------------------------------------- /projectInstruction/picture/IEC104主站响应发送遥控、遥调命令图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/IEC104主站响应发送遥控、遥调命令图.png -------------------------------------------------------------------------------- /projectInstruction/picture/IEC104帧格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/IEC104帧格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/IEC104配置文件目录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/IEC104配置文件目录.png -------------------------------------------------------------------------------- /projectInstruction/picture/IEC主站程序流程图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/IEC主站程序流程图.png -------------------------------------------------------------------------------- /projectInstruction/picture/I帧格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/I帧格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/PMA从站遥控、遥调信息接收图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/PMA从站遥控、遥调信息接收图.png -------------------------------------------------------------------------------- /projectInstruction/picture/PMA遥信图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/PMA遥信图.png -------------------------------------------------------------------------------- /projectInstruction/picture/PMA遥信数据详情.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/PMA遥信数据详情.png -------------------------------------------------------------------------------- /projectInstruction/picture/S帧格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/S帧格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/U帧格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/U帧格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/Web对应遥信显示.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/Web对应遥信显示.png -------------------------------------------------------------------------------- /projectInstruction/picture/Web控制信息命令下发图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/Web控制信息命令下发图.png -------------------------------------------------------------------------------- /projectInstruction/picture/dev.json数据格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/dev.json数据格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/主从站建立链路图(PMA).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/主从站建立链路图(PMA).png -------------------------------------------------------------------------------- /projectInstruction/picture/主站遥信解析图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/主站遥信解析图.png -------------------------------------------------------------------------------- /projectInstruction/picture/数据库设备操作类.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/数据库设备操作类.png -------------------------------------------------------------------------------- /projectInstruction/picture/数据库设备模型.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/数据库设备模型.png -------------------------------------------------------------------------------- /projectInstruction/picture/遥信、遥测json数据格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/遥信、遥测json数据格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/遥信数据库对应更新.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/遥信数据库对应更新.png -------------------------------------------------------------------------------- /projectInstruction/picture/遥控、遥调json数据格式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/遥控、遥调json数据格式.png -------------------------------------------------------------------------------- /projectInstruction/picture/遥控、遥调定义字典图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/projectInstruction/picture/遥控、遥调定义字典图.png -------------------------------------------------------------------------------- /resources/cause.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/resources/cause.properties -------------------------------------------------------------------------------- /resources/dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "PVI0101":{"name":"光伏1区光伏逆变器1号", "DEV_TYPE":1 }, 3 | "PVI0102":{"name":"光伏1区光伏逆变器2号", "DEV_TYPE":1 }, 4 | "PVI0201":{"name":"光伏2区光伏逆变器1号", "DEV_TYPE":1 }, 5 | "PVI0202":{"name":"光伏2区光伏逆变器2号", "DEV_TYPE":1 }, 6 | "HS01":{"name":"高压负荷开关1号(间隔区)", "DEV_TYPE":20 }, 7 | "HS1011":{"name":"高压负荷开关1号(光伏1区)", "DEV_TYPE":20 }, 8 | "HS1021":{"name":"高压负荷开关1号(光伏2区)", "DEV_TYPE":20 }, 9 | "BS101011":{"name":"断路器1号(光伏1区逆变器1)", "DEV_TYPE":22 }, 10 | "BS101021":{"name":"断路器1号(光伏1区逆变器2)", "DEV_TYPE":22 }, 11 | "BS102011":{"name":"断路器1号(光伏2区逆变器1)", "DEV_TYPE":22 }, 12 | "BS102021":{"name":"断路器1号(光伏2区逆变器2)", "DEV_TYPE":22 } 13 | } -------------------------------------------------------------------------------- /resources/remote_adjust.json: -------------------------------------------------------------------------------- 1 | { 2 | "25089":{"field":"active_power","num":"PVI0101","descript":"西科逆变器1_有功功率遥调值","注解":""}, 3 | "25090":{"field":"reactive_power","num":"PVI0101","descript":"西科逆变器1_无功功率遥调值","注解":""}, 4 | "25091":{"field":"active_power","num":"PVI0102","descript":"西科逆变器2_有功功率遥调值","注解":""}, 5 | "25092":{"field":"reactive_power","num":"PVI0102","descript":"西科逆变器2_无功功率遥调值","注解":""}, 6 | "25093":{"field":"","num":"","descript":"","注解":""}, 7 | "25094":{"field":"","num":"","descript":"","注解":""}, 8 | "25095":{"field":"","num":"","descript":"","注解":""}, 9 | "25096":{"field":"","num":"","descript":"","注解":""}, 10 | "25097":{"field":"powerfactor","num":"PVI0101","descript":"西科逆变器1_功率因数遥调值","注解":""}, 11 | "25098":{"field":"powerfactor","num":"PVI0102","descript":"西科逆变器2_功率因数遥调值","注解":""}, 12 | "25099":{"field":"","num":"","descript":"","注解":""}, 13 | "25100":{"field":"","num":"","descript":"","注解":""} 14 | } -------------------------------------------------------------------------------- /resources/remote_control.json: -------------------------------------------------------------------------------- 1 | { 2 | "24577":{"field":"switch_status","num":"BS101011","descript":"1#断路器","注解":""}, 3 | "24578":{"field":"switch_status","num":"BS101021","descript":"2#断路器","注解":""}, 4 | "24579":{"field":"switch_status","num":"HS1011","descript":"高压负荷开关","注解":""}, 5 | "24580":{"field":"switch_status","num":"PVI0101","descript":"西科逆变器1_开关机命令","注解":""}, 6 | "24581":{"field":"switch_status","num":"PVI0102","descript":"西科逆变器2_开关机命令","注解":""}, 7 | "24582":{"field":"","num":"","descript":"","注解":""}, 8 | "24583":{"field":"","num":"","descript":"","注解":""}, 9 | "24584":{"field":"","num":"","descript":"","注解":""}, 10 | "24585":{"field":"","num":"","descript":"","注解":""}, 11 | "24586":{"field":"","num":"","descript":"","注解":""}, 12 | "24587":{"field":"","num":"","descript":"","注解":""}, 13 | "24588":{"field":"","num":"","descript":"","注解":""} 14 | } -------------------------------------------------------------------------------- /resources/remote_measure.json: -------------------------------------------------------------------------------- 1 | { 2 | "16385":{"field":"","num":"","table_name":"","descript":"","注释":""}, 3 | "16386":{"field":"","num":"","table_name":"","descript":"","注释":""}, 4 | "16387":{"field":"","num":"","table_name":"","descript":"","注释":""}, 5 | "16388":{"field":"","num":"","table_name":"","descript":"","注释":""}, 6 | "16389":{"field":"","num":"","table_name":"","descript":"","注释":""}, 7 | "16390":{"field":"","num":"","table_name":"","descript":"","注释":""}, 8 | "16391":{"field":"","num":"","table_name":"","descript":"","注释":""}, 9 | "16392":{"field":"","num":"","table_name":"","descript":"","注释":""}, 10 | "16393":{"field":"","num":"","table_name":"","descript":"","注释":""}, 11 | "16394":{"field":"","num":"","table_name":"","descript":"","注释":""}, 12 | "16395":{"field":"","num":"","table_name":"","descript":"","注释":""}, 13 | "16396":{"field":"","num":"","table_name":"","descript":"","注释":""}, 14 | "16397":{"field":"","num":"","table_name":"","descript":"","注释":""}, 15 | "16398":{"field":"","num":"","table_name":"","descript":"","注释":""}, 16 | "16399":{"field":"","num":"","table_name":"","descript":"","注释":""}, 17 | "16400":{"field":"","num":"","table_name":"","descript":"","注释":""}, 18 | "16401":{"field":"","num":"","table_name":"","descript":"","注释":""}, 19 | "16402":{"field":"","num":"","table_name":"","descript":"","注释":""}, 20 | "16403":{"field":"","num":"","table_name":"","descript":"","注释":""}, 21 | "16404":{"field":"","num":"","table_name":"","descript":"","注释":""}, 22 | "16405":{"field":"","num":"","table_name":"","descript":"","注释":""}, 23 | "16406":{"field":"","num":"","table_name":"","descript":"","注释":""}, 24 | "16407":{"field":"","num":"","table_name":"","descript":"","注释":""}, 25 | "16408":{"field":"matrix_volt","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_阵列电压","注释":""}, 26 | "16409":{"field":"matrix_cur","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_阵列电流","注释":""}, 27 | "16410":{"field":"matrix_power_in","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_阵列输入功率","注释":""}, 28 | "16411":{"field":"grid_volt_ab","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网AB线电压","注释":""}, 29 | "16412":{"field":"grid_volt_bc","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网BC线电压","注释":""}, 30 | "16413":{"field":"grid_volt_ca","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网CA线电压","注释":""}, 31 | "16414":{"field":"on_grid_cur_a","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_A相并网电流","注释":""}, 32 | "16415":{"field":"on_grid_cur_b","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_B相并网电流","注释":""}, 33 | "16416":{"field":"on_grid_cur_c","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_C相并网电流","注释":""}, 34 | "16417":{"field":"power_factor_a","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_A相功率因数","注释":""}, 35 | "16418":{"field":"power_factor_b","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_B相功率因数","注释":""}, 36 | "16419":{"field":"power_factor_c","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_C相功率因数","注释":""}, 37 | "16420":{"field":"grid_freq","num":"PVI0101","table_name":"pvanalogquantitydata1","descript":"西科逆变器1_电网频率","注释":""}, 38 | "16421":{"field":"on_grid_p","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_并网有功功率","注释":""}, 39 | "16422":{"field":"on_grid_q","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_并网无功功率","注释":""}, 40 | "16423":{"field":"on_grid_s","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_并网视在功率","注释":""}, 41 | "16424":{"field":"day_runtime","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_日运行时间","注释":""}, 42 | "16425":{"field":"inv_cabin_temp","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_逆变器机柜温度","注释":""}, 43 | "16426":{"field":"","num":"","table_name":"","descript":"","注释":""}, 44 | "16427":{"field":"","num":"","table_name":"","descript":"","注释":""}, 45 | "16428":{"field":"","num":"","table_name":"","descript":"","注释":""}, 46 | "16429":{"field":"","num":"","table_name":"","descript":"","注释":""}, 47 | "16430":{"field":"","num":"","table_name":"","descript":"","注释":""}, 48 | "16431":{"field":"","num":"","table_name":"","descript":"","注释":""}, 49 | "16432":{"field":"","num":"","table_name":"","descript":"","注释":""}, 50 | "16433":{"field":"","num":"","table_name":"","descript":"","注释":""}, 51 | "16434":{"field":"","num":"","table_name":"","descript":"","注释":""}, 52 | "16435":{"field":"","num":"","table_name":"","descript":"","注释":""}, 53 | "16436":{"field":"day_gen_power","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_系统日发电量","注释":""}, 54 | "16437":{"field":"total_gen_power","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_系统累计发电量","注释":""}, 55 | "16438":{"field":"co2_reduce","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_CO2减排量","注释":""}, 56 | "16439":{"field":"total_runtime","num":"PVI0101","table_name":"pvanalogquantitydata2","descript":"西科逆变器1_总运行时间","注释":""}, 57 | "16440":{"field":"","num":"","table_name":"","descript":"","注释":""}, 58 | "16441":{"field":"","num":"","table_name":"","descript":"","注释":""}, 59 | "16442":{"field":"","num":"","table_name":"","descript":"","注释":""}, 60 | "16443":{"field":"","num":"","table_name":"","descript":"","注释":""}, 61 | "16444":{"field":"","num":"","table_name":"","descript":"","注释":""}, 62 | "16445":{"field":"","num":"","table_name":"","descript":"","注释":""}, 63 | "16446":{"field":"","num":"","table_name":"","descript":"","注释":""}, 64 | "16447":{"field":"","num":"","table_name":"","descript":"","注释":""}, 65 | "16448":{"field":"","num":"","table_name":"","descript":"","注释":""}, 66 | "16449":{"field":"","num":"","table_name":"","descript":"","注释":""}, 67 | "16450":{"field":"","num":"","table_name":"","descript":"","注释":""} 68 | } -------------------------------------------------------------------------------- /resources/remote_signal.json: -------------------------------------------------------------------------------- 1 | { 2 | "1":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 3 | "2":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 4 | "3":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 5 | "4":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 6 | "5":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 7 | "6":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 8 | "7":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 9 | "8":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 10 | "9":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 11 | "10":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 12 | "11":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 13 | "12":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 14 | "13":{"field":"","num":"PVI0101","table_name":"","descript":"","注解":""}, 15 | "14":{"field":"status_down","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_停机","注解":""}, 16 | "15":{"field":"status_standby","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_待机","注解":""}, 17 | "16":{"field":"status_selftest","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_自检","注解":""}, 18 | "17":{"field":"status_ongrid","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_并网","注解":""}, 19 | "18":{"field":"locking_self","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_闭锁未自锁","注解":""}, 20 | "19":{"field":"","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_有无开关机命令","注解":""}, 21 | "20":{"field":"emergency_stop","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_急停按下未按下","注解":""}, 22 | "21":{"field":"remote_local","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_远程本地","注解":""}, 23 | "22":{"field":"reactive_power_compensation","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_夜间无功补偿","注解":""}, 24 | "23":{"field":"smoke_alarm","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_烟感报警","注解":""}, 25 | "24":{"field":"DC_lightning_protection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_直流防雷故障","注解":""}, 26 | "25":{"field":"AC_lightning_protection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_交流防雷故障","注解":""}, 27 | "26":{"field":"PV_reverse_connection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_PV反接","注解":""}, 28 | "27":{"field":"PV_insulation_resistance","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_PV对地绝缘阻抗异常","注解":""}, 29 | "28":{"field":"DC_overvoltage","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_直流过压","注解":""}, 30 | "29":{"field":"power_voltage","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_电网电压异常","注解":""}, 31 | "30":{"field":"grid_frequency","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_电网频率异常","注解":""}, 32 | "31":{"field":"grid_reverse_order","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_电网反序","注解":""}, 33 | "32":{"field":"inverter_overload","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_逆变器过载","注解":""}, 34 | "33":{"field":"inverter_overheating","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_逆变器过热","注解":""}, 35 | "34":{"field":"ambient_temperature_overheating","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_环境温度过热","注解":""}, 36 | "35":{"field":"inverter_short_circuit","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_逆变器短路","注解":""}, 37 | "36":{"field":"island_protection","num":"PVI0101","table_name":"pvdigitalquantitydata","descript":"西科逆变器1_孤岛保护","注解":""}, 38 | "37":{"field":"","num":"","table_name":"","descript":"","注解":""}, 39 | "38":{"field":"","num":"","table_name":"","descript":"","注解":""}, 40 | "39":{"field":"","num":"","table_name":"","descript":"","注解":""}, 41 | "40":{"field":"","num":"","table_name":"","descript":"","注解":""} 42 | } -------------------------------------------------------------------------------- /resources/typeId.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msun1996/IEC104_microgrid/daa120f86a8e896db121546f1d0823e2bf459480/resources/typeId.properties -------------------------------------------------------------------------------- /src/c3p0-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.mysql.jdbc.Driver 6 | jdbc:mysql://116.196.107.225:3306/microgriddata?useSSL=false 7 | microgrid 8 | microgridpasswd 9 | 10 | 11 | 12 | com.mysql.jdbc.Driver 13 | jdbc:mysql://116.196.107.225:3306/microgriddata?useSSL=false 14 | microgrid 15 | microgridpasswd 16 | 17 | 10 18 | 19 | 30 20 | 21 | 100 22 | 23 | 10 24 | 25 | 200 26 | 27 | 3000 28 | 29 | 5 30 | 31 | 0 32 | 33 | 1000 34 | 35 | false 36 | 37 | Test 38 | 39 | false 40 | 41 | 60 42 | 43 | 0 44 | 45 | -------------------------------------------------------------------------------- /src/dao/DevControlDao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import jdbc.C3P0Utils; 11 | 12 | public class DevControlDao { 13 | // 添加设备 输入参数为设备编号和设备的类型号码 14 | public void addDev(String num , Integer dev_type) throws SQLException { 15 | Connection conn = C3P0Utils.getConnection(); 16 | String sql = "" + 17 | "insert into microgrids_devcontrol " + 18 | "(num,dev_type)" + 19 | "values(?,?)"; 20 | PreparedStatement ptmt = conn.prepareStatement(sql); 21 | ptmt.setString(1, num); 22 | ptmt.setInt(2, dev_type); 23 | ptmt.execute(); 24 | conn.close(); 25 | } 26 | // 更新设备类型号码 27 | public void updateDev(String num , Integer dev_type) throws SQLException { 28 | Connection conn = C3P0Utils.getConnection(); 29 | String sql = "" + 30 | " update microgrids_devcontrol" + 31 | " set dev_type=? " + 32 | " where num=? "; 33 | PreparedStatement ptmt = conn.prepareStatement(sql); 34 | ptmt.setInt(1, dev_type); 35 | ptmt.setString(2, num); 36 | ptmt.execute(); 37 | conn.close(); 38 | } 39 | // 删除设备 输入设备编号 40 | public void delDev(String num) throws SQLException { 41 | Connection conn = C3P0Utils.getConnection(); 42 | String sql = "" + 43 | " delete from microgrids_devcontrol" + 44 | " where num = ?"; 45 | PreparedStatement ptmt = conn.prepareStatement(sql); 46 | ptmt.setString(1, num); 47 | ptmt.execute(); 48 | conn.close(); 49 | } 50 | // 查询返回设备是否存在 51 | public Boolean exit(String num) throws SQLException { 52 | Connection conn = C3P0Utils.getConnection(); 53 | String sql = " " + 54 | "select num from microgrids_devcontrol" + 55 | "where num = ?"; 56 | PreparedStatement ptmt = conn.prepareStatement(sql); 57 | ptmt.setString(1, num); 58 | ResultSet rs = ptmt.executeQuery(); 59 | if (rs.next()) { 60 | conn.close(); 61 | return true; 62 | }else { 63 | conn.close(); 64 | return false; 65 | } 66 | } 67 | // 查询所有存在设备编号,返回编号集合 68 | public List query() throws SQLException { 69 | List dev_nums = new ArrayList(); 70 | 71 | Connection conn = C3P0Utils.getConnection(); 72 | String sql = "" + 73 | "select num from microgrids_devcontrol"; 74 | PreparedStatement ptmt = conn.prepareStatement(sql); 75 | ResultSet rs = ptmt.executeQuery(); 76 | while (rs.next()) { 77 | String dev_num = rs.getString("num"); 78 | dev_nums.add(dev_num); 79 | } 80 | conn.close(); 81 | return dev_nums; 82 | } 83 | // 查询返回字段整型值(遥控) 84 | public Integer getint(String num, String field) throws SQLException { 85 | Integer value = 0; 86 | Connection conn = C3P0Utils.getConnection(); 87 | String sql = "" + 88 | "select " + field + " from microgrids_devcontrol" + 89 | " where num = ?"; 90 | PreparedStatement ptmt =conn.prepareStatement(sql); 91 | ptmt.setString(1, num); 92 | ResultSet rs = ptmt.executeQuery(); 93 | while (rs.next()) { 94 | value = rs.getInt(field); 95 | } 96 | conn.close(); 97 | return value; 98 | } 99 | // 查询返回字段浮点值(遥调) 100 | public Double getdouble(String num, String field) throws SQLException { 101 | Double value = 0.0; 102 | Connection conn = C3P0Utils.getConnection(); 103 | String sql = "" + 104 | "select " + field + " from microgrids_devcontrol" + 105 | " where num = ?"; 106 | PreparedStatement ptmt =conn.prepareStatement(sql); 107 | ptmt.setString(1, num); 108 | ResultSet rs = ptmt.executeQuery(); 109 | while (rs.next()) { 110 | value = rs.getDouble(field); 111 | } 112 | conn.close(); 113 | return value; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/dao/PVAnalogQuantityData1Dao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.Date; 5 | import java.sql.PreparedStatement; 6 | import java.sql.SQLException; 7 | import java.sql.Types; 8 | 9 | import jdbc.C3P0Utils; 10 | import model.PVAnalogQuantityData1; 11 | 12 | public class PVAnalogQuantityData1Dao { 13 | // 添加 (输入类) 14 | public void addPVAnalogQuantityData1(PVAnalogQuantityData1 pva1) throws SQLException { 15 | Connection connection = C3P0Utils.getConnection(); 16 | String sql = ""+ 17 | "insert into microgrids_pvanalogquantitydata1" + 18 | "(pv_num, matrix_cur, matrix_volt, grid_volt_ab, grid_volt_bc, grid_volt_ca," + 19 | " on_grid_cur_a, on_grid_cur_b, on_grid_cur_c, power_factor_a, power_factor_b, power_factor_c,timestamp)" + 20 | "values(?,?,?,?,?,?,?,?,?,?,?,?,NOW())"; 21 | PreparedStatement ptmt = connection.prepareStatement(sql); 22 | ptmt.setString(1, pva1.getPv_num()); 23 | if (pva1.getMatrix_cur() != null) { 24 | ptmt.setDouble(2, pva1.getMatrix_cur()); 25 | }else { 26 | ptmt.setNull(2, Types.DOUBLE); 27 | } 28 | if (pva1.getMatrix_volt() != null) { 29 | ptmt.setDouble(3, pva1.getMatrix_volt()); 30 | }else { 31 | ptmt.setNull(3, Types.DOUBLE); 32 | } 33 | if (pva1.getGrid_volt_ab() != null) { 34 | ptmt.setDouble(4, pva1.getGrid_volt_ab()); 35 | }else { 36 | ptmt.setNull(4, Types.DOUBLE); 37 | } 38 | if (pva1.getGrid_volt_bc() != null) { 39 | ptmt.setDouble(5, pva1.getGrid_volt_bc()); 40 | }else { 41 | ptmt.setNull(5, Types.DOUBLE); 42 | } 43 | if (pva1.getGrid_volt_ca() != null) { 44 | ptmt.setDouble(6, pva1.getGrid_volt_ca()); 45 | }else { 46 | ptmt.setNull(6, Types.DOUBLE); 47 | } 48 | if (pva1.getOn_grid_cur_a() != null) { 49 | ptmt.setDouble(7, pva1.getOn_grid_cur_a()); 50 | }else { 51 | ptmt.setNull(7, Types.DOUBLE); 52 | } 53 | if (pva1.getOn_grid_cur_b() != null) { 54 | ptmt.setDouble(8, pva1.getOn_grid_cur_b()); 55 | }else { 56 | ptmt.setNull(8, Types.DOUBLE); 57 | } 58 | if (pva1.getOn_grid_cur_c() != null) { 59 | ptmt.setDouble(9, pva1.getOn_grid_cur_c()); 60 | }else { 61 | ptmt.setNull(9, Types.DOUBLE); 62 | } 63 | if (pva1.getPower_factor_a() != null) { 64 | ptmt.setDouble(10, pva1.getPower_factor_a()); 65 | }else { 66 | ptmt.setNull(10, Types.DOUBLE); 67 | } 68 | if (pva1.getPower_factor_b() != null) { 69 | ptmt.setDouble(11, pva1.getPower_factor_b()); 70 | }else { 71 | ptmt.setNull(11, Types.DOUBLE); 72 | } 73 | if (pva1.getPower_factor_c() != null) { 74 | ptmt.setDouble(12, pva1.getPower_factor_c()); 75 | }else { 76 | ptmt.setNull(12, Types.DOUBLE); 77 | } 78 | ptmt.execute(); 79 | connection.close(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/dao/PVAnalogQuantityData2Dao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | import java.sql.Types; 7 | 8 | import jdbc.C3P0Utils; 9 | import model.PVAnalogQuantityData2; 10 | 11 | public class PVAnalogQuantityData2Dao { 12 | // 添加 (输入类) 13 | public void addPVAnalogQuantityData2(PVAnalogQuantityData2 pva2) throws SQLException { 14 | Connection connection = C3P0Utils.getConnection(); 15 | String sql = ""+ 16 | "insert into microgrids_pvanalogquantitydata2" + 17 | "(pv_num, on_grid_p, on_grid_q, on_grid_s, inv_cabin_temp, day_gen_power," + 18 | " day_runtime, total_gen_power, total_runtime, co2_reduce,timestamp)" + 19 | "values(?,?,?,?,?,?,?,?,?,?,NOW())"; 20 | PreparedStatement ptmt = connection.prepareStatement(sql); 21 | ptmt.setString(1, pva2.getPv_num()); 22 | if (pva2.getOn_grid_p() != null) { 23 | ptmt.setDouble(2, pva2.getOn_grid_p()); 24 | }else { 25 | ptmt.setNull(2, Types.DOUBLE); 26 | } 27 | if (pva2.getOn_grid_q() != null) { 28 | ptmt.setDouble(3, pva2.getOn_grid_q()); 29 | }else { 30 | ptmt.setNull(3, Types.DOUBLE); 31 | } 32 | if (pva2.getOn_grid_s() != null) { 33 | ptmt.setDouble(4, pva2.getOn_grid_s()); 34 | }else { 35 | ptmt.setNull(4, Types.DOUBLE); 36 | } 37 | if (pva2.getInv_cabin_temp() != null) { 38 | ptmt.setDouble(5, pva2.getInv_cabin_temp()); 39 | }else { 40 | ptmt.setNull(5, Types.DOUBLE); 41 | } 42 | if (pva2.getDay_gen_power() != null) { 43 | ptmt.setDouble(6, pva2.getDay_gen_power()); 44 | }else { 45 | ptmt.setNull(6, Types.DOUBLE); 46 | } 47 | if (pva2.getDay_runtime() != null) { 48 | ptmt.setDouble(7, pva2.getDay_runtime()); 49 | }else { 50 | ptmt.setNull(7, Types.DOUBLE); 51 | } 52 | if (pva2.getTotal_gen_power() != null) { 53 | ptmt.setDouble(8, pva2.getTotal_gen_power()); 54 | }else { 55 | ptmt.setNull(8, Types.DOUBLE); 56 | } 57 | if (pva2.getTotal_runtime() != null) { 58 | ptmt.setDouble(9, pva2.getTotal_runtime()); 59 | }else { 60 | ptmt.setNull(9, Types.DOUBLE); 61 | } 62 | if (pva2.getCo2_reduce() != null) { 63 | ptmt.setDouble(10, pva2.getCo2_reduce()); 64 | }else { 65 | ptmt.setNull(10, Types.DOUBLE); 66 | } 67 | ptmt.execute(); 68 | connection.close(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/dao/PVDigitalQuantityDataDao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.sql.Types; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | import jdbc.C3P0Utils; 13 | import model.PVDigitalQuantityData; 14 | 15 | 16 | // 光伏数字变量 17 | public class PVDigitalQuantityDataDao { 18 | // 添加(输入为pv_num) 19 | public void addPVDigitalQuantityData(String pv_num) throws SQLException { 20 | Connection conn = C3P0Utils.getConnection(); 21 | String sql = "" + 22 | "insert into microgrids_pvdigitalquantitydata" + 23 | "(pv_num)" + 24 | "values(?)"; 25 | PreparedStatement ptmt = conn.prepareStatement(sql); 26 | ptmt.setString(1, pv_num); 27 | ptmt.execute(); 28 | conn.close(); 29 | } 30 | // 添加(输入为PVD的类) 31 | public void addPVDigitalQuantityData(PVDigitalQuantityData pv) throws SQLException { 32 | Connection conn = C3P0Utils.getConnection(); 33 | String sql = "" + 34 | "insert into microgrids_pvdigitalquantitydata" + 35 | "(pv_num,status_down,status_standby,status_selftest,status_ongrid,locking_self,emergency_stop,remote_local,reactive_power_compensation,smoke_alarm," + 36 | "DC_lightning_protection,AC_lightning_protection,PV_reverse_connection,PV_insulation_resistance,DC_overvoltage," + 37 | "power_voltage,grid_frequency,grid_reverse_order,inverter_overload,inverter_overheating,inverter_short_circuit," + 38 | "ambient_temperature_overheating,island_protection)" + 39 | "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 40 | PreparedStatement ptmt = conn.prepareStatement(sql); 41 | ptmt.setString(1, pv.getPv_num()); 42 | if (pv.getStatus_down() != null) { 43 | ptmt.setInt(2, pv.getStatus_down()); 44 | }else { 45 | ptmt.setNull(2, Types.INTEGER); 46 | } 47 | if (pv.getStatus_standby() != null) { 48 | ptmt.setInt(3, pv.getStatus_standby()); 49 | }else { 50 | ptmt.setNull(3, Types.INTEGER); 51 | } 52 | if (pv.getStatus_selftest() != null) { 53 | ptmt.setInt(4, pv.getStatus_selftest()); 54 | }else { 55 | ptmt.setNull(4, Types.INTEGER); 56 | } 57 | if (pv.getStatus_ongrid() != null) { 58 | ptmt.setInt(5, pv.getStatus_ongrid()); 59 | }else { 60 | ptmt.setNull(5, Types.INTEGER); 61 | } 62 | if (pv.getLocking_self() != null) { 63 | ptmt.setInt(6, pv.getLocking_self()); 64 | }else { 65 | ptmt.setNull(6, Types.INTEGER); 66 | } 67 | if (pv.getEmergency_stop() != null) { 68 | ptmt.setInt(7, pv.getEmergency_stop()); 69 | }else { 70 | ptmt.setNull(7, Types.INTEGER); 71 | } 72 | if (pv.getRemote_local() != null) { 73 | ptmt.setInt(8, pv.getRemote_local()); 74 | }else { 75 | ptmt.setNull(8, Types.INTEGER); 76 | } 77 | 78 | if (pv.getReactive_power_compensation() != null) { 79 | ptmt.setInt(9, pv.getReactive_power_compensation()); 80 | }else { 81 | ptmt.setNull(9, Types.INTEGER); 82 | } 83 | if (pv.getSmoke_alarm() != null) { 84 | ptmt.setInt(10, pv.getSmoke_alarm()); 85 | }else { 86 | ptmt.setNull(10, Types.INTEGER); 87 | } 88 | if (pv.getDC_lightning_protection() != null) { 89 | ptmt.setInt(11, pv.getDC_lightning_protection()); 90 | }else { 91 | ptmt.setNull(11, Types.INTEGER); 92 | } 93 | if (pv.getAC_lightning_protection() != null) { 94 | ptmt.setInt(12, pv.getAC_lightning_protection()); 95 | }else { 96 | ptmt.setNull(12, Types.INTEGER); 97 | } 98 | if (pv.getPV_reverse_connection() != null) { 99 | ptmt.setInt(13, pv.getPV_reverse_connection()); 100 | }else { 101 | ptmt.setNull(13, Types.INTEGER); 102 | } 103 | if (pv.getPV_insulation_resistance() != null) { 104 | ptmt.setInt(14, pv.getPV_insulation_resistance()); 105 | }else { 106 | ptmt.setNull(14, Types.INTEGER); 107 | } 108 | if (pv.getDC_overvoltage() != null) { 109 | ptmt.setInt(15, pv.getDC_overvoltage()); 110 | }else { 111 | ptmt.setNull(15, Types.INTEGER); 112 | } 113 | if (pv.getPower_voltage() != null) { 114 | ptmt.setInt(16, pv.getPower_voltage()); 115 | }else { 116 | ptmt.setNull(16, Types.INTEGER); 117 | } 118 | if (pv.getGrid_frequency() != null) { 119 | ptmt.setInt(17, pv.getGrid_frequency()); 120 | }else { 121 | ptmt.setNull(17, Types.INTEGER); 122 | } 123 | if (pv.getGrid_reverse_order() != null) { 124 | ptmt.setInt(18, pv.getGrid_reverse_order()); 125 | }else { 126 | ptmt.setNull(18, Types.INTEGER); 127 | } 128 | if (pv.getInverter_overload() != null) { 129 | ptmt.setInt(19, pv.getInverter_overload()); 130 | }else { 131 | ptmt.setNull(19, Types.INTEGER); 132 | } 133 | if (pv.getInverter_overheating() != null) { 134 | ptmt.setInt(20, pv.getInverter_overheating()); 135 | }else { 136 | ptmt.setNull(20, Types.INTEGER); 137 | } 138 | if (pv.getInverter_short_circuit() != null) { 139 | ptmt.setInt(21, pv.getInverter_short_circuit()); 140 | }else { 141 | ptmt.setNull(21, Types.INTEGER); 142 | } 143 | if (pv.getAmbient_temperature_overheating() != null) { 144 | ptmt.setInt(22, pv.getAmbient_temperature_overheating()); 145 | }else { 146 | ptmt.setNull(22, Types.INTEGER); 147 | } 148 | if (pv.getIsland_protection() != null) { 149 | ptmt.setInt(23, pv.getIsland_protection()); 150 | }else { 151 | ptmt.setNull(23, Types.INTEGER); 152 | } 153 | ptmt.execute(); 154 | conn.close(); 155 | } 156 | // 更新(输入为pv_num,更新字段,更新值) 157 | public void updatePVDigitalQuantityData(String num,String field, Integer value) throws SQLException { 158 | Connection conn = C3P0Utils.getConnection(); 159 | String sql = "" + 160 | " update microgrids_pvdigitalquantitydata " + 161 | " set " + field + "= ? " + 162 | " where pv_num = ?"; 163 | PreparedStatement ptmt = conn.prepareStatement(sql); 164 | ptmt.setInt(1, value); 165 | ptmt.setString(2, num); 166 | ptmt.execute(); 167 | conn.close(); 168 | } 169 | // 更新(输入为PVD的类) 170 | public void updatePVDigitalQuantityData(PVDigitalQuantityData pv) throws SQLException { 171 | Connection conn = C3P0Utils.getConnection(); 172 | String sql = "" + 173 | " update microgrids_pvdigitalquantitydata " + 174 | " set status_down=?,status_standby=?,status_selftest=?,status_ongrid=?,locking_self=?,emergency_stop=?,remote_local=?,reactive_power_compensation=?,smoke_alarm=?," + 175 | " DC_lightning_protection=?,AC_lightning_protection=?,PV_reverse_connection=?,PV_insulation_resistance=?,DC_overvoltage=?," + 176 | " power_voltage=?,grid_frequency=?,grid_reverse_order=?,inverter_overload=?,inverter_overheating=?,inverter_short_circuit=?, "+ 177 | " ambient_temperature_overheating=?,island_protection=? "+ 178 | " where pv_num=?"; 179 | PreparedStatement ptmt = conn.prepareStatement(sql); 180 | if (pv.getStatus_down() != null) { 181 | ptmt.setInt(1, pv.getStatus_down()); 182 | }else { 183 | ptmt.setNull(1, Types.INTEGER); 184 | } 185 | if (pv.getStatus_standby() != null) { 186 | ptmt.setInt(2, pv.getStatus_standby()); 187 | }else { 188 | ptmt.setNull(2, Types.INTEGER); 189 | } 190 | if (pv.getStatus_selftest() != null) { 191 | ptmt.setInt(3, pv.getStatus_selftest()); 192 | }else { 193 | ptmt.setNull(3, Types.INTEGER); 194 | } 195 | if (pv.getStatus_ongrid() != null) { 196 | ptmt.setInt(4, pv.getStatus_ongrid()); 197 | }else { 198 | ptmt.setNull(4, Types.INTEGER); 199 | } 200 | if (pv.getLocking_self() != null) { 201 | ptmt.setInt(5, pv.getLocking_self()); 202 | }else { 203 | ptmt.setNull(5, Types.INTEGER); 204 | } 205 | if (pv.getEmergency_stop() != null) { 206 | ptmt.setInt(6, pv.getEmergency_stop()); 207 | }else { 208 | ptmt.setNull(6, Types.INTEGER); 209 | } 210 | if (pv.getRemote_local() != null) { 211 | ptmt.setInt(7, pv.getRemote_local()); 212 | }else { 213 | ptmt.setNull(7, Types.INTEGER); 214 | } 215 | if (pv.getReactive_power_compensation() != null) { 216 | ptmt.setInt(8, pv.getReactive_power_compensation()); 217 | }else { 218 | ptmt.setNull(8, Types.INTEGER); 219 | } 220 | if (pv.getSmoke_alarm() != null) { 221 | ptmt.setInt(9, pv.getSmoke_alarm()); 222 | }else { 223 | ptmt.setNull(9, Types.INTEGER); 224 | } 225 | if (pv.getDC_lightning_protection() != null) { 226 | ptmt.setInt(10, pv.getDC_lightning_protection()); 227 | }else { 228 | ptmt.setNull(10, Types.INTEGER); 229 | } 230 | if (pv.getAC_lightning_protection() != null) { 231 | ptmt.setInt(11, pv.getAC_lightning_protection()); 232 | }else { 233 | ptmt.setNull(11, Types.INTEGER); 234 | } 235 | if (pv.getPV_reverse_connection() != null) { 236 | ptmt.setInt(12, pv.getPV_reverse_connection()); 237 | }else { 238 | ptmt.setNull(12, Types.INTEGER); 239 | } 240 | if (pv.getPV_insulation_resistance() != null) { 241 | ptmt.setInt(13, pv.getPV_insulation_resistance()); 242 | }else { 243 | ptmt.setNull(13, Types.INTEGER); 244 | } 245 | if (pv.getDC_overvoltage() != null) { 246 | ptmt.setInt(14, pv.getDC_overvoltage()); 247 | }else { 248 | ptmt.setNull(14, Types.INTEGER); 249 | } 250 | if (pv.getPower_voltage() != null) { 251 | ptmt.setInt(15, pv.getPower_voltage()); 252 | }else { 253 | ptmt.setNull(15, Types.INTEGER); 254 | } 255 | if (pv.getGrid_frequency() != null) { 256 | ptmt.setInt(16, pv.getGrid_frequency()); 257 | }else { 258 | ptmt.setNull(16, Types.INTEGER); 259 | } 260 | if (pv.getGrid_reverse_order() != null) { 261 | ptmt.setInt(17, pv.getGrid_reverse_order()); 262 | }else { 263 | ptmt.setNull(17, Types.INTEGER); 264 | } 265 | if (pv.getInverter_overload() != null) { 266 | ptmt.setInt(18, pv.getInverter_overload()); 267 | }else { 268 | ptmt.setNull(18, Types.INTEGER); 269 | } 270 | if (pv.getInverter_overheating() != null) { 271 | ptmt.setInt(19, pv.getInverter_overheating()); 272 | }else { 273 | ptmt.setNull(19, Types.INTEGER); 274 | } 275 | if (pv.getInverter_short_circuit() != null) { 276 | ptmt.setInt(20, pv.getInverter_short_circuit()); 277 | }else { 278 | ptmt.setNull(20, Types.INTEGER); 279 | } 280 | if (pv.getAmbient_temperature_overheating() != null) { 281 | ptmt.setInt(21, pv.getAmbient_temperature_overheating()); 282 | }else { 283 | ptmt.setNull(21, Types.INTEGER); 284 | } 285 | if (pv.getIsland_protection() != null) { 286 | ptmt.setInt(22, pv.getIsland_protection()); 287 | }else { 288 | ptmt.setNull(22, Types.INTEGER); 289 | } 290 | ptmt.setString(23, pv.getPv_num()); 291 | ptmt.execute(); 292 | conn.close(); 293 | } 294 | // 删除 295 | public void delPVDigitalQuantityData(String pv_num) throws SQLException { 296 | Connection conn = C3P0Utils.getConnection(); 297 | String sql = "" + 298 | " delete from microgrids_pvdigitalquantitydata " + 299 | " where pv_num=?"; 300 | PreparedStatement ptmt = conn.prepareStatement(sql); 301 | ptmt.setString(1, pv_num); 302 | ptmt.execute(); 303 | conn.close(); 304 | } 305 | // 条件获取所有数据 306 | public List query(List> params) throws Exception { 307 | 308 | List pvds = new ArrayList(); 309 | PVDigitalQuantityData pvd = null; 310 | 311 | Connection conn = C3P0Utils.getConnection(); 312 | StringBuilder sql = new StringBuilder(); 313 | sql.append("select * from microgrids_pvdigitalquantitydata where 1=1"); 314 | if (params != null && params.size()>0) { 315 | for (int i=0; i< params.size(); i++) { 316 | Map map = params.get(i); 317 | sql.append(" "+ map.get("ao") +" " + map.get("name") + " " + map.get("rela") + " " + map.get("value")); 318 | } 319 | } 320 | System.out.println(sql); 321 | PreparedStatement ptmt = conn.prepareStatement(sql.toString()); 322 | ResultSet rs = ptmt.executeQuery(); 323 | 324 | while(rs.next()) { 325 | pvd = new PVDigitalQuantityData(); 326 | pvd.setPv_num(rs.getString("pv_num")); 327 | pvd.setStatus_down(rs.getInt("status_down")); 328 | pvd.setStatus_standby(rs.getInt("status_standby")); 329 | pvd.setStatus_selftest(rs.getInt("status_selftest")); 330 | pvd.setStatus_ongrid(rs.getInt("status_ongrid")); 331 | pvd.setLocking_self(rs.getInt("locking_self")); 332 | pvd.setEmergency_stop(rs.getInt("emergency_stop")); 333 | pvd.setRemote_local(rs.getInt("remote_local")); 334 | pvd.setReactive_power_compensation(rs.getInt("reactive_power_compensation")); 335 | pvd.setSmoke_alarm(rs.getInt("smoke_alarm")); 336 | pvd.setDC_lightning_protection(rs.getInt("dC_lightning_protection")); 337 | pvd.setAC_lightning_protection(rs.getInt("aC_lightning_protection")); 338 | pvd.setPV_reverse_connection(rs.getInt("pV_reverse_connection")); 339 | pvd.setPV_insulation_resistance(rs.getInt("pV_insulation_resistance")); 340 | pvd.setDC_overvoltage(rs.getInt("dC_overvoltage")); 341 | pvd.setPower_voltage(rs.getInt("power_voltage")); 342 | pvd.setGrid_frequency(rs.getInt("grid_frequency")); 343 | pvd.setGrid_reverse_order(rs.getInt("grid_reverse_order")); 344 | pvd.setInverter_overload(rs.getInt("inverter_overload")); 345 | pvd.setInverter_overheating(rs.getInt("inverter_overheating")); 346 | pvd.setInverter_short_circuit(rs.getInt("inverter_short_circuit")); 347 | pvd.setAmbient_temperature_overheating(rs.getInt("ambient_temperature_overheating")); 348 | pvd.setIsland_protection(rs.getInt("island_protection")); 349 | pvds.add(pvd); 350 | } 351 | conn.close(); 352 | return pvds; 353 | 354 | } 355 | // 获取 356 | public PVDigitalQuantityData get(String pv_num) throws SQLException{ 357 | 358 | PVDigitalQuantityData pvd = null; 359 | 360 | Connection conn = C3P0Utils.getConnection(); 361 | String sql = "" + 362 | " select * from microgrids_pvdigitalquantitydata " + 363 | " where pv_num=?"; 364 | PreparedStatement ptmt = conn.prepareStatement(sql); 365 | ptmt.setString(1, pv_num); 366 | ResultSet rs = ptmt.executeQuery(); 367 | 368 | while (rs.next()) { 369 | pvd = new PVDigitalQuantityData(); 370 | pvd.setPv_num(rs.getString("pv_num")); 371 | pvd.setStatus_down(rs.getInt("status_down")); 372 | pvd.setStatus_standby(rs.getInt("status_standby")); 373 | pvd.setStatus_selftest(rs.getInt("status_selftest")); 374 | pvd.setStatus_ongrid(rs.getInt("status_ongrid")); 375 | pvd.setLocking_self(rs.getInt("locking_self")); 376 | pvd.setEmergency_stop(rs.getInt("emergency_stop")); 377 | pvd.setRemote_local(rs.getInt("remote_local")); 378 | pvd.setReactive_power_compensation(rs.getInt("reactive_power_compensation")); 379 | pvd.setSmoke_alarm(rs.getInt("smoke_alarm")); 380 | pvd.setDC_lightning_protection(rs.getInt("dC_lightning_protection")); 381 | pvd.setAC_lightning_protection(rs.getInt("aC_lightning_protection")); 382 | pvd.setPV_reverse_connection(rs.getInt("pV_reverse_connection")); 383 | pvd.setPV_insulation_resistance(rs.getInt("pV_insulation_resistance")); 384 | pvd.setDC_overvoltage(rs.getInt("dC_overvoltage")); 385 | pvd.setPower_voltage(rs.getInt("power_voltage")); 386 | pvd.setGrid_frequency(rs.getInt("grid_frequency")); 387 | pvd.setGrid_reverse_order(rs.getInt("grid_reverse_order")); 388 | pvd.setInverter_overload(rs.getInt("inverter_overload")); 389 | pvd.setInverter_overheating(rs.getInt("inverter_overheating")); 390 | pvd.setInverter_short_circuit(rs.getInt("inverter_short_circuit")); 391 | pvd.setAmbient_temperature_overheating(rs.getInt("ambient_temperature_overheating")); 392 | pvd.setIsland_protection(rs.getInt("island_protection")); 393 | } 394 | conn.close(); 395 | return pvd; 396 | } 397 | } 398 | -------------------------------------------------------------------------------- /src/iec104/Apdu.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /* APDU帧处理 */ 7 | public class Apdu { 8 | // 发送接收序列号 9 | private int sendSeqNum = 0; 10 | private int receiveSeqNum = 0; 11 | private ApciType apciType; 12 | private Asdu asdu = null; 13 | 14 | // 枚举,APCI类型,即I帧,S帧,U帧 15 | public enum ApciType { 16 | I_FORMAT, // I帧 17 | S_FORMAT, // S帧 18 | TESTFR_CON, // U帧,测试确认 19 | TESTFR_ACT, // U帧,测试命令 20 | STOPDT_CON, // U帧,停止确认 21 | STOPDT_ACT, // U帧,停止命令 22 | STARTDT_CON, // U帧,启动确认 23 | STARTDT_ACT, // U帧,启动命令 24 | } 25 | 26 | public Apdu() {} 27 | 28 | public Apdu(int sendSeqNum, int receiveSeqNum, ApciType apciType, Asdu asdu) { 29 | this.sendSeqNum = sendSeqNum; 30 | this.receiveSeqNum = receiveSeqNum; 31 | this.apciType = apciType; 32 | this.asdu = asdu; 33 | } 34 | public Apdu(DataInputStream dis) throws Exception { 35 | int start = dis.readByte() & 0xff; 36 | int len = dis.readByte() & 0xff; 37 | System.out.println("启动帧:" + Integer.toHexString(start)); 38 | System.out.println("APDU长度:" + len); 39 | // 控制域存储 40 | byte[] controlFields = new byte[4]; 41 | if(start != 104 ){ 42 | System.out.println(new IllegalArgumentException("启动帧错误")); 43 | }else if(len < 4 || len >253){ 44 | System.out.println(new IllegalArgumentException("帧长度有误")); 45 | }else{ 46 | //读4字节控制域 47 | dis.readFully(controlFields); 48 | if((controlFields[0] & 0x01)==0){ 49 | //I帧 50 | this.apciType = ApciType.I_FORMAT; 51 | //发送序列号 52 | sendSeqNum = ((controlFields[0] & 0xfe) >> 1) + ((controlFields[1] & 0xff) << 7); 53 | //接收序列号 54 | receiveSeqNum = ((controlFields[2] & 0xfe) >> 1) + ((controlFields[3] & 0xff) << 7); 55 | System.out.println("I帧,发送序列号:"+sendSeqNum+",接收序列号:"+receiveSeqNum); 56 | }else if ((controlFields[0] & 0x03)==1){ 57 | //S帧 58 | this.apciType = ApciType.S_FORMAT; 59 | receiveSeqNum = ((controlFields[2] & 0xfe) >> 1) + ((controlFields[3] & 0xff) << 7); 60 | System.out.println("S帧,接收序列号:"+receiveSeqNum); 61 | }else if ((controlFields[0] & 0x03) == 3){ 62 | //U帧 63 | if (controlFields[0] == 0x07){ 64 | this.apciType = ApciType.STARTDT_ACT; 65 | System.out.println("U帧,启动命令"); 66 | }else if (controlFields[0] == 0x0B){ 67 | this.apciType = ApciType.STARTDT_CON; 68 | System.out.println("U帧启动确认"); 69 | }else if (controlFields[0] == 0x13){ 70 | this.apciType = ApciType.STOPDT_ACT; 71 | System.out.println("U帧停止命令"); 72 | }else if (controlFields[0] == 0x23){ 73 | this.apciType = ApciType.STOPDT_CON; 74 | System.out.println("U帧停止确认"); 75 | }else if (controlFields[0] == 0x43){ 76 | this.apciType = ApciType.TESTFR_ACT; 77 | System.out.println("U帧测试命令"); 78 | }else if (controlFields[0] == (byte) 0x83){ 79 | this.apciType = ApciType.TESTFR_CON; 80 | System.out.println("U帧测试确认"); 81 | } 82 | } 83 | } 84 | //构建信息体 85 | if (len > 6) { 86 | this.asdu = new Asdu(dis); 87 | } 88 | } 89 | 90 | public int encode(byte[] buffer) throws IOException { 91 | 92 | buffer[0] = 0x68; 93 | 94 | int length = 4; 95 | 96 | if (apciType == ApciType.I_FORMAT) { 97 | buffer[2] = (byte) (sendSeqNum << 1); 98 | buffer[3] = (byte) (sendSeqNum >> 7); 99 | buffer[4] = (byte) (receiveSeqNum << 1); 100 | buffer[5] = (byte) (receiveSeqNum >> 7); 101 | length += asdu.encode(buffer, 6); 102 | } 103 | else if (apciType == ApciType.STARTDT_ACT) { 104 | buffer[2] = 0x07; 105 | buffer[3] = 0x00; 106 | buffer[4] = 0x00; 107 | buffer[5] = 0x00; 108 | } 109 | else if (apciType == ApciType.STARTDT_CON) { 110 | buffer[2] = 0x0b; 111 | buffer[3] = 0x00; 112 | buffer[4] = 0x00; 113 | buffer[5] = 0x00; 114 | } 115 | else if (apciType == ApciType.S_FORMAT) { 116 | buffer[2] = 0x01; 117 | buffer[3] = 0x00; 118 | buffer[4] = (byte) (receiveSeqNum << 1); 119 | buffer[5] = (byte) (receiveSeqNum >> 7); 120 | } 121 | 122 | buffer[1] = (byte) length; 123 | 124 | return length + 2; 125 | } 126 | 127 | public ApciType getApciType(){ 128 | return apciType; 129 | } 130 | 131 | public int getSendSeqNumber() { 132 | return sendSeqNum; 133 | } 134 | 135 | public int getReceiveSeqNumber() { 136 | return receiveSeqNum; 137 | } 138 | 139 | public Asdu getAsdu() { 140 | return asdu; 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/iec104/Asdu.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | 5 | import iec104.util.ChangeUtils; 6 | 7 | 8 | /* ASDU数据单元解析 */ 9 | public class Asdu { 10 | // 功能类型 11 | private final int typeId; 12 | // 元素序列 13 | private final boolean isSequenceOfElements; 14 | private int vsq; 15 | private final int addressNum; 16 | // 传输原因 17 | private final int causeOfTransmission; 18 | private boolean test; 19 | private boolean negativeConfirm; 20 | private int originatorAddress; 21 | private final int commonAddress; 22 | private InformationObject[] informationObjects; 23 | private byte[] privateInformation; 24 | 25 | public Asdu(int typeId,boolean isSequenceOfElements, int causeOfTransmission, boolean test, boolean negativeConfirm, int originatorAddress, int commonAddress, InformationObject[] informationObjects) { 26 | this.typeId = typeId; 27 | this.isSequenceOfElements = isSequenceOfElements; 28 | this.causeOfTransmission = causeOfTransmission; 29 | this.test = test; 30 | this.negativeConfirm = negativeConfirm; 31 | this.commonAddress = commonAddress; 32 | this.originatorAddress = originatorAddress; 33 | this.informationObjects = informationObjects; 34 | this.privateInformation = null; 35 | 36 | if (isSequenceOfElements) { 37 | this.addressNum = informationObjects[0].getInformationElements().length; 38 | }else { 39 | this.addressNum = informationObjects.length; 40 | } 41 | } 42 | 43 | public Asdu(DataInputStream dataInputStream) throws Exception { 44 | //获取类型表示配置文件 45 | this.typeId = dataInputStream.readByte() & 0xff; 46 | System.out.println("类型标识:"+ typeId); 47 | if (Init.typeIdProp.getProperty(String.valueOf(typeId))== null || "".equals(Init.typeIdProp.getProperty(String.valueOf(typeId)))){ 48 | System.out.println("无效的类型标识:"+typeId); 49 | }else{ 50 | System.out.println("类型标识:" + Init.typeIdProp.getProperty(String.valueOf(typeId))); 51 | } 52 | 53 | int vsqNum = dataInputStream.readByte() & 0xff; 54 | String vsqFormat = String.format("%08d",Integer.parseInt(Integer.toBinaryString(vsqNum))); 55 | //可变结构限定词,转为二进制后获取第8位(信息体是否连续标志) 56 | vsq = Integer.parseInt(vsqFormat.substring(0,1)); 57 | //可变结构限定词,获取第1-7位,代表信息数据数目 58 | addressNum = Integer.parseInt(vsqFormat.substring(1,8),2); 59 | if (vsq == 1) { 60 | isSequenceOfElements = true; 61 | System.out.println("信息体地址连续:" +isSequenceOfElements+",信息数据条数:" + addressNum); 62 | } else { 63 | isSequenceOfElements = false; 64 | System.out.println("信息体地址连续:" +isSequenceOfElements+",信息数据条数:" + addressNum); 65 | } 66 | int numberOfSequenceElements; 67 | int numberOfInformationObjects; 68 | //根据是否连续来确定信息对象数目、信息元素数目 69 | if (isSequenceOfElements) { 70 | numberOfSequenceElements = addressNum; // 信息数据数目 71 | numberOfInformationObjects = 1; // 信息元素数目为1(地址) 72 | }else { 73 | numberOfSequenceElements = 1; // 信息数据数目为1 74 | numberOfInformationObjects = addressNum; 75 | } 76 | byte[] cot = new byte[2]; 77 | dataInputStream.readFully(cot); 78 | //传送原因 79 | causeOfTransmission = Integer.parseInt(ChangeUtils.byteAppend(cot),10); 80 | System.out.println("传送原因:" + Init.causeProp.getProperty(String.valueOf(causeOfTransmission))); 81 | //公共地址 82 | byte[] commAddress = new byte[2]; 83 | dataInputStream.readFully(commAddress); 84 | commonAddress = Integer.parseInt(ChangeUtils.byteAppend(commAddress)); 85 | System.out.println("公共地址:" + commonAddress); 86 | //信息体 87 | if (typeId < 128) { 88 | informationObjects = new InformationObject[numberOfInformationObjects]; 89 | for (int i = 0; i < numberOfInformationObjects; i++) { 90 | informationObjects[i] = new InformationObject(dataInputStream, typeId, numberOfSequenceElements); 91 | } 92 | privateInformation = null; 93 | }else{ 94 | System.out.println(" "); 95 | } 96 | 97 | } 98 | 99 | public int getTypeId() { 100 | return typeId; 101 | } 102 | 103 | public boolean isSequenceOfElements() { 104 | return isSequenceOfElements; 105 | } 106 | 107 | public int getSequenceLength() { 108 | return addressNum; 109 | } 110 | 111 | public int getCauseOfTransmission() { 112 | return causeOfTransmission; 113 | } 114 | 115 | public boolean isTestFrame() { 116 | return test; 117 | } 118 | 119 | public boolean isNegativeConfirm() { 120 | return negativeConfirm; 121 | } 122 | 123 | public Integer getOriginatorAddress() { 124 | return originatorAddress; 125 | } 126 | 127 | public int getCommonAddress() { 128 | return commonAddress; 129 | } 130 | 131 | public InformationObject[] getInformationObjects() { 132 | return informationObjects; 133 | } 134 | 135 | public byte[] getPrivateInformation() { 136 | return privateInformation; 137 | } 138 | 139 | int encode(byte[] buffer, int i) { 140 | 141 | int origi = i; 142 | 143 | buffer[i++] = (byte) typeId; 144 | if (isSequenceOfElements) { 145 | buffer[i++] = (byte) (addressNum | 0x80); 146 | }else { 147 | buffer[i++] = (byte) addressNum; 148 | } 149 | 150 | if (test) { 151 | if (negativeConfirm) { 152 | buffer[i++] = (byte) (causeOfTransmission | 0xC0); 153 | }else { 154 | buffer[i++] = (byte) (causeOfTransmission | 0x80); 155 | } 156 | }else { 157 | if (negativeConfirm) { 158 | buffer[i++] = (byte) (causeOfTransmission | 0x40); 159 | }else { 160 | buffer[i++] = (byte) causeOfTransmission; 161 | } 162 | } 163 | 164 | buffer[i++] = (byte) originatorAddress; 165 | 166 | buffer[i++] = (byte) commonAddress; 167 | 168 | buffer[i++] = (byte) (commonAddress >> 8); 169 | 170 | if (informationObjects != null) { 171 | for (InformationObject informationObject : informationObjects) { 172 | i += informationObject.encode(buffer, i); 173 | } 174 | }else { 175 | System.arraycopy(privateInformation, 0, buffer, i, privateInformation.length); 176 | i += privateInformation.length; 177 | } 178 | return i - origi; 179 | } 180 | 181 | @Override 182 | public String toString() { 183 | 184 | StringBuilder builder = new StringBuilder(); 185 | if (informationObjects != null) { 186 | for (InformationObject informationObject : informationObjects) { 187 | builder.append(informationObject.toString()); 188 | builder.append("\n"); 189 | } 190 | }else { 191 | builder.append("\nPrivate Information:\n"); 192 | int l = 1; 193 | for (byte b : privateInformation) { 194 | if ((l != 1) && ((l - 1) % 8 == 0)) { 195 | builder.append(' '); 196 | } 197 | if ((l != 1) && ((l - 1) % 16 == 0)) { 198 | builder.append('\n'); 199 | } 200 | l++; 201 | builder.append("0x"); 202 | String hexString = Integer.toHexString(b & 0xff); 203 | if (hexString.length() == 1) { 204 | builder.append(0); 205 | } 206 | builder.append(hexString + " "); 207 | } 208 | } 209 | 210 | return builder.toString(); 211 | 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /src/iec104/Client.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.net.Socket; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Map; 11 | import java.util.concurrent.Executors; 12 | import java.util.concurrent.ScheduledExecutorService; 13 | import java.util.concurrent.TimeUnit; 14 | 15 | import dao.DevControlDao; 16 | import iec104.IeShortFloat; 17 | import iec104.IeSinglePointWithQuality; 18 | 19 | import iec104.util.ChangeUtils; 20 | 21 | 22 | public class Client { 23 | // 定义的是本地远程命令发送帧的接收和发送序号 24 | public static int receiveSeqNum = 0; //接收序号 25 | public static int sendSeqNum = 0; // 发送序号,每发送一个后需+1 26 | public static void main(String[] args) { 27 | // 记录存储遥控、遥调实时值 28 | Map remoteControlValues = new HashMap(); 29 | Map remoteAdjustVlaues = new HashMap(); 30 | try { 31 | //系统初始化 32 | Init.start(); 33 | // 建立对服务端主机的Socket连接 34 | Socket socket = new Socket("127.0.0.1", 2404); 35 | // 由Socket对象得到输出流,并构造PrintWriter对象 36 | OutputStream os = socket.getOutputStream(); 37 | // 启动链路 38 | os.write(ChangeUtils.hexStringToBytes("680407000000")); 39 | // 发送总召唤命令 40 | Runnable runnable = new Runnable() { 41 | public void run() { 42 | try { 43 | byte[] recNum = new byte[2]; 44 | recNum[0] = (byte) (receiveSeqNum << 1); 45 | recNum[1] = (byte) (receiveSeqNum >> 7); 46 | String recStr = ChangeUtils.toHexString(recNum); 47 | byte[] sendNum = new byte[2]; 48 | sendNum[0] = (byte) (sendSeqNum << 1); 49 | sendNum[1] = (byte) (sendSeqNum >> 7); 50 | sendSeqNum += 1; 51 | String sendStr = ChangeUtils.toHexString(sendNum); 52 | os.write(ChangeUtils.hexStringToBytes("680E"+sendStr+recStr+"64010600010000000014")); 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | } 56 | } 57 | }; 58 | ScheduledExecutorService service_A = Executors.newSingleThreadScheduledExecutor(); 59 | // 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间 60 | service_A.scheduleAtFixedRate(runnable, 2, 60, TimeUnit.SECONDS); 61 | 62 | // 设备信息定时获取存入设备类,并进行处理发送(遥测、遥信数据) 63 | Runnable runnable_db_send = new Runnable() { 64 | @Override 65 | public void run() { 66 | try { 67 | // 遥控信息(单点遥控) 68 | Iterator address_control = Init.remoteControl.keys(); 69 | while (address_control.hasNext()) { 70 | String address = address_control.next().toString(); 71 | String num = Init.remoteControl.getJSONObject(address).getString("num"); 72 | String field = Init.remoteControl.getJSONObject(address).getString("field"); 73 | DevControlDao devDao = new DevControlDao(); 74 | if (!num.equals("") && !field.equals("")) { 75 | Integer value = devDao.getint(num, field); 76 | if(remoteControlValues.containsKey(address) && value == remoteControlValues.get(address)) { 77 | //System.out.println("状态不变"); 78 | } else { 79 | remoteControlValues.put(address, value); 80 | System.out.println("信息体地址:" + address + "信息体值:"+ value); 81 | // 起始位 82 | String start = "68"; 83 | // 长度 84 | Integer len = 14; 85 | byte[] lenNum = new byte[1]; 86 | lenNum[0] = (byte) (len >> 0); 87 | String lenStr = ChangeUtils.toHexString(lenNum); 88 | // 发送序号 89 | byte[] sendNum = new byte[2]; 90 | sendNum[0] = (byte) (sendSeqNum << 1); 91 | sendNum[1] = (byte) (sendSeqNum >> 7); 92 | sendSeqNum += 1; 93 | String sendStr = ChangeUtils.toHexString(sendNum); 94 | // 接收序号 95 | byte[] recNum = new byte[2]; 96 | recNum[0] = (byte) (receiveSeqNum << 1); 97 | recNum[1] = (byte) (receiveSeqNum >> 7); 98 | String recStr = ChangeUtils.toHexString(recNum); 99 | // 类型标识 100 | String typeIdStr = "2d"; 101 | // 可变结构限定词 102 | String vsqStr = "01"; 103 | // 传输原因 104 | String causeOfTransmissionStr = "0600"; 105 | // 公共地址 106 | String commAddressStr = "0100"; 107 | // 信息体地址 108 | Integer addr = Integer.parseInt(address); 109 | byte[] addrNum = new byte[3]; 110 | addrNum[0] = (byte) (addr >> 0) ; 111 | addrNum[1] = (byte) (addr >> 8); 112 | addrNum[2] = (byte) (addr >> 16); 113 | String addrStr = ChangeUtils.toHexString(addrNum); 114 | // 信息值 115 | byte[] valueNum = new byte[1]; 116 | valueNum[0] = (byte) (value >> 0); 117 | String valuestr = ChangeUtils.toHexString(valueNum); 118 | os.write(ChangeUtils.hexStringToBytes(start+lenStr+sendStr+recStr+ 119 | typeIdStr+vsqStr+causeOfTransmissionStr+commAddressStr+ 120 | addrStr+valuestr)); 121 | System.out.println("发送遥控命令帧:"+ start+lenStr+sendStr+recStr+ 122 | typeIdStr+vsqStr+causeOfTransmissionStr+commAddressStr+ 123 | addrStr+valuestr); 124 | Thread.sleep(200); 125 | } 126 | } 127 | } 128 | // 遥调 (定值、标度化值) 129 | Iterator address_ajust = Init.remoteAdjust.keys(); 130 | while (address_ajust.hasNext()) { 131 | String address = address_ajust.next().toString(); 132 | String num = Init.remoteAdjust.getJSONObject(address).getString("num"); 133 | String field = Init.remoteAdjust.getJSONObject(address).getString("field"); 134 | DevControlDao devDao = new DevControlDao(); 135 | if (!num.equals("") && !field.equals("")) { 136 | Double value = devDao.getdouble(num, field); 137 | 138 | if(remoteAdjustVlaues.containsKey(address) && Math.abs(value-remoteAdjustVlaues.get(address))<0.01) { 139 | //System.out.println("状态不变"); 140 | } else { 141 | remoteAdjustVlaues.put(address, value); 142 | System.out.println("信息体地址:" + address + "信息体值:"+ value); 143 | // 起始位 144 | String start = "68"; 145 | // 长度 146 | Integer len = 16; 147 | byte[] lenNum = new byte[1]; 148 | lenNum[0] = (byte) (len >> 0); 149 | String lenStr = ChangeUtils.toHexString(lenNum); 150 | // 发送序号 151 | byte[] sendNum = new byte[2]; 152 | sendNum[0] = (byte) (sendSeqNum << 1); 153 | sendNum[1] = (byte) (sendSeqNum >> 7); 154 | sendSeqNum += 1; 155 | String sendStr = ChangeUtils.toHexString(sendNum); 156 | // 接收序号 157 | byte[] recNum = new byte[2]; 158 | recNum[0] = (byte) (receiveSeqNum << 1); 159 | recNum[1] = (byte) (receiveSeqNum >> 7); 160 | String recStr = ChangeUtils.toHexString(recNum); 161 | // 类型标识 162 | String typeIdStr = "31"; 163 | // 可变结构限定词 164 | String vsqStr = "01"; 165 | // 传输原因 166 | String causeOfTransmissionStr = "0600"; 167 | // 公共地址 168 | String commAddressStr = "0100"; 169 | // 信息体地址 170 | Integer addr = Integer.parseInt(address); 171 | byte[] addrNum = new byte[3]; 172 | addrNum[0] = (byte) (addr >> 0) ; 173 | addrNum[1] = (byte) (addr >> 8); 174 | addrNum[2] = (byte) (addr >> 16); 175 | String addrStr = ChangeUtils.toHexString(addrNum); 176 | // 信息值2位 177 | byte[] valueNum = new byte[2]; 178 | valueNum[0] = (byte) (value.intValue() >> 0); 179 | valueNum[1] = (byte) (value.intValue() >> 8); 180 | String valuestr = ChangeUtils.toHexString(valueNum); 181 | // 品质因素1位 182 | String QDSStr = "00"; 183 | os.write(ChangeUtils.hexStringToBytes(start+lenStr+sendStr+recStr+ 184 | typeIdStr+vsqStr+causeOfTransmissionStr+commAddressStr+ 185 | addrStr+valuestr+QDSStr)); 186 | System.out.println("发送遥调命令帧:"+ start+lenStr+sendStr+recStr+ 187 | typeIdStr+vsqStr+causeOfTransmissionStr+commAddressStr+ 188 | addrStr+valuestr); 189 | Thread.sleep(200); 190 | } 191 | } 192 | } 193 | } catch (Exception e) { 194 | e.printStackTrace(); 195 | } 196 | } 197 | }; 198 | ScheduledExecutorService service_send = Executors.newScheduledThreadPool(1); 199 | // 第二个参数为首次执行的延时时间,第三个参数为结束和下次开始执行的间隔时间 200 | service_send.scheduleWithFixedDelay(runnable_db_send, 3, 1, TimeUnit.SECONDS); 201 | 202 | // 由Socket对象得到输入流,构造相应的BufferedReader对象 203 | InputStream is = socket.getInputStream(); 204 | while(true){ 205 | try { 206 | Apdu apdu = new Apdu(new DataInputStream(is)); 207 | if (apdu.getApciType() == Apdu.ApciType.I_FORMAT) { 208 | Asdu asdu = apdu.getAsdu(); 209 | // 处理I命令 210 | handleData(asdu.getTypeId(),asdu.getInformationObjects()); 211 | // 返回S确认命令 212 | receiveSeqNum = apdu.getSendSeqNumber() + 1; 213 | byte[] recNum = new byte[2]; 214 | recNum[0] = (byte) (receiveSeqNum << 1); 215 | recNum[1] = (byte) (receiveSeqNum >> 7); 216 | String recStr = ChangeUtils.toHexString(recNum); 217 | os.write(ChangeUtils.hexStringToBytes("68040100" + recStr)); 218 | System.out.println("确认消息,S类型,下一条的接受序号:" + recStr); 219 | }else if (apdu.getApciType() == Apdu.ApciType.STARTDT_ACT) { 220 | os.write(ChangeUtils.hexStringToBytes("68040B000000")); 221 | System.out.println("确认启动消息,U类型"); 222 | }else if (apdu.getApciType() == Apdu.ApciType.STOPDT_ACT) { 223 | os.write(ChangeUtils.hexStringToBytes("680423000000")); 224 | System.out.println("确认停止消息,U类型"); 225 | }else if (apdu.getApciType() == Apdu.ApciType.TESTFR_ACT) { 226 | os.write(ChangeUtils.hexStringToBytes("680483000000")); 227 | System.out.println("确认测试消息,U类型"); 228 | }else{ 229 | System.out.println("其它报文:" + apdu.getApciType()); 230 | } 231 | }catch (Exception e){ 232 | System.out.println("异常错误,"+ e); 233 | break; 234 | } 235 | } 236 | os.close(); // 关闭Socket输出流 237 | is.close(); // 关闭Socket输入流 238 | socket.close(); // 关闭Socket 239 | } catch (Exception e) { 240 | System.out.println("异常错误,"+ e); 241 | } 242 | } 243 | public static void handleData(int typeId,InformationObject[] infoObjs) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { 244 | Runnable runnable = new Runnable() { 245 | @Override 246 | public void run() { 247 | try{ 248 | for (int i = 0; i < infoObjs.length; i++) { 249 | if(typeId == 1){ //单点遥信处理 250 | int firstAddress = infoObjs[i].getInformationObjectAddress(); // 信息地址起始位 251 | int len = infoObjs[i].getInformationElements().length; // 所有信息值长度 252 | for (int j = 0; j < len; j++) { 253 | int address = firstAddress + j; 254 | if(address > 500 || address < 0){ 255 | System.out.println("遥信信息超出定义范围:" + address); 256 | } 257 | String addr = String.valueOf(address); 258 | String num = Init.remoteSignal.getJSONObject(addr).getString("num"); 259 | String field = Init.remoteSignal.getJSONObject(addr).getString("field"); 260 | String table_name = Init.remoteSignal.getJSONObject(addr).getString("table_name"); 261 | Integer value = ((IeSinglePointWithQuality) infoObjs[i].getInformationElements()[j][0]).isOn(); 262 | if (table_name.equals("pvdigitalquantitydata")) { // 光伏逆变器数字量 263 | for(int k=0; k 17000){ 322 | System.out.println("遥测信息超出定义范围:" + address); 323 | } 324 | String addr = String.valueOf(address); 325 | String num = Init.remoteMeasure.getJSONObject(addr).getString("num"); 326 | String field = Init.remoteMeasure.getJSONObject(addr).getString("field"); 327 | String table_name = Init.remoteMeasure.getJSONObject(addr).getString("table_name"); 328 | Double value = Double.parseDouble(String.valueOf(((IeShortFloat) infoObjs[i].getInformationElements()[j][0]).getValue())); 329 | if (table_name.equals("pvanalogquantitydata1")) { // 光伏逆变器模拟量1 330 | for(int k=0; k < Init.PVA1.size(); k++) { 331 | if(Init.PVA1.get(k).getPv_num().equals(num)) { 332 | if(field.equals("matrix_volt")) { 333 | Init.PVA1.get(k).setMatrix_volt(value); 334 | } 335 | else if(field.equals("matrix_cur")) { 336 | Init.PVA1.get(k).setMatrix_cur(value); 337 | } 338 | else if(field.equals("matrix_power_in")) { 339 | Init.PVA1.get(k).setMatrix_power_in(value); 340 | } 341 | else if(field.equals("grid_volt_ab")) { 342 | Init.PVA1.get(k).setGrid_volt_ab(value); 343 | } 344 | else if(field.equals("grid_volt_bc")) { 345 | Init.PVA1.get(k).setGrid_volt_bc(value); 346 | } 347 | else if(field.equals("grid_volt_ca")) { 348 | Init.PVA1.get(k).setGrid_volt_ca(value); 349 | } 350 | else if(field.equals("on_grid_cur_a")) { 351 | Init.PVA1.get(k).setOn_grid_cur_a(value); 352 | } 353 | else if(field.equals("on_grid_cur_b")) { 354 | Init.PVA1.get(k).setOn_grid_cur_b(value); 355 | } 356 | else if(field.equals("on_grid_cur_c")) { 357 | Init.PVA1.get(k).setOn_grid_cur_c(value); 358 | } 359 | else if(field.equals("power_factor_a")) { 360 | Init.PVA1.get(k).setPower_factor_a(value); 361 | } 362 | else if(field.equals("power_factor_b")) { 363 | Init.PVA1.get(k).setPower_factor_b(value); 364 | } 365 | else if(field.equals("power_factor_c")) { 366 | Init.PVA1.get(k).setPower_factor_c(value); 367 | } 368 | else if(field.equals("grid_freq")) { 369 | Init.PVA1.get(k).setGrid_freq(value); 370 | } 371 | } 372 | } 373 | }else if(table_name.equals("pvanalogquantitydata2")){ 374 | for(int k=0; k> 4) & 0x01; 20 | } 21 | 22 | public int isSubstituted() { 23 | return (value >> 5) & 0x01; 24 | } 25 | 26 | public int isNotTopical() { 27 | return (value >> 6) & 0x01; 28 | } 29 | 30 | public int isInvalid() { 31 | return (value >> 7) & 0x01; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "被封锁: " + isBlocked() + ", 被取代: " + isSubstituted() + ", 非当前值: " + isNotTopical() + ", 是否有效: " + isInvalid(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/iec104/IeQualifierOfInterrogation.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | public class IeQualifierOfInterrogation extends InformationElement { 7 | 8 | private final int value; 9 | 10 | public IeQualifierOfInterrogation(int value) { 11 | this.value = value; 12 | } 13 | 14 | public IeQualifierOfInterrogation(DataInputStream is) throws IOException { 15 | value = (is.readByte() & 0xff); 16 | } 17 | 18 | @Override 19 | public int encode(byte[] buffer, int i) { 20 | buffer[i] = (byte) value; 21 | return 1; 22 | } 23 | 24 | public int getValue() { 25 | return value; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "Qualifier of interrogation: " + value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/iec104/IeQuality.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /* 品质描述 */ 7 | public class IeQuality extends IeAbstractQuality { 8 | 9 | IeQuality(DataInputStream is) throws IOException { 10 | super(is); 11 | } 12 | 13 | public int isOverflow() { 14 | return value >> 0 & 0x01; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "品质描述, 溢出: " + isOverflow() + ", " + super.toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/iec104/IeScaled.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | public class IeScaled extends InformationElement { 7 | private final Integer value; 8 | 9 | public IeScaled(Integer value) { 10 | this.value = value; 11 | } 12 | 13 | public IeScaled(DataInputStream is) throws IOException { 14 | value = ((is.readByte() & 0xff) | ((is.readByte() & 0xff) << 8)); 15 | } 16 | 17 | @Override 18 | public int encode(byte[] buffer, int i) { 19 | 20 | int tempVal = Float.floatToIntBits(value); 21 | buffer[i++] = (byte) tempVal; 22 | buffer[i++] = (byte) (tempVal >> 8); 23 | return 2; 24 | } 25 | 26 | public Integer getValue() { 27 | return value; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "标度化值: " + value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/iec104/IeShortFloat.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /* 类型标识,测量值,短浮点数 遥测 */ 7 | public class IeShortFloat extends InformationElement { 8 | 9 | private final float value; 10 | 11 | public IeShortFloat(float value) { 12 | this.value = value; 13 | } 14 | 15 | public IeShortFloat(DataInputStream is) throws IOException { 16 | value = Float.intBitsToFloat((is.readByte() & 0xff) | ((is.readByte() & 0xff) << 8) | ((is.readByte() & 0xff) << 16) | ((is.readByte() & 0xff) << 24)); 17 | } 18 | 19 | @Override 20 | public int encode(byte[] buffer, int i) { 21 | 22 | int tempVal = Float.floatToIntBits(value); 23 | buffer[i++] = (byte) tempVal; 24 | buffer[i++] = (byte) (tempVal >> 8); 25 | buffer[i++] = (byte) (tempVal >> 16); 26 | buffer[i] = (byte) (tempVal >> 24); 27 | 28 | return 4; 29 | } 30 | 31 | public float getValue() { 32 | return value; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "短浮点数值: " + value; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/iec104/IeSinglePointWithQuality.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /* 单点信息 */ 7 | public class IeSinglePointWithQuality extends IeAbstractQuality { 8 | 9 | public IeSinglePointWithQuality(DataInputStream is) throws IOException { 10 | super(is); 11 | } 12 | 13 | public int isOn() { 14 | return (value >> 0) & 0x01; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "单点, 是否开闸: " + isOn() + ", " + super.toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/iec104/InformationElement.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | public abstract class InformationElement { 4 | public abstract int encode(byte[] buffer, int i); 5 | } -------------------------------------------------------------------------------- /src/iec104/InformationObject.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.IOException; 5 | 6 | /* 信息体对象 */ 7 | public class InformationObject { 8 | private int informationObjectAddress; 9 | private final InformationElement[][] informationElements; 10 | 11 | public InformationObject(int informationObjectAddress, InformationElement[][] informationElements) { 12 | this.informationObjectAddress = informationObjectAddress; 13 | this.informationElements = informationElements; 14 | } 15 | 16 | public InformationObject(DataInputStream is, int typeId, int numberOfSequenceElements) throws IOException { 17 | this.informationObjectAddress = (is.readByte() & 0xff) + ((is.readByte() & 0xff) <<8) + ((is.readByte() & 0xff) << 16); 18 | switch (typeId) { 19 | // 1 单点遥信 20 | case 1: 21 | informationElements = new InformationElement[numberOfSequenceElements][1]; 22 | for (int i = 0; i < numberOfSequenceElements; i++) { 23 | informationElements[i][0] = new IeSinglePointWithQuality(is); 24 | } 25 | break; 26 | // 13 浮点型遥测 27 | case 13: 28 | informationElements = new InformationElement[numberOfSequenceElements][2]; 29 | for (int i = 0; i < numberOfSequenceElements; i++) { 30 | informationElements[i][0] = new IeShortFloat(is); 31 | informationElements[i][1] = new IeQuality(is); 32 | } 33 | break; 34 | // 45 单点遥控返回确认数据读取 35 | case 45: 36 | informationElements = new InformationElement[numberOfSequenceElements][1]; 37 | for (int i = 0; i < numberOfSequenceElements; i++) { 38 | informationElements[i][0] = new IeSinglePointWithQuality(is); 39 | } 40 | break; 41 | // 49标度化值返回确认数据获取 42 | case 49: 43 | informationElements = new InformationElement[numberOfSequenceElements][2]; 44 | for (int i = 0; i < numberOfSequenceElements; i++) { 45 | informationElements[i][0] = new IeScaled(is); 46 | informationElements[i][1] = new IeQuality(is); 47 | } 48 | break; 49 | // 100 总召 50 | case 100: 51 | informationElements = new InformationElement[][] { { new IeQualifierOfInterrogation(is) } }; 52 | break; 53 | 54 | default: 55 | throw new IOException("无法转换信息对象,由于类型标识未知: " + typeId); 56 | } 57 | } 58 | 59 | public int encode(byte[] buffer, int i) { 60 | int origi = i; 61 | buffer[i++] = (byte) informationObjectAddress; 62 | buffer[i++] = (byte) (informationObjectAddress >> 8); 63 | buffer[i++] = (byte) (informationObjectAddress >> 16); 64 | for (InformationElement[] informationElementCombination : informationElements) { 65 | for (InformationElement informationElement : informationElementCombination) { 66 | i += informationElement.encode(buffer, i); 67 | } 68 | } 69 | 70 | return i - origi; 71 | } 72 | 73 | public int getInformationObjectAddress() { 74 | return informationObjectAddress; 75 | } 76 | 77 | public InformationElement[][] getInformationElements() { 78 | return informationElements; 79 | } 80 | 81 | @Override 82 | public String toString() { 83 | StringBuilder builder = new StringBuilder("IOA: " + informationObjectAddress); 84 | if (informationElements.length > 1) { 85 | int i = 1; 86 | for (InformationElement[] informationElementSet : informationElements) { 87 | builder.append("\n信息体元素集 " + i + ":"); 88 | for (InformationElement informationElement : informationElementSet) { 89 | builder.append("\n"); 90 | builder.append(informationElement.toString()); 91 | } 92 | i++; 93 | } 94 | } 95 | else { 96 | for (InformationElement[] informationElementSet : informationElements) { 97 | for (InformationElement informationElement : informationElementSet) { 98 | builder.append("\n"); 99 | builder.append(informationElement.toString()); 100 | } 101 | } 102 | } 103 | return builder.toString(); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/iec104/Init.java: -------------------------------------------------------------------------------- 1 | package iec104; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | import java.util.Properties; 7 | import java.util.concurrent.Executors; 8 | import java.util.concurrent.ScheduledExecutorService; 9 | import java.util.concurrent.TimeUnit; 10 | 11 | import dao.DevControlDao; 12 | import dao.PVAnalogQuantityData1Dao; 13 | import dao.PVAnalogQuantityData2Dao; 14 | import dao.PVDigitalQuantityDataDao; 15 | import iec104.util.FileUtils; 16 | import model.PVAnalogQuantityData1; 17 | import model.PVAnalogQuantityData2; 18 | import model.PVDigitalQuantityData; 19 | import net.sf.json.JSON; 20 | import net.sf.json.JSONObject; 21 | 22 | public class Init { 23 | 24 | public static Properties typeIdProp = null; 25 | public static Properties causeProp = null; 26 | public static JSONObject devsinfo = null; 27 | public static JSONObject remoteSignal = null; 28 | public static JSONObject remoteMeasure = null; 29 | public static JSONObject remoteControl = null; 30 | public static JSONObject remoteAdjust = null; 31 | 32 | // 创建数据库数据对象集合 33 | public static List PVD = new ArrayList(); 34 | public static List PVA1 = new ArrayList(); 35 | public static List PVA2 = new ArrayList(); 36 | 37 | public static void start(){ 38 | initBusinessData(); 39 | initdb(); 40 | init_db_time_do(); 41 | } 42 | 43 | /* 配置文件解析 */ 44 | public static void initBusinessData(){ 45 | try { 46 | // 传送类型及原因 47 | typeIdProp = FileUtils.loadPropFile("typeId.properties"); 48 | causeProp = FileUtils.loadPropFile("cause.properties"); 49 | // 设备信息 50 | devsinfo = FileUtils.loadJsonFile("dev.json"); 51 | // 遥信、遥测、遥控、遥调 52 | remoteSignal = FileUtils.loadJsonFile("remote_signal.json"); 53 | remoteMeasure = FileUtils.loadJsonFile("remote_measure.json"); 54 | remoteControl = FileUtils.loadJsonFile("remote_control.json"); 55 | remoteAdjust = FileUtils.loadJsonFile("remote_adjust.json"); 56 | 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | } 60 | } 61 | /* 数据库初始化 */ 62 | public static void initdb(){ 63 | try { 64 | // 创建数据库设备信息表操作对象 65 | DevControlDao devControlDaoObject = new DevControlDao(); 66 | // dev.json中录入的设备(根据json文件中的设备去添加、删除数据库中设备) 67 | List devs_real = new ArrayList(); 68 | Iterator devs = devsinfo.keys(); 69 | while (devs.hasNext()) { 70 | String dev_num = devs.next().toString(); 71 | devs_real.add(dev_num); 72 | JSONObject devobject = devsinfo.getJSONObject(dev_num); 73 | Integer dev_type = devobject.getInt("DEV_TYPE"); 74 | try { 75 | devControlDaoObject.addDev(dev_num, dev_type); 76 | System.out.println(dev_num+"添加成功"); 77 | }catch (Exception e) { 78 | devControlDaoObject.updateDev(dev_num, dev_type); 79 | System.out.println(dev_num+"设备已存在,更新设备类型"); 80 | } 81 | 82 | if (dev_type == 1) { //如果是光伏设备 83 | // 光伏数字量对象 84 | PVDigitalQuantityData pvd = new PVDigitalQuantityData(); 85 | pvd.setPv_num(dev_num); 86 | PVD.add(pvd); 87 | // 光伏逆变器模拟量创建对应设备模拟量对象 88 | PVAnalogQuantityData1 pva1 = new PVAnalogQuantityData1(); 89 | pva1.setPv_num(dev_num); 90 | PVA1.add(pva1); 91 | PVAnalogQuantityData2 pva2 = new PVAnalogQuantityData2(); 92 | pva2.setPv_num(dev_num); 93 | PVA2.add(pva2); 94 | } 95 | } 96 | // 获取数据库所有设备,删除json中不存在设备 97 | List devs_db = devControlDaoObject.query(); 98 | for(int i=0; i < devs_db.size(); i++) { 99 | String dev_num = devs_db.get(i); 100 | if(!devs_real.contains(dev_num)) { 101 | devControlDaoObject.delDev(dev_num); 102 | System.out.println("删除设备"+dev_num); 103 | } 104 | } 105 | 106 | }catch (Exception e) { 107 | e.printStackTrace(); 108 | } 109 | } 110 | public static void init_db_time_do() { 111 | // 数字量数据定时插入 112 | Runnable runnable_db_pvd = new Runnable() { 113 | @Override 114 | public void run() { 115 | try { 116 | for(int i=0; i < PVD.size(); i++) { 117 | PVDigitalQuantityDataDao pvddao = new PVDigitalQuantityDataDao(); 118 | if (pvddao.get(PVD.get(i).getPv_num()) == null) { 119 | pvddao.addPVDigitalQuantityData(PVD.get(i)); 120 | }else { 121 | pvddao.updatePVDigitalQuantityData(PVD.get(i)); 122 | } 123 | } 124 | } catch (Exception e) { 125 | e.printStackTrace(); 126 | } 127 | } 128 | }; 129 | // 模拟量数据1定时插入 130 | Runnable runnable_db_pva1 = new Runnable() { 131 | @Override 132 | public void run() { 133 | try { 134 | for(int i=0; i < PVA1.size(); i++) { 135 | PVAnalogQuantityData1Dao pva1dao = new PVAnalogQuantityData1Dao(); 136 | pva1dao.addPVAnalogQuantityData1(PVA1.get(i)); 137 | PVA1.get(i).Empty(); 138 | } 139 | } catch (Exception e) { 140 | e.printStackTrace(); 141 | } 142 | } 143 | }; 144 | // 模拟量数据2定时插入 145 | Runnable runnable_db_pva2 = new Runnable() { 146 | @Override 147 | public void run() { 148 | try { 149 | for(int i=0; i < PVA2.size(); i++) { 150 | PVAnalogQuantityData2Dao pva2dao = new PVAnalogQuantityData2Dao(); 151 | pva2dao.addPVAnalogQuantityData2(PVA2.get(i)); 152 | PVA2.get(i).Empty(); 153 | } 154 | } catch (Exception e) { 155 | e.printStackTrace(); 156 | } 157 | } 158 | }; 159 | ScheduledExecutorService service = Executors.newScheduledThreadPool(10); 160 | // 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间 161 | service.scheduleAtFixedRate(runnable_db_pvd, 0, 1, TimeUnit.SECONDS); 162 | service.scheduleAtFixedRate(runnable_db_pva1, 0, 10, TimeUnit.SECONDS); 163 | service.scheduleAtFixedRate(runnable_db_pva2, 0, 10, TimeUnit.SECONDS); 164 | } 165 | } 166 | 167 | -------------------------------------------------------------------------------- /src/iec104/util/ChangeUtils.java: -------------------------------------------------------------------------------- 1 | package iec104.util; 2 | 3 | import java.util.Calendar; 4 | import java.util.GregorianCalendar; 5 | 6 | import iec104.IeShortFloat; 7 | 8 | /* 数据转换类工具包 */ 9 | 10 | public class ChangeUtils { 11 | private static final char[] HEX_CHAR_TABLE = { 12 | '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' 13 | }; 14 | 15 | public static String toHexString(Byte[] data){ 16 | byte[] resultBytes = new byte[data.length]; 17 | for(int i =0 ;i>> 4]; 31 | hex[index++] = (byte) HEX_CHAR_TABLE[v & 0xF]; 32 | } 33 | return new String(hex); 34 | } 35 | 36 | 37 | /* 16进制字符串转换为对应的字节流数据 */ 38 | public static byte[] hexStringToBytes(String data) { 39 | // 字符串为null或空时,返回null 40 | if(data == null || "".equals(data)) { 41 | return null; 42 | } 43 | // 字符串大写转换 44 | data = data.toUpperCase(); 45 | // 字符串数/2等于字节数 46 | int length = data.length()/2; 47 | // 转换为字符串数组 48 | char[] dataChars = data.toCharArray(); 49 | // 创建字节数组 50 | byte[] byteData = new byte[length]; 51 | for (int i = 0; i=0;i--){ 65 | stringBuffer.append(String.format("%02d",bytes[i])); 66 | } 67 | return stringBuffer.toString(); 68 | } 69 | public static String floatToHexstr(float value){ 70 | byte[] buffer = new byte[4]; 71 | new IeShortFloat(value).encode(buffer,0); 72 | return toHexString(buffer); 73 | } 74 | 75 | public static String encode(float value){ 76 | int tempVal = Float.floatToIntBits(value); 77 | byte[] buffer = new byte[4]; 78 | buffer[0] = (byte) tempVal; 79 | buffer[1] = (byte) (tempVal >> 8); 80 | buffer[2] = (byte) (tempVal >> 16); 81 | buffer[3] = (byte) (tempVal >> 24); 82 | int[] s = new int[4]; 83 | StringBuffer sb = new StringBuffer(); 84 | for (int i = 0; i < buffer.length; i++){ 85 | s[i] = (buffer[i] & 0xff); 86 | if (Integer.toHexString(s[i]).length() == 1){ 87 | sb.append("0" + Integer.toHexString(s[i]) + " "); 88 | }else { 89 | sb.append(Integer.toHexString(s[i]) + " "); 90 | } 91 | } 92 | return sb.toString().toUpperCase(); 93 | } 94 | 95 | public static String encodeInfomationAddress(int address) { 96 | byte[] buffer = new byte[3]; 97 | buffer[0] = (byte) address; 98 | buffer[1] = (byte) (address >> 8); 99 | buffer[2] = (byte) (address >> 16); 100 | 101 | int[] s = new int[4]; 102 | StringBuffer sb = new StringBuffer(); 103 | for (int i = 0; i < buffer.length; i++){ 104 | s[i] = (buffer[i] & 0xff); 105 | if (Integer.toHexString(s[i]).length() == 1){ 106 | sb.append("0" + Integer.toHexString(s[i]) + " "); 107 | }else { 108 | sb.append(Integer.toHexString(s[i]) + " "); 109 | } 110 | } 111 | return sb.toString().toUpperCase(); 112 | } 113 | 114 | // private static int startSendNum = 1; 115 | 116 | public static void main(String[] args) { 117 | /* Runnable runnable = new Runnable() { 118 | public void run() { 119 | try { 120 | byte[] recNum = new byte[2]; 121 | recNum[0] = (byte) (startSendNum << 1); 122 | recNum[1] = (byte) (startSendNum >> 7); 123 | String recStr = Utils.toHexString(recNum); 124 | System.out.println("******************"+ recStr); 125 | startSendNum++; 126 | System.out.println("******************"+ startSendNum); 127 | } catch (Exception e) { 128 | e.printStackTrace(); 129 | } 130 | } 131 | }; 132 | ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); 133 | // 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间 134 | service.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.SECONDS);*/ 135 | 136 | Calendar calendar=new GregorianCalendar(); 137 | int year = Integer.parseInt(String.valueOf(calendar.get(Calendar.YEAR)).substring(2)); 138 | int month = calendar.get(Calendar.MONTH); 139 | int day = calendar.get(Calendar.DATE); 140 | int hour = calendar.get(Calendar.HOUR_OF_DAY); 141 | int minute = calendar.get(Calendar.MINUTE); 142 | int second = calendar.get(Calendar.SECOND); 143 | int milliSecond = calendar.get(Calendar.MILLISECOND); 144 | int handleS = second * 1000 + milliSecond; 145 | 146 | String yearStr = Integer.toHexString(year); 147 | yearStr = yearStr.length() > 1?yearStr:"0".concat(yearStr); 148 | String monthStr = Integer.toHexString(month); 149 | monthStr = monthStr.length() > 1?monthStr:"0".concat(monthStr); 150 | String dayStr = Integer.toHexString(day); 151 | dayStr = dayStr.length() > 1?dayStr:"0".concat(dayStr); 152 | String hourStr = Integer.toHexString(hour); 153 | hourStr = hourStr.length() > 1?hourStr:"0".concat(hourStr); 154 | String minuteStr = Integer.toHexString(minute); 155 | minuteStr = minuteStr.length() > 1?minuteStr:"0".concat(minuteStr); 156 | String handleSStr = Integer.toHexString(handleS); 157 | if(handleSStr.length() == 1){ 158 | handleSStr = "000" + handleSStr; 159 | }else if(handleSStr.length() == 2){ 160 | handleSStr = "00" + handleSStr; 161 | }else if(handleSStr.length() == 3){ 162 | handleSStr = "0" + handleSStr; 163 | } 164 | handleSStr = handleSStr.substring(2) + handleSStr.substring(0,2); 165 | System.out.println(yearStr); 166 | System.out.println(monthStr); 167 | System.out.println(dayStr); 168 | System.out.println(hourStr); 169 | System.out.println(minuteStr); 170 | System.out.println(handleSStr); 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /src/iec104/util/FileUtils.java: -------------------------------------------------------------------------------- 1 | package iec104.util; 2 | 3 | import net.sf.json.JSONObject; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.InputStreamReader; 9 | import java.util.Properties; 10 | 11 | /* @Description */ 12 | public class FileUtils { 13 | /* 加载property配置文件 */ 14 | public static Properties loadPropFile(String filePath) throws Exception{ 15 | InputStream is = FileUtils.class.getClassLoader().getResourceAsStream(filePath); 16 | InputStreamReader isr = new InputStreamReader(is, "GBK"); 17 | Properties properties = new Properties(); 18 | try { 19 | properties.load(isr); 20 | }catch (IOException ex){ 21 | ex.printStackTrace(); 22 | }finally { 23 | is.close(); 24 | isr.close(); 25 | } 26 | return properties; 27 | } 28 | /* 加载json配置文件 */ 29 | public static JSONObject loadJsonFile(String filePath) throws Exception{ 30 | InputStream is = FileUtils.class.getClassLoader().getResourceAsStream(filePath); 31 | BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); 32 | StringBuffer jsonStrBuff = new StringBuffer(); 33 | String brStr = null; 34 | while ((brStr =br.readLine()) != null){ 35 | jsonStrBuff.append(brStr); 36 | } 37 | return JSONObject.fromObject(jsonStrBuff.toString()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/jdbc/C3P0Utils.java: -------------------------------------------------------------------------------- 1 | package jdbc; 2 | 3 | import java.sql.Connection; 4 | import java.sql.SQLException; 5 | import javax.sql.DataSource; 6 | 7 | import com.mchange.v2.c3p0.ComboPooledDataSource; 8 | 9 | public class C3P0Utils { 10 | private static ComboPooledDataSource dataSource = new ComboPooledDataSource("mysql"); 11 | public static DataSource getDataSource() { 12 | return dataSource; 13 | } 14 | public static Connection getConnection() { 15 | try { 16 | return dataSource.getConnection(); 17 | }catch (SQLException e) { 18 | throw new RuntimeException(e); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/model/DevControl.java: -------------------------------------------------------------------------------- 1 | package model; 2 | 3 | 4 | public class DevControl { 5 | private Integer id; 6 | private String num; 7 | private Integer dev_type; 8 | private Integer switch_status; 9 | private double active_power; 10 | private double reactive_power; 11 | private double powerfactor; 12 | 13 | public Integer getId() { 14 | return id; 15 | } 16 | public void setId(Integer id) { 17 | this.id = id; 18 | } 19 | public String getNum() { 20 | return num; 21 | } 22 | public void setNum(String num) { 23 | this.num = num; 24 | } 25 | public Integer getDev_type() { 26 | return dev_type; 27 | } 28 | public void setDev_type(Integer dev_type) { 29 | this.dev_type = dev_type; 30 | } 31 | public Integer getSwitch_status() { 32 | return switch_status; 33 | } 34 | public void setSwitch_status(Integer switch_status) { 35 | this.switch_status = switch_status; 36 | } 37 | public double getActive_power() { 38 | return active_power; 39 | } 40 | public void setActive_power(double active_power) { 41 | this.active_power = active_power; 42 | } 43 | public double getReactive_power() { 44 | return reactive_power; 45 | } 46 | public void setReactive_power(double reactive_power) { 47 | this.reactive_power = reactive_power; 48 | } 49 | public double getPowerfactor() { 50 | return powerfactor; 51 | } 52 | public void setPowerfactor(double powerfactor) { 53 | this.powerfactor = powerfactor; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/model/PVAnalogQuantityData1.java: -------------------------------------------------------------------------------- 1 | package model; 2 | 3 | import java.util.Date; 4 | 5 | public class PVAnalogQuantityData1 { 6 | private Integer id; 7 | private Date timestamp; 8 | private String pv_num; 9 | private Double matrix_cur; 10 | private Double matrix_volt; 11 | private Double matrix_power_in; 12 | private Double grid_volt_ab; 13 | private Double grid_volt_bc; 14 | private Double grid_volt_ca; 15 | private Double on_grid_cur_a; 16 | private Double on_grid_cur_b; 17 | private Double on_grid_cur_c; 18 | private Double power_factor_a; 19 | private Double power_factor_b; 20 | private Double power_factor_c; 21 | private Double grid_freq; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | public void setId(Integer id) { 27 | this.id = id; 28 | } 29 | public Date getTimestamp() { 30 | return timestamp; 31 | } 32 | public void setTimestamp(Date timestamp) { 33 | this.timestamp = timestamp; 34 | } 35 | public String getPv_num() { 36 | return pv_num; 37 | } 38 | public void setPv_num(String pv_num) { 39 | this.pv_num = pv_num; 40 | } 41 | public Double getMatrix_cur() { 42 | return matrix_cur; 43 | } 44 | public void setMatrix_cur(Double matrix_cur) { 45 | this.matrix_cur = matrix_cur; 46 | } 47 | public Double getMatrix_volt() { 48 | return matrix_volt; 49 | } 50 | public void setMatrix_volt(Double matrix_volt) { 51 | this.matrix_volt = matrix_volt; 52 | } 53 | public Double getMatrix_power_in() { 54 | return matrix_power_in; 55 | } 56 | public void setMatrix_power_in(Double matrix_power_in) { 57 | this.matrix_power_in = matrix_power_in; 58 | } 59 | public Double getGrid_volt_ab() { 60 | return grid_volt_ab; 61 | } 62 | public void setGrid_volt_ab(Double grid_volt_ab) { 63 | this.grid_volt_ab = grid_volt_ab; 64 | } 65 | public Double getGrid_volt_bc() { 66 | return grid_volt_bc; 67 | } 68 | public void setGrid_volt_bc(Double grid_volt_bc) { 69 | this.grid_volt_bc = grid_volt_bc; 70 | } 71 | public Double getGrid_volt_ca() { 72 | return grid_volt_ca; 73 | } 74 | public void setGrid_volt_ca(Double grid_volt_ca) { 75 | this.grid_volt_ca = grid_volt_ca; 76 | } 77 | public Double getOn_grid_cur_a() { 78 | return on_grid_cur_a; 79 | } 80 | public void setOn_grid_cur_a(Double on_grid_cur_a) { 81 | this.on_grid_cur_a = on_grid_cur_a; 82 | } 83 | public Double getOn_grid_cur_b() { 84 | return on_grid_cur_b; 85 | } 86 | public void setOn_grid_cur_b(Double on_grid_cur_b) { 87 | this.on_grid_cur_b = on_grid_cur_b; 88 | } 89 | public Double getOn_grid_cur_c() { 90 | return on_grid_cur_c; 91 | } 92 | public void setOn_grid_cur_c(Double on_grid_cur_c) { 93 | this.on_grid_cur_c = on_grid_cur_c; 94 | } 95 | public Double getPower_factor_a() { 96 | return power_factor_a; 97 | } 98 | public void setPower_factor_a(Double power_factor_a) { 99 | this.power_factor_a = power_factor_a; 100 | } 101 | public Double getPower_factor_b() { 102 | return power_factor_b; 103 | } 104 | public void setPower_factor_b(Double power_factor_b) { 105 | this.power_factor_b = power_factor_b; 106 | } 107 | public Double getPower_factor_c() { 108 | return power_factor_c; 109 | } 110 | public void setPower_factor_c(Double power_factor_c) { 111 | this.power_factor_c = power_factor_c; 112 | } 113 | public Double getGrid_freq() { 114 | return grid_freq; 115 | } 116 | public void setGrid_freq(Double grid_freq) { 117 | this.grid_freq = grid_freq; 118 | } 119 | 120 | public void Empty() { 121 | this.matrix_cur = null; 122 | this.matrix_volt = null; 123 | this.matrix_power_in = null; 124 | this.grid_volt_ab = null; 125 | this.grid_volt_bc = null; 126 | this.grid_volt_ca = null; 127 | this.on_grid_cur_a = null; 128 | this.on_grid_cur_b = null; 129 | this.on_grid_cur_c = null; 130 | this.power_factor_a = null; 131 | this.power_factor_b = null; 132 | this.power_factor_c = null; 133 | this.grid_freq = null; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/model/PVAnalogQuantityData2.java: -------------------------------------------------------------------------------- 1 | package model; 2 | 3 | import java.util.Date; 4 | 5 | public class PVAnalogQuantityData2 { 6 | 7 | private Integer id; 8 | private Date timestamp; 9 | private String pv_num; 10 | private Double on_grid_p; 11 | private Double on_grid_q; 12 | private Double on_grid_s; 13 | private Double inv_cabin_temp; 14 | private Double day_gen_power; 15 | private Double day_runtime; 16 | private Double total_gen_power; 17 | private Double total_runtime; 18 | private Double co2_reduce; 19 | 20 | public Integer getId() { 21 | return id; 22 | } 23 | public void setId(Integer id) { 24 | this.id = id; 25 | } 26 | public Date getTimestamp() { 27 | return timestamp; 28 | } 29 | public void setTimestamp(Date timestamp) { 30 | this.timestamp = timestamp; 31 | } 32 | public String getPv_num() { 33 | return pv_num; 34 | } 35 | public void setPv_num(String pv_num) { 36 | this.pv_num = pv_num; 37 | } 38 | public Double getOn_grid_p() { 39 | return on_grid_p; 40 | } 41 | public void setOn_grid_p(Double on_grid_p) { 42 | this.on_grid_p = on_grid_p; 43 | } 44 | public Double getOn_grid_q() { 45 | return on_grid_q; 46 | } 47 | public void setOn_grid_q(Double on_grid_q) { 48 | this.on_grid_q = on_grid_q; 49 | } 50 | public Double getOn_grid_s() { 51 | return on_grid_s; 52 | } 53 | public void setOn_grid_s(Double on_grid_s) { 54 | this.on_grid_s = on_grid_s; 55 | } 56 | public Double getInv_cabin_temp() { 57 | return inv_cabin_temp; 58 | } 59 | public void setInv_cabin_temp(Double inv_cabin_temp) { 60 | this.inv_cabin_temp = inv_cabin_temp; 61 | } 62 | public Double getDay_gen_power() { 63 | return day_gen_power; 64 | } 65 | public void setDay_gen_power(Double day_gen_power) { 66 | this.day_gen_power = day_gen_power; 67 | } 68 | public Double getDay_runtime() { 69 | return day_runtime; 70 | } 71 | public void setDay_runtime(Double day_runtime) { 72 | this.day_runtime = day_runtime; 73 | } 74 | public Double getTotal_gen_power() { 75 | return total_gen_power; 76 | } 77 | public void setTotal_gen_power(Double total_gen_power) { 78 | this.total_gen_power = total_gen_power; 79 | } 80 | public Double getTotal_runtime() { 81 | return total_runtime; 82 | } 83 | public void setTotal_runtime(Double total_runtime) { 84 | this.total_runtime = total_runtime; 85 | } 86 | public Double getCo2_reduce() { 87 | return co2_reduce; 88 | } 89 | public void setCo2_reduce(Double co2_reduce) { 90 | this.co2_reduce = co2_reduce; 91 | } 92 | 93 | public void Empty() { 94 | this.on_grid_p = null; 95 | this.on_grid_q = null; 96 | this.on_grid_s = null; 97 | this.inv_cabin_temp = null; 98 | this.day_gen_power = null; 99 | this.day_runtime = null; 100 | this.total_gen_power = null; 101 | this.total_runtime = null; 102 | this.co2_reduce = null; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/model/PVDigitalQuantityData.java: -------------------------------------------------------------------------------- 1 | package model; 2 | 3 | 4 | /* 光伏数字量告警信息对应实体类 */ 5 | public class PVDigitalQuantityData { 6 | private Integer id; 7 | private String pv_num; 8 | private Integer status_down; 9 | private Integer status_standby; 10 | private Integer status_selftest; 11 | private Integer status_ongrid; 12 | private Integer locking_self; 13 | private Integer emergency_stop; 14 | private Integer remote_local; 15 | private Integer reactive_power_compensation; 16 | private Integer smoke_alarm; 17 | private Integer DC_lightning_protection; 18 | private Integer AC_lightning_protection; 19 | private Integer PV_reverse_connection; 20 | private Integer PV_insulation_resistance; 21 | private Integer DC_overvoltage; 22 | private Integer power_voltage; 23 | private Integer grid_frequency; 24 | private Integer grid_reverse_order; 25 | private Integer inverter_overload; 26 | private Integer inverter_overheating; 27 | private Integer ambient_temperature_overheating; 28 | private Integer inverter_short_circuit; 29 | private Integer island_protection; 30 | 31 | public Integer getId() { 32 | return id; 33 | } 34 | public void setId(Integer id) { 35 | this.id = id; 36 | } 37 | public String getPv_num() { 38 | return pv_num; 39 | } 40 | public void setPv_num(String pv_num) { 41 | this.pv_num = pv_num; 42 | } 43 | public Integer getStatus_down() { 44 | return status_down; 45 | } 46 | public void setStatus_down(Integer status_down) { 47 | this.status_down = status_down; 48 | } 49 | public Integer getStatus_standby() { 50 | return status_standby; 51 | } 52 | public void setStatus_standby(Integer status_standby) { 53 | this.status_standby = status_standby; 54 | } 55 | public Integer getStatus_selftest() { 56 | return status_selftest; 57 | } 58 | public void setStatus_selftest(Integer status_selftest) { 59 | this.status_selftest = status_selftest; 60 | } 61 | public Integer getStatus_ongrid() { 62 | return status_ongrid; 63 | } 64 | public void setStatus_ongrid(Integer status_ongrid) { 65 | this.status_ongrid = status_ongrid; 66 | } 67 | public Integer getLocking_self() { 68 | return locking_self; 69 | } 70 | public void setLocking_self(Integer locking_self) { 71 | this.locking_self = locking_self; 72 | } 73 | public Integer getEmergency_stop() { 74 | return emergency_stop; 75 | } 76 | public void setEmergency_stop(Integer emergency_stop) { 77 | this.emergency_stop = emergency_stop; 78 | } 79 | public Integer getRemote_local() { 80 | return remote_local; 81 | } 82 | public void setRemote_local(Integer remote_local) { 83 | this.remote_local = remote_local; 84 | } 85 | public Integer getReactive_power_compensation() { 86 | return reactive_power_compensation; 87 | } 88 | public void setReactive_power_compensation(Integer reactive_power_compensation) { 89 | this.reactive_power_compensation = reactive_power_compensation; 90 | } 91 | public Integer getSmoke_alarm() { 92 | return smoke_alarm; 93 | } 94 | public void setSmoke_alarm(Integer smoke_alarm) { 95 | this.smoke_alarm = smoke_alarm; 96 | } 97 | public Integer getDC_lightning_protection() { 98 | return DC_lightning_protection; 99 | } 100 | public void setDC_lightning_protection(Integer dC_lightning_protection) { 101 | DC_lightning_protection = dC_lightning_protection; 102 | } 103 | public Integer getAC_lightning_protection() { 104 | return AC_lightning_protection; 105 | } 106 | public void setAC_lightning_protection(Integer aC_lightning_protection) { 107 | AC_lightning_protection = aC_lightning_protection; 108 | } 109 | public Integer getPV_reverse_connection() { 110 | return PV_reverse_connection; 111 | } 112 | public void setPV_reverse_connection(Integer pV_reverse_connection) { 113 | PV_reverse_connection = pV_reverse_connection; 114 | } 115 | public Integer getPV_insulation_resistance() { 116 | return PV_insulation_resistance; 117 | } 118 | public void setPV_insulation_resistance(Integer pV_insulation_resistance) { 119 | PV_insulation_resistance = pV_insulation_resistance; 120 | } 121 | public Integer getDC_overvoltage() { 122 | return DC_overvoltage; 123 | } 124 | public void setDC_overvoltage(Integer dC_overvoltage) { 125 | DC_overvoltage = dC_overvoltage; 126 | } 127 | public Integer getPower_voltage() { 128 | return power_voltage; 129 | } 130 | public void setPower_voltage(Integer power_voltage) { 131 | this.power_voltage = power_voltage; 132 | } 133 | public Integer getGrid_frequency() { 134 | return grid_frequency; 135 | } 136 | public void setGrid_frequency(Integer grid_frequency) { 137 | this.grid_frequency = grid_frequency; 138 | } 139 | public Integer getGrid_reverse_order() { 140 | return grid_reverse_order; 141 | } 142 | public void setGrid_reverse_order(Integer grid_reverse_order) { 143 | this.grid_reverse_order = grid_reverse_order; 144 | } 145 | public Integer getInverter_overload() { 146 | return inverter_overload; 147 | } 148 | public void setInverter_overload(Integer inverter_overload) { 149 | this.inverter_overload = inverter_overload; 150 | } 151 | public Integer getInverter_overheating() { 152 | return inverter_overheating; 153 | } 154 | public void setInverter_overheating(Integer inverter_overheating) { 155 | this.inverter_overheating = inverter_overheating; 156 | } 157 | public Integer getInverter_short_circuit() { 158 | return inverter_short_circuit; 159 | } 160 | public void setInverter_short_circuit(Integer inverter_short_circuit) { 161 | this.inverter_short_circuit = inverter_short_circuit; 162 | } 163 | public Integer getAmbient_temperature_overheating() { 164 | return ambient_temperature_overheating; 165 | } 166 | public void setAmbient_temperature_overheating(Integer ambient_temperature_overheating) { 167 | this.ambient_temperature_overheating = ambient_temperature_overheating; 168 | } 169 | public Integer getIsland_protection() { 170 | return island_protection; 171 | } 172 | public void setIsland_protection(Integer island_protection) { 173 | this.island_protection = island_protection; 174 | } 175 | 176 | } 177 | --------------------------------------------------------------------------------