Skip to content

Commit

Permalink
py: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Aug 29, 2024
1 parent 256a566 commit e0a9267
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ text = "MIT"
[project]
name = "thermostat"
# Note: keep this in sync with Cargo.toml
version = "0.2.0"
version = "0.3.0"
description = "Utilities for configuring Thermostat-EEM"
authors = [
{ name = "Robert Jördens", email = "[email protected]" },
{ name = "Norman Krackow", email = "[email protected]" },
]
dependencies = [
"miniconf-mqtt@git+https://github.com/quartiq/[email protected]#subdirectory=py/miniconf-mqtt",
"stabilizer@git+https://github.com/quartiq/stabilizer@8156a764#subdirectory=py",
"stabilizer@git+https://github.com/quartiq/stabilizer@v0.10.0#subdirectory=py",
]

[project.urls]
Expand Down
23 changes: 12 additions & 11 deletions py/thermostat/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _main():
parser.add_argument(
"--setpoint",
type=float,
default=0,
default=25.0,
help="The channel output offset (%(default)s A)",
)
parser.add_argument(
Expand All @@ -84,7 +84,7 @@ def _main():
parser.add_argument(
"--voltage-limit",
type=float,
default=1,
default=5.0,
help="Channel voltage limit (%(default)s V)",
)

Expand All @@ -109,13 +109,13 @@ def _main():
parser.add_argument(
"--li",
type=float,
default=1e20,
default=1e30,
help="Integrator limit (%(default)s A/K)",
)
parser.add_argument(
"--ld",
type=float,
default=1e20,
default=1e30,
help="Derivative limit (%(default)s A/K)",
)

Expand Down Expand Up @@ -144,15 +144,16 @@ async def run():
thermostat = Miniconf(client, prefix)

# TODO: sequence!
for k in "min max setpoint ki kp kd li ld".split():
await thermostat.set(
f"/output/{args.output}/pid/{k}",
getattr(args, k),
)
for k in "state voltage_limit weights".split():
await thermostat.set(
f"/output/{args.output}/state",
"Hold",
)
for (
k
) in "pid/min pid/max pid/setpoint pid/ki pid/kp pid/kd pid/li pid/ld voltage_limit weights state".split():
await thermostat.set(
f"/output/{args.output}/{k}",
getattr(args, k),
getattr(args, k.split("/")[-1]),
)

asyncio.run(run())
Expand Down

0 comments on commit e0a9267

Please sign in to comment.