Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
dcdb
dcdb
Commits
242b102e
Commit
242b102e
authored
Dec 07, 2020
by
Alessio Netti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Analytics: fixes to Cooling Control plugin
parent
d153944d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
5 deletions
+14
-5
analytics/operators/coolingcontrol/CoolingControlOperator.cpp
...ytics/operators/coolingcontrol/CoolingControlOperator.cpp
+5
-4
analytics/operators/coolingcontrol/CoolingControlSensorBase.h
...ytics/operators/coolingcontrol/CoolingControlSensorBase.h
+1
-1
analytics/operators/coolingcontrol/SNMPController.cpp
analytics/operators/coolingcontrol/SNMPController.cpp
+6
-0
analytics/operators/coolingcontrol/SNMPController.h
analytics/operators/coolingcontrol/SNMPController.h
+2
-0
No files found.
analytics/operators/coolingcontrol/CoolingControlOperator.cpp
View file @
242b102e
...
...
@@ -99,6 +99,7 @@ void CoolingControlOperator::compute(U_Ptr unit) {
newSetting
=
steppedControl
(
buffer
,
unit
);
}
// LOG(debug) << "New setting: " << newSetting;
// Enacting control
if
(
newSetting
>=
0
&&
_controller
.
open
()
)
{
try
{
...
...
@@ -114,11 +115,11 @@ void CoolingControlOperator::compute(U_Ptr unit) {
int
CoolingControlOperator
::
continuousControl
(
std
::
vector
<
std
::
vector
<
reading_t
>>
&
readings
,
U_Ptr
unit
)
{
if
(
_currTemp
==
0
)
{
_currTemp
=
(
_maxTemp
-
_minTemp
)
/
2
;
_currTemp
=
(
_maxTemp
+
_minTemp
)
/
2
;
}
else
{
// If there are less hot nodes than our hot threshold, we increase the inlet temperature - and vice versa
uint64_t
percHotNodes
=
(
getNumHotNodes
(
readings
,
unit
)
*
100
)
/
readings
.
size
();
_currTemp
+
=
(
_hotPerc
-
percHotNodes
)
*
(
_maxTemp
-
_minTemp
)
/
100
;
_currTemp
=
(
int64_t
)
_currTemp
+
((
int64_t
)
_hotPerc
-
(
int64_t
)
percHotNodes
)
*
(
(
int64_t
)
_maxTemp
-
(
int64_t
)
_minTemp
)
/
100
;
_currTemp
=
clipTemperature
(
_currTemp
);
}
return
(
int
)
_currTemp
;
...
...
@@ -128,12 +129,12 @@ int CoolingControlOperator::steppedControl(std::vector<std::vector<reading_t>> &
uint64_t
oldTemp
=
_currTemp
;
int
ret
=
-
1
;
if
(
_currTemp
==
0
)
{
_currTemp
=
(
_maxTemp
-
_minTemp
)
/
2
;
_currTemp
=
(
_maxTemp
+
_minTemp
)
/
2
;
return
_currTemp
;
}
else
{
// If there are less hot nodes than our hot threshold, we increase the inlet temperature - and vice versa
uint64_t
percHotNodes
=
(
getNumHotNodes
(
readings
,
unit
)
*
100
)
/
readings
.
size
();
_currTemp
+
=
(
_hotPerc
-
percHotNodes
)
*
(
_maxTemp
-
_minTemp
)
/
100
;
_currTemp
=
(
int64_t
)
_currTemp
+
((
int64_t
)
_hotPerc
-
(
int64_t
)
percHotNodes
)
*
(
(
int64_t
)
_maxTemp
-
(
int64_t
)
_minTemp
)
/
100
;
_currTemp
=
clipTemperature
(
_currTemp
);
// We're crossing to a new bin - assigning the new setting
if
(
getBinForValue
(
oldTemp
)
!=
getBinForValue
(
_currTemp
))
{
...
...
analytics/operators/coolingcontrol/CoolingControlSensorBase.h
View file @
242b102e
...
...
@@ -53,7 +53,7 @@ public:
// Copy constructor
CoolingControlSensorBase
(
CoolingControlSensorBase
&
other
)
:
SNMPSensorBase
(
other
)
{
_hotThreshold
=
70
;
_hotThreshold
=
other
.
_hotThreshold
;
}
virtual
~
CoolingControlSensorBase
()
{}
...
...
analytics/operators/coolingcontrol/SNMPController.cpp
View file @
242b102e
...
...
@@ -57,4 +57,10 @@ void SNMPController::set(const oid *const OID, size_t OIDLen, unsigned char type
if
(
response
)
{
snmp_free_pdu
(
response
);
}
}
void
SNMPController
::
printEntityConfig
(
LOG_LEVEL
ll
,
unsigned
int
leadingSpaces
)
{
std
::
string
leading
(
leadingSpaces
,
' '
);
LOG_VAR
(
ll
)
<<
leading
<<
"OIDSuffix: "
<<
getOIDSuffix
();
SNMPConnection
::
printEntityConfig
(
ll
,
leadingSpaces
);
}
\ No newline at end of file
analytics/operators/coolingcontrol/SNMPController.h
View file @
242b102e
...
...
@@ -55,6 +55,8 @@ public:
}
}
}
void
printEntityConfig
(
LOG_LEVEL
ll
,
unsigned
int
leadingSpaces
)
override
;
protected:
...
...
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