Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hmyOreCZML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
houmingyang
hmyOreCZML
Commits
5b243d7f
Commit
5b243d7f
authored
1 month ago
by
houmingyang
Browse files
Options
Downloads
Patches
Plain Diff
1.try to fix the single pair of satellites Inter-Visu
2.sorry for adding the TimeData class
parent
2fde9e17
No related branches found
No related tags found
No related merge requests found
Pipeline
#7719
failed
1 month ago
Stage: build
Stage: test
Stage: publish
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
oreczml-core/src/main/java/org/orekit/czml/object/primary/visu/InterSatVisu.java
+239
-8
239 additions, 8 deletions
...ava/org/orekit/czml/object/primary/visu/InterSatVisu.java
with
239 additions
and
8 deletions
oreczml-core/src/main/java/org/orekit/czml/object/primary/visu/InterSatVisu.java
+
239
−
8
View file @
5b243d7f
...
@@ -188,6 +188,14 @@ public class InterSatVisu extends AbstractPrimaryObject {
...
@@ -188,6 +188,14 @@ public class InterSatVisu extends AbstractPrimaryObject {
* ALl the booleans of the constellation, ordered by pairs of satellites.
* ALl the booleans of the constellation, ordered by pairs of satellites.
*/
*/
private
List
<
List
<
Boolean
>>
booleansList
=
new
ArrayList
<>();
private
List
<
List
<
Boolean
>>
booleansList
=
new
ArrayList
<>();
/**
* hmy: TimeDataList of Visu or not --Only for single pair of satellites.
*/
private
static
List
<
TimeData
>
timeDataList
=
new
ArrayList
<>();
/**
* hmy: the new “booleanList” for Visu or not --Only for single pair of satellites.
*/
private
static
List
<
Boolean
>
boolDataList
=
new
ArrayList
<>();
/**
/**
* All the booleans to know if whether to display the line, ordered by pairs of satellites.
* All the booleans to know if whether to display the line, ordered by pairs of satellites.
...
@@ -263,16 +271,27 @@ public class InterSatVisu extends AbstractPrimaryObject {
...
@@ -263,16 +271,27 @@ public class InterSatVisu extends AbstractPrimaryObject {
.
toArray
(
new
Reference
[
0
]);
.
toArray
(
new
Reference
[
0
]);
this
.
references
=
convertToIterable
(
referenceList
);
this
.
references
=
convertToIterable
(
referenceList
);
this
.
propagationInterSat
(
finalDate
,
satellite1Input
,
satellite2Input
,
header
);
//this.propagationInterSat(finalDate, satellite1Input, satellite2Input, header);
this
.
propagationInterSat_hmy
(
startDate
,
finalDate
,
satellite1Input
,
satellite2Input
);
//this.singleTimeIntervalsOfVisu = this.buildIntervals(datesWhenVisu, datesWhenNotVisu, header);
this
.
singleTimeIntervalsOfVisu
=
this
.
buildIntervals_hmy
(
startDate
,
finalDate
,
timeDataList
,
header
);
System
.
out
.
println
(
"timeDataList:"
);
for
(
TimeData
timeData
:
timeDataList
)
{
System
.
out
.
println
(
timeData
);
}
this
.
singleTimeIntervalsOfVisu
=
this
.
buildIntervals
(
datesWhenVisu
,
datesWhenNotVisu
,
header
);
this
.
polyline
=
Polyline
.
nonVectorBuilder
(
header
)
this
.
polyline
=
Polyline
.
nonVectorBuilder
(
header
)
.
withFirstReference
(
referenceFirstSatellite
)
.
withFirstReference
(
referenceFirstSatellite
)
.
withSecondReference
(
referenceSecondSatellite
)
.
withSecondReference
(
referenceSecondSatellite
)
.
build
();
.
build
();
this
.
showList
=
this
.
buildShowList
(
singleTimeIntervalsOfVisu
,
booleanList
);
//this.showList = this.buildShowList(singleTimeIntervalsOfVisu, booleanList);
this
.
stopDate
=
DateUtils
.
toAbsoluteDate
(
header
.
getAvailability
()
this
.
showList
=
this
.
buildShowList
(
singleTimeIntervalsOfVisu
,
boolDataList
);
.
getStop
(),
header
.
getTimeScale
());
System
.
out
.
println
(
"showList:\n"
+
showList
);
this
.
stopDate
=
DateUtils
.
toAbsoluteDate
(
header
.
getAvailability
().
getStop
(),
header
.
getTimeScale
());
}
}
/**
/**
...
@@ -757,6 +776,38 @@ public class InterSatVisu extends AbstractPrimaryObject {
...
@@ -757,6 +776,38 @@ public class InterSatVisu extends AbstractPrimaryObject {
boundedPropagatorSat1
.
propagate
(
startDateTemp
,
finalDate
);
boundedPropagatorSat1
.
propagate
(
startDateTemp
,
finalDate
);
}
}
/**
* Propagate the satellites within a specified time range and detect direct line-of-sight between them.
* This method analyzes the relative positions of two satellites by setting up an event detector to determine if they can see each other directly.
*
* @param StartDate The start date for line-of-sight detection
* @param finalDate The end date for line-of-sight detection
* @param satellite1Input The first satellite used to calculate its relative position with the second satellite
* @param satellite2Input The second satellite used in the relative position calculation with the first satellite
*/
private
void
propagationInterSat_hmy
(
final
AbsoluteDate
StartDate
,
final
AbsoluteDate
finalDate
,
final
Spacecraft
satellite1Input
,
final
Spacecraft
satellite2Input
)
{
// Obtain the bounded propagator for the first satellite
final
BoundedPropagator
boundedPropagatorSat1
=
satellite1Input
.
getSpacecraftBoundedPropagator
();
// Obtain the bounded propagator for the second satellite
final
BoundedPropagator
boundedPropagatorSat2
=
satellite2Input
.
getSpacecraftBoundedPropagator
();
// Create an instance of the handler for inter-satellite visibility events
final
InterSatViewHandler_hmy
hmyhandler
=
new
InterSatViewHandler_hmy
();
// Create and configure the direct line-of-sight detector for inter-satellite visibility, associating it with the second satellite's bounded propagator and the event handler
final
InterSatDirectViewDetector
detector
=
new
InterSatDirectViewDetector
(
this
.
getBody
(),
boundedPropagatorSat2
)
.
withHandler
(
hmyhandler
);
// Add the line-of-sight detector to the first satellite's bounded propagator to detect visibility events during propagation
boundedPropagatorSat1
.
addEventDetector
(
detector
);
// Propagate the first satellite's bounded propagator within the specified time range to perform line-of-sight detection and handle events
boundedPropagatorSat1
.
propagate
(
StartDate
,
finalDate
);
}
/**
/**
* Add detectors at each propagator of each satellite to detect the inter-sat view.
* Add detectors at each propagator of each satellite to detect the inter-sat view.
* Then this function propagates those propagators to the final date.
* Then this function propagates those propagators to the final date.
...
@@ -919,6 +970,67 @@ public class InterSatVisu extends AbstractPrimaryObject {
...
@@ -919,6 +970,67 @@ public class InterSatVisu extends AbstractPrimaryObject {
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
/**
* Builds a list of time intervals based on the given start date, end date, and list of time data.
* This method calculates the time intervals and their visibility based on specific conditions.
*
* @param startDate The starting date of the entire time range.
* @param finalDate The ending date of the entire time range.
* @param timeDataList A list containing time data, each including a date and associated event data.
* @param headerInput Header information, used to determine the time scale for date conversion.
* @return Returns a list of time intervals.
*/
private
List
<
TimeInterval
>
buildIntervals_hmy
(
AbsoluteDate
startDate
,
AbsoluteDate
finalDate
,
List
<
TimeData
>
timeDataList
,
final
Header
headerInput
)
{
final
List
<
TimeInterval
>
toReturn
=
new
ArrayList
<>();
// If the time list is empty, add an invisible event
if
(
timeDataList
.
isEmpty
())
{
toReturn
.
add
(
new
TimeInterval
(
DateUtils
.
toJulianDate
(
startDate
,
headerInput
.
getTimeScale
()),
DateUtils
.
toJulianDate
(
finalDate
,
headerInput
.
getTimeScale
()))
);
boolDataList
.
add
(
false
);
return
toReturn
;
}
// Handle the first event
if
(!
timeDataList
.
get
(
0
).
getData
().
contains
(
"s"
))
{
timeDataList
.
add
(
0
,
new
TimeData
(
startDate
,
"s"
));
}
// Handle the last event
if
(!
timeDataList
.
get
(
timeDataList
.
size
()
-
1
).
getData
().
contains
(
"e"
))
{
timeDataList
.
add
(
new
TimeData
(
finalDate
,
"e"
));
}
// Add checks to make sure :
// the “first event” and “last event” are from the “start time” to the “end time”
if
(
timeDataList
.
get
(
0
).
getDate
().
durationFrom
(
startDate
)
>
0
)
{
timeDataList
.
add
(
0
,
new
TimeData
(
startDate
,
"s"
));
}
if
(
timeDataList
.
get
(
timeDataList
.
size
()
-
1
).
getDate
().
durationFrom
(
finalDate
)
<
0
)
{
timeDataList
.
add
(
new
TimeData
(
finalDate
,
"e"
));
}
// Build a list of intervals and process them in pairs.
// It only needs to be checked to the penultimate (i < timeDataList.size() - 1)
// as each event has to check itself and the next.
for
(
int
i
=
0
;
i
<
timeDataList
.
size
()
-
1
;
i
++)
{
TimeData
current
=
timeDataList
.
get
(
i
);
TimeData
next
=
timeDataList
.
get
(
i
+
1
);
toReturn
.
add
(
new
TimeInterval
(
DateUtils
.
toJulianDate
(
current
.
getDate
(),
headerInput
.
getTimeScale
()),
DateUtils
.
toJulianDate
(
next
.
getDate
(),
headerInput
.
getTimeScale
()))
);
boolean
isVisible
=
current
.
getData
().
contains
(
"s"
)
&&
next
.
getData
().
contains
(
"e"
);
boolDataList
.
add
(
isVisible
);
}
return
toReturn
;
}
/**
/**
* This function aims at building the list of boolean and of time interval from two lists of start and stop date.
* This function aims at building the list of boolean and of time interval from two lists of start and stop date.
* Those lists represent the dates when satellites start and stop to see each other.
* Those lists represent the dates when satellites start and stop to see each other.
...
@@ -1067,6 +1179,53 @@ public class InterSatVisu extends AbstractPrimaryObject {
...
@@ -1067,6 +1179,53 @@ public class InterSatVisu extends AbstractPrimaryObject {
}
}
}
}
/**
* Inner class InterSatViewHandler_hmy implements the EventHandler interface to handle inter-satellite visibility events.
*/
private
static
class
InterSatViewHandler_hmy
implements
EventHandler
{
/**
* Initialization method called before handling visibility events.
*
* @param initialState The initial state of the spacecraft, containing all necessary information before event handling begins.
* @param target The target date indicating the endpoint for visibility event handling.
* @param detector The event detector used to determine the occurrence of visibility events.
*/
@Override
public
void
init
(
final
SpacecraftState
initialState
,
final
AbsoluteDate
target
,
final
EventDetector
detector
)
{
// Determine if visibility exists at the initial moment
final
double
g
=
detector
.
g
(
initialState
);
final
boolean
visible
=
g
>=
0
;
// Clear previous visibility event data and prepare to collect new event data
boolDataList
.
clear
();
timeDataList
.
clear
();
if
(
visible
)
{
// Add initial time data, marking the start of visibility event handling
timeDataList
.
add
(
new
TimeData
(
initialState
.
getDate
(),
"s"
));
}
}
/**
* Method called when a visibility event occurs, taking actions based on whether the event is increasing or decreasing.
*
* @param s The current state of the spacecraft, containing all necessary information at the event occurrence.
* @param detector The event detector used to determine the occurrence of visibility events.
* @param increasing Boolean indicating whether the event is increasing or decreasing.
* @return Action.CONTINUE to indicate that event detection should continue.
*/
@Override
public
Action
eventOccurred
(
final
SpacecraftState
s
,
final
EventDetector
detector
,
final
boolean
increasing
)
{
// Add time data based on whether the visibility event is starting or ending
if
(
increasing
)
{
timeDataList
.
add
(
new
TimeData
(
s
.
getDate
(),
"s"
));
}
else
{
timeDataList
.
add
(
new
TimeData
(
s
.
getDate
(),
"e"
));
}
// Continue event detection
return
Action
.
CONTINUE
;
}
}
/**
/**
* This class was designed to handle the inter-sat view between satellites of a constellation.
* This class was designed to handle the inter-sat view between satellites of a constellation.
* It will build a time span map of boolean that will group the time intervals and the boolean corresponding to the
* It will build a time span map of boolean that will group the time intervals and the boolean corresponding to the
...
@@ -1111,3 +1270,75 @@ public class InterSatVisu extends AbstractPrimaryObject {
...
@@ -1111,3 +1270,75 @@ public class InterSatVisu extends AbstractPrimaryObject {
.
iterator
();
.
iterator
();
}
}
}
}
/**
* Class TimeData is used to store data information associated with a specific time point.
* Because I am not familiar with the TimeSpanMap class and am afraid of making mistakes with it,
* The List of TimeData should theoretically be about the same as TimeSpanMap
*/
class
TimeData
{
// Date and time, represented using the AbsoluteDate type
private
AbsoluteDate
date
;
// Data content, stored as a string
private
String
data
;
/**
* Constructor to create and initialize a TimeData object.
*
* @param date The date and time
* @param data The data content
*/
public
TimeData
(
AbsoluteDate
date
,
String
data
)
{
this
.
date
=
date
;
this
.
data
=
data
;
}
/**
* Gets the date and time.
*
* @return The date and time object
*/
public
AbsoluteDate
getDate
()
{
return
date
;
}
/**
* Sets the date and time.
*
* @param date The date and time object
*/
public
void
setDate
(
AbsoluteDate
date
)
{
this
.
date
=
date
;
}
/**
* Gets the data content.
*
* @return The data content string
*/
public
String
getData
()
{
return
data
;
}
/**
* Sets the data content.
*
* @param data The data content string
*/
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
/**
* Overrides the toString method to provide a string representation of the TimeData object for easy printing.
*
* @return A string representation of the TimeData object
*/
@Override
public
String
toString
()
{
return
"TimeData{"
+
"time="
+
date
+
", data='"
+
data
+
'\''
+
'}'
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment