Skip to content

Commit

Permalink
Fix scheduling at evcs with more than one ev at a time without em (#788)
Browse files Browse the repository at this point in the history
* fix exception message

* determine evcs results also in case of arriving evs to ensure correct result entries

* add additionalActivationTick for the end of simulation to get result entries for evcs

* changelog

* add test case for charging three evs at same time and deliver proper results for it

* remove unnecessary change

* fix results for evs

* fmt

* groupby

* newActiveEntries at EvcsModel

* update stayingSchedules at EvcsAgentFundamentals

* update stayingSchedules at EvcsAgentFundamentals

* add tickStart to filter condition

* fix test condition

* remove unused method

* revert change

* reintroduce explaining comment

* rollback startingSchedules

* reintroduce new determination of schedules

* test for provide correct results for three evs charging at same time at EvcsAgent

* fix naming to comply with codacy

* fmt

* revert test case result

* fmt

* fmt

* fix comment

* explanatory comments

* sync tests at EvcsAgentModelCalculationSpec

* some more test changes

* fix test cases

* fmt

* rollback changes of EvcsModelSpec

* little refactoring

* fmt

* fmt

* Adapting to changes in simonaAPI

Signed-off-by: Sebastian Peter <[email protected]>

* Assigning recognizable UUIDs for test EVs

Signed-off-by: Sebastian Peter <[email protected]>

* remove unnecessary EvcsModel in EvcsInputTestData

* rollback changes of entriesByStartTick at EvcsModel

* fmt

* fmt

* rollback unnecessary change of filtering schedules for tick

* fmt

* entriesByStartTick as sortedMap

* only handle results at handleArrivingEvs when there is no state for the currentTick

* rearrange EvcsAgentModelCalculationSpec results

* Suggestion for result matching

Signed-off-by: Sebastian Peter <[email protected]>

* refactor EvcsResult testing

* refactor EvResult testing

* Undo line deletion

Signed-off-by: Sebastian Peter <[email protected]>

* rollback filter of results of evcs model

* make EvcsModel.chargeEv private again

* update exception message

* fmt

* remove blank cases when testing for expected messages of resultListener

---------

Signed-off-by: Sebastian Peter <[email protected]>
Co-authored-by: Sebastian Peter <[email protected]>
  • Loading branch information
danielfeismann and sebastian-peter authored Sep 26, 2024
1 parent c6e546f commit a8be401
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix expected secondaryData in baseStateData [#955](https://github.com/ie3-institute/simona/issues/955)
- Improve code quality in fixedloadmodelspec and other tests [#919](https://github.com/ie3-institute/simona/issues/919)
- Fix power flow calculation with em agents [#962](https://github.com/ie3-institute/simona/issues/962)
- Fix scheduling at Evcs with more than one Ev at a time without Em [#787](https://github.com/ie3-institute/simona/issues/787)

## [3.0.0] - 2023-08-07

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import squants.{Dimensionless, Each, Power}

import java.time.ZonedDateTime
import java.util.UUID
import scala.collection.SortedSet
import scala.collection.immutable.SortedSet
import scala.reflect.{ClassTag, classTag}

protected trait EvcsAgentFundamentals
Expand Down Expand Up @@ -494,9 +494,10 @@ protected trait EvcsAgentFundamentals
val relevantData =
createCalcRelevantData(modelBaseStateData, tick)

val lastState = getLastOrInitialStateData(modelBaseStateData, tick)

val updatedBaseStateData = {
if (relevantData.arrivals.nonEmpty) {
val lastState = getLastOrInitialStateData(modelBaseStateData, tick)

val currentEvs = modelBaseStateData.model.determineCurrentEvs(
relevantData,
Expand Down Expand Up @@ -528,6 +529,15 @@ protected trait EvcsAgentFundamentals
modelBaseStateData
}

// if the lastState's tick is the same as the actual tick the results have already been determined and announced when we handled the departedEvs
if (lastState.tick != tick) {
determineResultsAnnounceUpdateValueStore(
lastState,
currentTick,
modelBaseStateData,
)
}

// We're only here if we're not flex-controlled, thus sending a Completion is always right
goToIdleReplyCompletionAndScheduleTriggerForNextAction(
updatedBaseStateData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import edu.ie3.simona.model.participant.evcs.uncontrolled.{
ConstantPowerCharging,
MaximumPowerCharging,
}
import edu.ie3.util.scala.quantities.DefaultQuantities._
import edu.ie3.simona.model.participant.{
CalcRelevantData,
FlexChangeIndicator,
Expand All @@ -32,7 +31,8 @@ import edu.ie3.simona.util.TickUtil.TickLong
import edu.ie3.util.quantities.PowerSystemUnits._
import edu.ie3.util.quantities.QuantityUtils.RichQuantityDouble
import edu.ie3.util.scala.OperationInterval
import squants.energy.{KilowattHours, Kilowatts}
import edu.ie3.util.scala.quantities.DefaultQuantities._
import squants.energy.Kilowatts
import squants.time.Seconds
import squants.{Dimensionless, Energy, Power}
import tech.units.indriya.unit.Units.PERCENT
Expand Down Expand Up @@ -514,13 +514,17 @@ final case class EvcsModel(
modelState: EvcsState,
data: EvcsRelevantData,
): ApparentPower =
throw new NotImplementedError("Use calculatePowerAndEvSoc() instead.")
throw new NotImplementedError(
"Use calculateNewScheduling() or chargeEv() instead."
)

override protected def calculateActivePower(
modelState: EvcsState,
data: EvcsRelevantData,
): Power =
throw new NotImplementedError("Use calculatePowerAndEvSoc() instead.")
throw new NotImplementedError(
"Use calculateNewScheduling() or chargeEv() instead."
)

override def determineFlexOptions(
data: EvcsRelevantData,
Expand Down
Loading

0 comments on commit a8be401

Please sign in to comment.