Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
9060a6a9
Commit
9060a6a9
authored
Jul 25, 2024
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
智慧分析 - 健康等级
parent
11a40a1d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
5 deletions
+99
-5
IFanHealthIndexService.java
...boot/module/jxiop/biz/service/IFanHealthIndexService.java
+2
-0
IPvHealthIndexService.java
.../boot/module/jxiop/biz/service/IPvHealthIndexService.java
+4
-0
FanHealthIndexServiceImpl.java
...ule/jxiop/biz/service/impl/FanHealthIndexServiceImpl.java
+46
-0
PvHealthIndexServiceImpl.java
...dule/jxiop/biz/service/impl/PvHealthIndexServiceImpl.java
+47
-5
TdengineTimeServiceImpl.java
...odule/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
+0
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/IFanHealthIndexService.java
View file @
9060a6a9
...
...
@@ -16,6 +16,8 @@ import java.util.List;
*/
public
interface
IFanHealthIndexService
{
List
<
FanHealthIndex
>
getInfoListByGroupByCdFan
(
String
startTime
,
String
tableName
,
String
analysisObjectType
);
List
<
FanHealthIndex
>
getInfoListByGroupByZxtFan
(
String
startTime
,
String
tableName
,
String
analysisObjectType
);
/**
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/IPvHealthIndexService.java
View file @
9060a6a9
...
...
@@ -17,6 +17,10 @@ import java.util.List;
*/
public
interface
IPvHealthIndexService
{
List
<
PvHealthIndex
>
getInfoListByGroupByCdPv
(
String
startTime
,
String
tableName
,
String
analysisObjectType
);
/**
* 设备加权平均
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/FanHealthIndexServiceImpl.java
View file @
9060a6a9
...
...
@@ -36,6 +36,52 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
@Autowired
private
IdxBizFanWeightMapper
idxBizFanWeightMapper
;
@Override
public
List
<
FanHealthIndex
>
getInfoListByGroupByCdFan
(
String
startTime
,
String
tableName
,
String
analysisObjectType
)
{
List
<
FanHealthIndex
>
fanHealthIndicesZxt
=
fanHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
QueryWrapper
<
IdxBizFanWeight
>
idxBizFanWeightQueryWrapper
=
new
QueryWrapper
<>();
idxBizFanWeightQueryWrapper
.
eq
(
"type"
,
"5"
);
idxBizFanWeightQueryWrapper
.
isNotNull
(
"value"
);
List
<
IdxBizFanWeight
>
idxBizFanWeights
=
idxBizFanWeightMapper
.
selectList
(
idxBizFanWeightQueryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
IdxBizFanWeight:
:
getValue
));
// 开始计算加权平均
Map
<
String
,
List
<
FanHealthIndex
>>
fanHealthIndicesZxtMap
=
fanHealthIndicesZxt
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getGatewayId
()
+
o
.
getStation
()
+
o
.
getAnalysisObjType
()
+
o
.
getArea
()
+
o
.
getSubSystem
()
+
o
.
getEquipmentName
()
+
o
.
getNumber
()
+
o
.
getOrgCode
()));
List
<
FanHealthIndex
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
FanHealthIndex
fanHealthIndex
=
new
FanHealthIndex
();
fanHealthIndex
.
setIndexAddress
(
v
.
get
(
0
).
getIndexAddress
());
fanHealthIndex
.
setGatewayId
(
v
.
get
(
0
).
getGatewayId
());
fanHealthIndex
.
setStation
(
v
.
get
(
0
).
getStation
());
fanHealthIndex
.
setAnalysisObjType
(
"测点"
);
fanHealthIndex
.
setAnalysisObjSeq
(
v
.
get
(
0
).
getAnalysisObjSeq
());
fanHealthIndex
.
setWeight
(
v
.
get
(
0
).
getWeight
());
fanHealthIndex
.
setArea
(
v
.
get
(
0
).
getArea
());
fanHealthIndex
.
setSubSystem
(
v
.
get
(
0
).
getSubSystem
());
fanHealthIndex
.
setNumber
(
v
.
get
(
0
).
getNumber
());
fanHealthIndex
.
setEquipmentName
(
v
.
get
(
0
).
getEquipmentName
());
fanHealthIndex
.
setPointName
(
v
.
get
(
0
).
getPointName
());
fanHealthIndex
.
setKks
(
v
.
get
(
0
).
getNumber
());
fanHealthIndex
.
setOrgCode
(
v
.
get
(
0
).
getOrgCode
());
// 例如 子系统 = (测点1 * 测点1权重 + 测点2 * 测点2权重 + .... 测点n权重) / (测点1权重 + 测点2权重 + .... 测点n权重)
// 但是测点是没有权重的,所以子系统无法计算加权平均
// 设备 = (子系统1 * 子系统1权重 + 子系统2 * 子系统2权重 + .... 子系统n权重) / (子系统1权重 + 子系统2权重 + .... 子系统n权重)
// 但如果没有配置子系统的权重,如何计算?
try
{
// 加权平均
Double
totalHealthIndex
=
v
.
stream
().
mapToDouble
(
o
->
getWeight
(()
->
o
.
getArea
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubSystem
()
+
o
.
getPointName
(),
weightMap
)
*
o
.
getHealthIndex
()).
sum
();
Double
totalAnomaly
=
v
.
stream
().
mapToDouble
(
o
->
getWeight
(()
->
o
.
getArea
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubSystem
()
+
o
.
getPointName
(),
weightMap
)
*
o
.
getAnomaly
()).
sum
();
Double
totalWeight
=
v
.
stream
().
mapToDouble
(
o
->
getWeight
(()
->
o
.
getArea
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubSystem
()
+
o
.
getPointName
(),
weightMap
)).
sum
();
fanHealthIndex
.
setAnomaly
(
totalAnomaly
/
totalWeight
);
fanHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
// 普通平均
this
.
calculateAvg
(
fanHealthIndex
,
v
);
}
fanHealthIndicesZxtNews
.
add
(
fanHealthIndex
);
});
return
fanHealthIndicesZxtNews
;
}
/**
* 子系统加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/PvHealthIndexServiceImpl.java
View file @
9060a6a9
...
...
@@ -37,6 +37,53 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
@Autowired
private
IdxBizPvWeightMapper
idxBizPvWeightMapper
;
@Override
public
List
<
PvHealthIndex
>
getInfoListByGroupByCdPv
(
String
startTime
,
String
tableName
,
String
analysisObjectType
)
{
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"5"
);
queryWrapper
.
isNotNull
(
"value"
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
IdxBizPvWeight:
:
getValue
));
// 开始计算加权平均
Map
<
String
,
List
<
PvHealthIndex
>>
healthIndicesMap
=
pvHealthIndices
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getGatewayId
()
+
o
.
getIndexAddress
()
+
o
.
getStation
()
+
o
.
getAnalysisObjType
()
+
o
.
getAnalysisObjSeq
()
+
o
.
getWeight
()
+
o
.
getArea
()
+
o
.
getSubarray
()
+
o
.
getManufacturer
()
+
o
.
getEquipmentName
()
+
o
.
getPointName
()
+
o
.
getDeviceType
()
+
o
.
getKks
()
+
o
.
getOrgCode
()));
List
<
PvHealthIndex
>
pvHealthIndexList
=
new
ArrayList
<>();
healthIndicesMap
.
forEach
((
k
,
v
)
->
{
PvHealthIndex
pvHealthIndex
=
new
PvHealthIndex
();
pvHealthIndex
.
setIndexAddress
(
v
.
get
(
0
).
getIndexAddress
());
pvHealthIndex
.
setGatewayId
(
v
.
get
(
0
).
getGatewayId
());
pvHealthIndex
.
setStation
(
v
.
get
(
0
).
getStation
());
pvHealthIndex
.
setAnalysisObjType
(
"测点"
);
pvHealthIndex
.
setAnalysisObjSeq
(
v
.
get
(
0
).
getAnalysisObjSeq
());
pvHealthIndex
.
setWeight
(
v
.
get
(
0
).
getWeight
());
pvHealthIndex
.
setArea
(
v
.
get
(
0
).
getArea
());
pvHealthIndex
.
setSubarray
(
v
.
get
(
0
).
getSubarray
());
pvHealthIndex
.
setManufacturer
(
v
.
get
(
0
).
getManufacturer
());
pvHealthIndex
.
setEquipmentName
(
v
.
get
(
0
).
getEquipmentName
());
pvHealthIndex
.
setPointName
(
v
.
get
(
0
).
getPointName
());
pvHealthIndex
.
setDeviceType
(
v
.
get
(
0
).
getDeviceType
());
pvHealthIndex
.
setKks
(
v
.
get
(
0
).
getKks
());
pvHealthIndex
.
setOrgCode
(
v
.
get
(
0
).
getOrgCode
());
// 例如 子系统 = (测点1 * 测点1权重 + 测点2 * 测点2权重 + .... 测点n权重) / (测点1权重 + 测点2权重 + .... 测点n权重)
// 但是测点是没有权重的,所以子系统无法计算加权平均
// 设备 = (子系统1 * 子系统1权重 + 子系统2 * 子系统2权重 + .... 子系统n权重) / (子系统1权重 + 子系统2权重 + .... 子系统n权重)
// 但如果没有配置子系统的权重,如何计算?
try
{
// 加权平均
Double
totalHealthIndex
=
v
.
stream
().
mapToDouble
(
o
->
getWeight
(()
->
o
.
getArea
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
weightMap
)
*
o
.
getHealthIndex
()).
sum
();
Double
totalAnomaly
=
v
.
stream
().
mapToDouble
(
o
->
getWeight
(()
->
o
.
getArea
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
weightMap
)
*
o
.
getAnomaly
()).
sum
();
Double
totalWeight
=
v
.
stream
().
mapToDouble
(
o
->
getWeight
(()
->
o
.
getArea
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
weightMap
)).
sum
();
pvHealthIndex
.
setAnomaly
(
totalAnomaly
/
totalWeight
);
pvHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
// 普通平均
this
.
calculateAvg
(
pvHealthIndex
,
v
);
}
pvHealthIndexList
.
add
(
pvHealthIndex
);
});
return
pvHealthIndexList
;
}
/**
* 设备加权平均
* 加权平均数 = (w1 * x1 + w2 * x2 + … + wn * xn) / (w1 + w2 + … + wn)
...
...
@@ -87,7 +134,6 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
pvHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
// 普通平均
log
.
error
(
"计算加权平均异常"
,
e
.
getMessage
());
this
.
calculateAvg
(
pvHealthIndex
,
v
);
}
pvHealthIndexList
.
add
(
pvHealthIndex
);
...
...
@@ -144,7 +190,6 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
pvHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
// 普通平均
log
.
error
(
"计算加权平均异常"
,
e
.
getMessage
());
this
.
calculateAvg
(
pvHealthIndex
,
v
);
}
pvHealthIndexList
.
add
(
pvHealthIndex
);
...
...
@@ -199,7 +244,6 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
pvHealthIndex
.
setAnomaly
(
totalAnomaly
/
totalWeight
);
pvHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
log
.
error
(
"计算加权平均异常"
,
e
.
getMessage
());
// 普通平均
this
.
calculateAvg
(
pvHealthIndex
,
v
);
}
...
...
@@ -253,7 +297,6 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
pvHealthIndex
.
setAnomaly
(
totalAnomaly
/
totalWeight
);
pvHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
log
.
error
(
"计算加权平均异常"
,
e
.
getMessage
());
// 普通平均
this
.
calculateAvg
(
pvHealthIndex
,
v
);
}
...
...
@@ -307,7 +350,6 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
pvHealthIndex
.
setHealthIndex
(
totalHealthIndex
/
totalWeight
);
}
catch
(
Exception
e
)
{
// 普通平均
log
.
error
(
"计算加权平均异常"
,
e
.
getMessage
());
this
.
calculateAvg
(
pvHealthIndex
,
v
);
}
pvHealthIndexList
.
add
(
pvHealthIndex
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
View file @
9060a6a9
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment