Skip to content

Commit

Permalink
start current with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseklm committed Oct 24, 2024
1 parent f271a40 commit 51715e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ name: Docker
# documentation.

on:
schedule:
- cron: '35 20 * * *'
# schedule:
# - cron: '35 20 * * *'
push:
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
tags: [ '*.*.*' ]
pull_request:
branches: [ "master" ]

Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
2 changes: 1 addition & 1 deletion battery_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, number_of_modules: int, number_of_serial_cells: int) -> None:
self.voltage_limits.warning_upper = cells_total * BatteryCell.UPPER_VOLTAGE_LIMIT_WARNING

self.voltage: Measurement = Measurement(self, self.voltage_limits)
self.current: Measurement = Measurement(self, self.current_limits)
self.current: Measurement = Measurement(self, self.current_limits, 0)

self.battery_modules: List[BatteryModule] = []
for module_id in range(0, number_of_modules):
Expand Down
20 changes: 10 additions & 10 deletions measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ class MeasurementEvent(Events):

class MeasurementLimits:
def __init__(self):
self.warning_upper: float or None = None
self.warning_lower: float or None = None
self.critical_upper: float or None = None
self.critical_lower: float or None = None
self.implausible_upper: float or None = None
self.implausible_lower: float or None = None
self.warning_upper: float | None = None
self.warning_lower: float | None = None
self.critical_upper: float | None = None
self.critical_lower: float | None = None
self.implausible_upper: float | None = None
self.implausible_lower: float | None = None


class Measurement:
def __init__(self, owner, limits: MeasurementLimits):
self.value: float or None = None
self.timestamp: float or None = None
def __init__(self, owner, limits: MeasurementLimits, start_value: float | None = None):
self.value: float | None = start_value
self.timestamp: float | None = None
self.init = False
self.owner = owner
self.limits = limits
Expand Down Expand Up @@ -66,4 +67,3 @@ def initialized(self) -> bool:

def age_seconds(self) -> float:
return time.time() - self.timestamp

0 comments on commit 51715e4

Please sign in to comment.