Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Math.floor when calcNextEventTick for charging entities #1257

Merged
merged 6 commits into from
Mar 11, 2025

Conversation

danielfeismann
Copy link
Member

resolves #1256

@danielfeismann danielfeismann added the enhancement New feature or request label Mar 10, 2025
@danielfeismann danielfeismann self-assigned this Mar 10, 2025
@danielfeismann danielfeismann marked this pull request as ready for review March 10, 2025 16:40
Copy link
Member

@sebastian-peter sebastian-peter left a comment

Choose a reason for hiding this comment

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

Thanks for the discussion and the initiative.

Found some more examples that we should adapt at the same time:

val duration = (maxEnergyThreshold - updatedEnergy) / qDot
val durationInTicks = Math.round(duration.toSeconds)

val duration = updatedEnergy / qDot * (-1)
val durationInTicks = Math.round(duration.toSeconds)

val duration = Math.round(
(flexibleEnergy / (qDot * math.signum(qDot.toWatts))).toSeconds
)
Some(tick + duration)

Copy link
Member

@sebastian-peter sebastian-peter left a comment

Choose a reason for hiding this comment

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

Sorry, didn't realize that many tests needed to be adapted. Thanks though

@sebastian-peter sebastian-peter merged commit 9718adb into dev Mar 11, 2025
4 checks passed
@sebastian-peter sebastian-peter deleted the df/#1256-use-math-floor branch March 11, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Math.floor when calcNextEventTick for charging entities
2 participants