Skip to content

calc on time - #3777

Merged
LKuemmel merged 2 commits into
openWB:feature_consumerfrom
LKuemmel:consumer_dev
Aug 7, 2026
Merged

calc on time#3777
LKuemmel merged 2 commits into
openWB:feature_consumerfrom
LKuemmel:consumer_dev

Conversation

@LKuemmel

@LKuemmel LKuemmel commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates runtime (“on_time”) tracking for consumers to use actual elapsed time between updates, aligns surplus control configuration access to the chargemode_config.surplus section, and ensures consumers participate in hierarchy validation.

Changes:

  • Track consumer.set.on_time using timestamp deltas and persist a new set/timestamp_wrote_last_on_time field.
  • Include consumers when adding/removing missing/obsolete hierarchy entries.
  • Switch surplus feed-in limit/yield reads from chargemode_config.pv_charging to chargemode_config.surplus.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/helpermodules/setdata.py Accepts/validates the new consumer set-topic timestamp_wrote_last_on_time and adjusts consumer topic validation list.
packages/control/counter_all/hierarchy.py Ensures consumer components are added/removed during hierarchy validation.
packages/control/consumer/consumer.py Changes on-time accumulation to use real elapsed time and resets the new timestamp on on_time reset.
packages/control/consumer/consumer_data.py Adds timestamp_wrote_last_on_time to the consumer Set dataclass and publishes it via MQTT metadata.
packages/control/algorithm/surplus_controlled.py Reads feed-in limit/yield from chargemode_config.surplus instead of pv_charging.
Suppressed comments (1)

packages/control/consumer/consumer.py:85

  • process_on_time(): When charge_state transitions to False, timestamp_wrote_last_on_time is not reset. On the next True transition, the delta now - timestamp_wrote_last_on_time will include the entire off-time, inflating on_time.
        elif self.data.get.charge_state is False:
            self.data.control_parameter.timestamp_charge_start = None


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 74 to +78
def process_on_time(self):
if self.data.get.charge_state:
self.data.set.on_time += data.data.general_data.data.control_interval
now = timecheck.create_timestamp()
if self.data.set.timestamp_wrote_last_on_time is None:
self.data.set.timestamp_wrote_last_on_time = now
Comment on lines +103 to +104
timestamp_wrote_last_on_time: Optional[float] = field(
default=None, metadata={"topic": "set/timestamp_wrote_last_on_time"})
@LKuemmel
LKuemmel merged commit 17f8ab0 into openWB:feature_consumer Aug 7, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants