-
Notifications
You must be signed in to change notification settings - Fork 60
feat(charging): provide the charging stations within a certain area #446
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
Merged
schwepmo
merged 20 commits into
eclipse-mosaic:main
from
iwillitried:950-Provide-Charging-Stations-around-a-GeoPoint
Feb 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e934a58
provide the charging stations within a certain area
iwillitried 434bb9a
ChargingStations discovery is synchronous (related to mosaic-extended…
iwillitried b7ad846
resolving pull request issues
iwillitried 83137fa
Merge branch 'main' into 950-Provide-Charging-Stations-around-a-GeoPoint
iwillitried a0cf89b
- Removed the file: ChargingStationTree.java
iwillitried 0d05e63
resolving PR issues
iwillitried fb7ce5a
Fixing Unit tests: ApplicationAmbassadorTest.processInteraction_Charg…
iwillitried a94ffd6
fixing PR issues
iwillitried d64cf82
- implement lazy updates in ChargingStationIndex.java, tree is re-con…
iwillitried 488b5d4
resolving PR issues
iwillitried 8a48060
reformatted UnitTest for ChargingStationIndex, removed extra Charging…
iwillitried f730cad
removed SimulationKernel from CharginStationIndexTest
iwillitried dc16cba
Fixing unit test issue, ChargingStationIndex checks for position chan…
iwillitried 4792814
added assertion to ChargingStationIndexTest
iwillitried ec42a2d
fixing checksyle and spotbugs
iwillitried 46f0d8b
fixing checkstyle warnings
iwillitried 7d39633
fixing PR issues
iwillitried c38d3bd
remove white line
iwillitried c20714b
changed comment
iwillitried 5d45207
reverted file
iwillitried File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,4 +65,5 @@ buildNumber.properties | |
*.log | ||
credentials.cached | ||
*.lcs | ||
.tiles | ||
.tiles | ||
/logs/ |
schwepmo marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...in/java/org/eclipse/mosaic/interactions/electricity/ChargingStationDiscoveryResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (c) 2024 Fraunhofer FOKUS and others. All rights reserved. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contact: [email protected] | ||
*/ | ||
|
||
package org.eclipse.mosaic.interactions.electricity; | ||
|
||
import static org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE; | ||
|
||
import org.eclipse.mosaic.lib.objects.electricity.ChargingStationData; | ||
import org.eclipse.mosaic.rti.api.Interaction; | ||
|
||
import org.apache.commons.lang3.builder.EqualsBuilder; | ||
import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* An {@link Interaction} that contains a list of {@link ChargingStationData} objects as a response to a {@link VehicleChargingStationDiscoveryRequest}. | ||
*/ | ||
public class ChargingStationDiscoveryResponse extends Interaction { | ||
public ChargingStationDiscoveryResponse(long time, String vehicleId, Collection<ChargingStationData> chargingStations) { | ||
super(time); | ||
|
||
this.chargingStations = chargingStations; | ||
this.vehicleId = vehicleId; | ||
} | ||
|
||
/** | ||
* String identifying the type of this interaction. | ||
*/ | ||
public static final String TYPE_ID = createTypeIdentifier(ChargingStationDiscoveryResponse.class); | ||
|
||
/** | ||
* The queried list {@link ChargingStationData} originating from the {@link VehicleChargingStationDiscoveryRequest}. | ||
*/ | ||
private final Collection<ChargingStationData> chargingStations; | ||
|
||
/** | ||
* The ID of the requesting vehicle. | ||
*/ | ||
private final String vehicleId; | ||
|
||
public String getVehicleId() { | ||
return vehicleId; | ||
} | ||
|
||
public Collection<ChargingStationData> getChargingStations() { | ||
return chargingStations; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return new HashCodeBuilder(9, 97) | ||
kschrab marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.append(vehicleId) | ||
.append(chargingStations) | ||
.toHashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (obj == this) { | ||
return true; | ||
} | ||
if (obj.getClass() != getClass()) { | ||
return false; | ||
} | ||
|
||
ChargingStationDiscoveryResponse other = (ChargingStationDiscoveryResponse) obj; | ||
return new EqualsBuilder() | ||
.append(this.vehicleId, other.vehicleId) | ||
.append(this.chargingStations, other.chargingStations) | ||
.isEquals(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this, SHORT_PREFIX_STYLE) | ||
.appendSuper(super.toString()) | ||
.append("vehicleId", vehicleId) | ||
.append("chargingStations", chargingStations.stream().map(ChargingStationData::toString)) | ||
.toString(); | ||
} | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
...a/org/eclipse/mosaic/interactions/electricity/VehicleChargingStationDiscoveryRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright (c) 2024 Fraunhofer FOKUS and others. All rights reserved. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contact: [email protected] | ||
*/ | ||
|
||
package org.eclipse.mosaic.interactions.electricity; | ||
|
||
import static org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE; | ||
|
||
import org.eclipse.mosaic.lib.geo.GeoCircle; | ||
import org.eclipse.mosaic.rti.api.Interaction; | ||
|
||
import org.apache.commons.lang3.builder.EqualsBuilder; | ||
import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
|
||
import java.io.Serial; | ||
|
||
/** | ||
* An {@link Interaction} used by electric vehicles to find charging stations ({@link org.eclipse.mosaic.lib.objects.electricity.ChargingStationData}) in a certain area. | ||
*/ | ||
public class VehicleChargingStationDiscoveryRequest extends Interaction { | ||
public VehicleChargingStationDiscoveryRequest(long time, String vehicleId, GeoCircle searchArea) { | ||
super(time); | ||
|
||
this.vehicleId = vehicleId; | ||
this.searchArea = searchArea; | ||
} | ||
|
||
@Serial | ||
private static final long serialVersionUID = 1L; | ||
schwepmo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* String identifying the type of this interaction. | ||
*/ | ||
public static final String TYPE_ID = createTypeIdentifier(VehicleChargingStationDiscoveryRequest.class); | ||
|
||
/** | ||
* String identifying the vehicle sending this interaction. | ||
*/ | ||
private final String vehicleId; | ||
|
||
/** | ||
* An area given by a point and a radius in which the requested {@link org.eclipse.mosaic.lib.objects.electricity.ChargingStationData} objects are. | ||
*/ | ||
private final GeoCircle searchArea; | ||
|
||
public String getVehicleId() { | ||
return vehicleId; | ||
} | ||
|
||
public GeoCircle getSearchArea() { | ||
return searchArea; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return new HashCodeBuilder(9, 97) | ||
.append(vehicleId) | ||
.append(searchArea) | ||
.toHashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (obj == this) { | ||
return true; | ||
} | ||
if (obj.getClass() != getClass()) { | ||
return false; | ||
} | ||
|
||
VehicleChargingStationDiscoveryRequest other = (VehicleChargingStationDiscoveryRequest) obj; | ||
return new EqualsBuilder() | ||
.append(this.vehicleId, other.vehicleId) | ||
.append(this.searchArea, other.searchArea) | ||
.isEquals(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this, SHORT_PREFIX_STYLE) | ||
.appendSuper(super.toString()) | ||
.append("vehicleId", vehicleId) | ||
.append("searchArea", searchArea) | ||
.toString(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.