Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
upside
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric S. Raymond
upside
Compare Revisions
6fe13de0a8a0c4f72c2bd3064e8500201d602ab0...236ffd641856807bfec94d25d73a9aeea31823fc
Source
236ffd641856807bfec94d25d73a9aeea31823fc
Select Git revision
...
Target
6fe13de0a8a0c4f72c2bd3064e8500201d602ab0
Select Git revision
Compare
Commits (2)
Add a missing alarm.
· d30dc0f6
Eric S. Raymond
authored
Apr 23, 2018
d30dc0f6
Implement HostDrainThreshold
· 236ffd64
Eric S. Raymond
authored
Apr 24, 2018
236ffd64
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
flow.py
docs/flow.py
+4
-3
transactions.adoc
docs/transactions.adoc
+1
-0
upsided.go
src/upsided/upsided.go
+3
-1
No files found.
docs/flow.py
View file @
236ffd64
...
...
@@ -166,7 +166,7 @@ events = {
"EventBadAC"
:
"Poll of mains reports bad AC voltage"
,
"EventBatteryWarn"
:
"Poll of BMS reports Time ToEmpty <= ShutdownTime + WarningTime"
,
"EventBatteryLow"
:
"Poll of BMS reports TimeToEmpty <= ShutdownTime"
,
"EventHostOff"
:
"Poll of host load sensor shows
no current draw
"
,
"EventHostOff"
:
"Poll of host load sensor shows
current draw less than threshold
"
,
"EventUnreachable"
:
"Code cannot reach this event"
,
}
...
...
@@ -189,7 +189,8 @@ MAINSOFF = production("MainsOff",
alarm
=
"DOWN"
)
MAINSDROP
=
production
(
"MainsDrop"
,
trigger
=
"EventBadAC"
,
meaning
=
"Mains power has dropped"
)
meaning
=
"Mains power has dropped"
,
alarm
=
"DOWN"
)
RESTORED
=
production
(
"Restored"
,
trigger
=
"EventGoodAC"
,
meaning
=
"Power is restored"
,
...
...
@@ -239,7 +240,7 @@ if __name__ == '__main__':
render
.
state
(
"OnBattery"
,
"On battery power"
)
render
.
action
(
"MainsUp"
,
"OnBattery"
,
MAINSDROP
)
render
.
action
(
"OnBattery"
,
"Overtime"
,
DWELLWARNING
)
render
.
state
(
"Overtime"
,
"User warned of shutdown"
)
render
.
state
(
"Overtime"
,
"User warned of
upcoming
shutdown"
)
render
.
action
(
"Overtime"
,
"PreShutdown"
,
DWELLTIMEOUT
)
render
.
state
(
"PreShutdown"
,
"Awaiting power drop"
)
render
.
action
(
"PreShutdown"
,
"ChargeWait"
,
RESTORED
)
...
...
docs/transactions.adoc
View file @
236ffd64
...
...
@@ -110,6 +110,7 @@ These policy parameters control the state transitions:
| Parameter | Default | Meaning
| ShutdownTime | 30 sec | Time required for host shutdown
| WarningTime | 60 sec | Desired warning margin before shutdown
| HostDrainThreshold | 10V | Lowest expected draw of shut down host.
|========================================================================
In the following state diagram, ovals are are possible values of a
...
...
src/upsided/upsided.go
View file @
236ffd64
...
...
@@ -28,6 +28,7 @@ type policyConfig struct {
WarningTime
time
.
Duration
QuietTime
time
.
Duration
VoltageThreshold
float32
HostDrainThreshold
int
HostPair
int
MasterSlaves
[][]
string
PowerButton
uint
...
...
@@ -116,6 +117,7 @@ func init() {
PolicyConfiguration
=
policyConfig
{
ShutdownTime
:
30
*
time
.
Second
,
// Time required for host shutdown
WarningTime
:
60
*
time
.
Second
,
// Desired warning margin before shutdown
HostDrainThreshold
:
10
,
QuietTime
:
10
*
time
.
Millisecond
,
VoltageThreshold
:
0.90
,
HostPair
:
1
,
...
...
@@ -309,7 +311,7 @@ func fireEvents(prev *Observables, ob *Observables) {
hostSensor
:=
PolicyConfiguration
.
HostSensor
()
nv
:=
ob
.
LoadMap
[
hostSensor
]
ov
:=
prev
.
LoadMap
[
hostSensor
]
if
ov
!=
0
&&
nv
==
0
{
if
ov
>=
PolicyConfiguration
.
HostDrainThreshold
&&
nv
<
PolicyConfiguration
.
HostDrainThreshold
{
Transition
(
EventHostOff
)
}
...
...