-
Notifications
You must be signed in to change notification settings - Fork 43
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
Switch TimeSeries to nanosecond precision #3281
Merged
Merged
Conversation
This file contains 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
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
# Conflicts: # time-series/time-series-api/src/main/java/com/powsybl/timeseries/IrregularTimeSeriesIndex.java # time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeries.java # time-series/time-series-api/src/test/java/com/powsybl/timeseries/TimeSeriesTest.java
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
olperr1
requested changes
Jan 28, 2025
time-series/time-series-api/src/main/java/com/powsybl/timeseries/InfiniteTimeSeriesIndex.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/IrregularTimeSeriesIndex.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/IrregularTimeSeriesIndex.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/IrregularTimeSeriesIndex.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/RegularTimeSeriesIndex.java
Outdated
Show resolved
Hide resolved
...-series/time-series-api/src/test/java/com/powsybl/timeseries/RegularTimeSeriesIndexTest.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/test/java/com/powsybl/timeseries/TimeSeriesTest.java
Show resolved
Hide resolved
time-series/time-series-api/src/test/java/com/powsybl/timeseries/TimeSeriesTest.java
Show resolved
Hide resolved
...e-series-dsl/src/test/java/com/powsybl/timeseries/dsl/CalculatedTimeSeriesGroovyDslTest.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeriesTable.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Lisrte
reviewed
Jan 29, 2025
time-series/time-series-api/src/main/java/com/powsybl/timeseries/DoublePoint.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/StringPoint.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
olperr1
requested changes
Feb 3, 2025
time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeries.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeries.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/IrregularTimeSeriesIndex.java
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/RegularTimeSeriesIndex.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
olperr1
requested changes
Feb 7, 2025
time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeries.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeries.java
Outdated
Show resolved
Hide resolved
time-series/time-series-api/src/main/java/com/powsybl/timeseries/TimeSeries.java
Show resolved
Hide resolved
time-series/time-series-api/src/test/java/com/powsybl/timeseries/TimeSeriesTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
Signed-off-by: Nicolas Rol <[email protected]>
olperr1
approved these changes
Feb 10, 2025
Lisrte
approved these changes
Feb 10, 2025
Quality Gate passedIssues Measures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Feature
What is the current behavior?
TimeSeries time precision is currently limited to millisecond.
TimeSeries internal time values are stored in a Long variable.
What is the new behavior (if this is a feature change)?
TimeSeries time precision is now limited to nanosecond.
TimeSeries internal time values are stored in an Instant variable (using a long for second precision + an int for the second to nano precision).
Micro and Nano TimeFormat have been added.
By default, the new methods that have a TimeFormat parameter uses TimeFormat.MILLIS to keep backward compatibility.
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
The interface
TimeSeriesIndex
has new methods that you have to implement, should you implement this interface:void writeJson(JsonGenerator generator, TimeSeries.TimeFormat format)
String toJson(TimeSeries.TimeFormat format)
Since time is now managed by using Instant instead of long variables, a few methods have been deprecated and will be removed in a future release:
TimeSeriesIndex
and all classes implementing this interfacelong getTimeAt(int point)
Instant getInstantAt(int point)
AbstractPoint
and all classes extending this abstract classpublic long getTime()
public Instant getInstant()
IrregularTimeSeriesIndex
public IrregularTimeSeriesIndex(long[] times)
public IrregularTimeSeriesIndex(Instant[] instants)
RegularTimeSeriesIndex
public RegularTimeSeriesIndex(long startTime, long endTime, long spacing)
public RegularTimeSeriesIndex(Instant startInstant, Instant endInstant, Duration timeStep)
RegularTimeSeriesIndex
public long getStartTime()
public Instant getStartInstant()
RegularTimeSeriesIndex
public long getEndTime()
public Instant getEndInstant()
RegularTimeSeriesIndex
public long getSpacing()
public Instant getTimeStep()
DoublePoint
public DoublePoint(int index, long time, double value)
public DoublePoint(int index, Instant instant, double value)
StringPoint
public StringPoint(int index, long time, String value)
public StringPoint(int index, Instant instant, String value)
Following the change of underlying date-time variable format (from
long
toInstant
), theTimeSeriesIndex.toJson
andTimeSeriesIndex.writeJson
exported formats have been changed to allow nano-second precision while keeping the backward compatibility, thanks to a new enumTimeSeriesIndex.ExportFormat
:timeFormat = TimeSeriesIndex.ExportFormat.MILLISECONDS
(default value) for backward compatibility:timeFormat = TimeSeriesIndex.ExportFormat.NANOSECONDS
:Other information: