Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
47b1ca64
Commit
47b1ca64
authored
2 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
Added further model detail. TODO fix sendSinglePduDelayed thread handling since it is blocking...
parent
175b8d19
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java
+52
-19
52 additions, 19 deletions
...es/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java
with
52 additions
and
19 deletions
examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java
+
52
−
19
View file @
47b1ca64
...
@@ -2,6 +2,8 @@ package SimkitOpenDis7Examples;
...
@@ -2,6 +2,8 @@ package SimkitOpenDis7Examples;
import
edu.nps.moves.dis7.enumerations.DisPduType
;
import
edu.nps.moves.dis7.enumerations.DisPduType
;
import
edu.nps.moves.dis7.pdus.EntityStatePdu
;
import
edu.nps.moves.dis7.pdus.EntityStatePdu
;
import
edu.nps.moves.dis7.pdus.EulerAngles
;
import
edu.nps.moves.dis7.pdus.Vector3Double
;
import
edu.nps.moves.dis7.utilities.DisChannel
;
import
edu.nps.moves.dis7.utilities.DisChannel
;
import
edu.nps.moves.dis7.utilities.PduFactory
;
import
edu.nps.moves.dis7.utilities.PduFactory
;
import
java.util.SortedSet
;
import
java.util.SortedSet
;
...
@@ -22,7 +24,8 @@ import simkit.SimEntityBase;
...
@@ -22,7 +24,8 @@ import simkit.SimEntityBase;
*/
*/
public
class
TwoCraneBerthsOpenDis7
extends
SimEntityBase
public
class
TwoCraneBerthsOpenDis7
extends
SimEntityBase
{
{
private
final
DisChannel
disChannel
=
new
DisChannel
();
// Utility constructor method: initial descriptor and verboseness of disNetworkInterface, pduRecorder
private
final
DisChannel
disChannel
=
new
DisChannel
(
"TwoCraneBerthsOpenDis7"
,
false
,
true
);
/**
/**
* Queue of Ships waiting to go into the berth
* Queue of Ships waiting to go into the berth
...
@@ -185,52 +188,82 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase
...
@@ -185,52 +188,82 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase
waitDelay
(
"EndUnloadingOneCrane"
,
ship
.
getRemainingUnloadingTime
(),
ship
);
waitDelay
(
"EndUnloadingOneCrane"
,
ship
.
getRemainingUnloadingTime
(),
ship
);
}
}
PduFactory
pduFactory
=
new
PduFactory
();
// can be member variables (for efficiency, move above) or else embdedded within method (move below)
PduFactory
pduFactory
=
new
PduFactory
();
EntityStatePdu
espduCrane
=
(
EntityStatePdu
)
pduFactory
.
createPdu
(
DisPduType
.
ENTITY_STATE
);
/**
* Perform crane unloading operations and send PDUs to report progress
* @param numberContainers how many containers to offload
* @param positionOfCrane Y coordinate down pier across from ship's berth, aligned with cargo
*/
public
void
performCraneUnloadOperations
(
public
void
performCraneUnloadOperations
(
// which crane
// which crane
// which berth
// which berth
int
number
Of
Containers
,
int
numberContainers
,
double
positionOfCrane
double
positionOfCrane
// lenthOfCrane
// len
g
thOfCrane
)
)
{
{
// Pier coordinate system follows, Right-Hand Rule (RHR) throughout:
// +X axis to right with X=0 on centerline of pier (train tracks
// +Y axis down pier with Y=0 at head of pier,
// +Z axis vertical with Z=0 at level of pier
// phi is rotation about +X axis, radians
// theta is rotation about +Y axis, radians
// psi is rotation about +X axis, radians
double
craneLinearSpeed
=
1.0
;
// m/sec
double
craneLinearSpeed
=
1.0
;
// m/sec
double
craneRotationRate
=
10.0
;
// degrees/second
double
craneRotationRate
=
10.0
;
// degrees/second
double
containerHookupTime
=
60.0
;
// seconds average
double
containerHookupTime
=
60.0
;
// seconds average
double
containerDetachTime
=
30.0
;
// seconds average
double
containerDetachTime
=
30.0
;
// seconds average
Vector3Double
positionPierHead
=
new
Vector3Double
();
// Vector3Double positionPierHead = new Vector3Double(0.0, 0.0, 0.0); // TODO needs utility constructor
EntityStatePdu
espduCrane
=
(
EntityStatePdu
)
pduFactory
.
createPdu
(
DisPduType
.
ENTITY_STATE
);
// not modeling crane elevation angle, only orientation of crane cab and gantry
// 1. Crane at head of pier, operatior present, boom elevated vertically in stow postion
EulerAngles
orientationToShip
=
(
new
EulerAngles
()).
setPsi
((
float
)
(
90.0
*
Math
.
PI
/
180.0
));
// TODO utility methods needed
// espduCrane1.setPosition 0 0 0
EulerAngles
orientationToPier
=
(
new
EulerAngles
()).
setPsi
((
float
)
(
0.0
*
Math
.
PI
/
180.0
));
// TODO utility methods needed
// espduCrane.reset(); // TODO intialization utility method
// espduCrane.setEntityAppearance(TODO); // highlight active crane?
// 1. Crane at head of pier, operator present, boom elevated vertically in stow postion
// espduCrane.setEntityLocation(0.0, 0.0, 0.0); // ambiguous, error prone
espduCrane
.
setEntityLocation
(
positionPierHead
);
// preferred
// 2, Ship arrives, tug departs
// 2, Ship arrives, tug departs
// sh
o
p PDU here or
assum
it happened earlier
// sh
i
p PDU
could be sent
here
,
or
probably more logical to ensure
it happened earlier
// 3. Crane moves to position of ship
// 3. Crane moves to position of ship
espduCrane
.
setEntityLocation
(
positionOfCrane
,
0.0
,
0.0
);
espduCrane
.
setEntityLocation
(
positionOfCrane
,
0.0
,
0.0
);
// head of pier, ambiguous
// TODO compute travel time
// TODO compute travel time
// update: travel to positionOfCrane by craneLinearSpeed
// update: travel to positionOfCrane by craneLinearSpeed
// 4. repeat until done: Crane rotates, lift container, rotates, lower container
// 4. repeat until done: Crane rotates, lift container, rotates, lower container
for
(
int
containerIndex
=
1
;
containerIndex
<=
number
Of
Containers
;
containerIndex
++)
for
(
int
containerIndex
=
1
;
containerIndex
<=
numberContainers
;
containerIndex
++)
{
{
// perform one operation
// perform one operation
espduCrane
.
setEntityOrientation
(
0
,
0
,
0
);
espduCrane
.
setEntityOrientation
(
orientationToShip
);
disChannel
.
sendSinglePdu
(
espduCrane
);
disChannel
.
sendSinglePdu
(
espduCrane
);
espduCrane
.
setEntityOrientation
(
0
,
0
,
0
);
espduCrane
.
setEntityOrientation
(
orientationToPier
);
double
rotationDelay
=
90.0
/
craneRotationRate
;
double
rotationDelay
=
90.0
/
craneRotationRate
;
// units analysis: degrees / (degrees/second) = seconds
disChannel
.
sendCommentPdu
(
disChannel
.
COMMENTPDU_NARRATIVE
,
"Hooking up Container "
+
containerIndex
+
" to crane"
);
disChannel
.
sendCommentPdu
(
disChannel
.
COMMENTPDU_NARRATIVE
,
"Hooking up Container "
+
containerIndex
+
" to crane"
);
disChannel
.
sendSinglePduDelayed
(
containerHookupTime
,
espduCrane
);
// TODO fix sendSinglePduDelayed thread handling since it is blocking...
// disChannel.sendSinglePduDelayed(containerHookupTime, espduCrane);
disChannel
.
sendCommentPdu
(
disChannel
.
COMMENTPDU_NARRATIVE
,
"Container hooked up"
);
disChannel
.
sendCommentPdu
(
disChannel
.
COMMENTPDU_NARRATIVE
,
"Container hooked up"
);
disChannel
.
sendSinglePduDelayed
(
containerHookupTime
,
espduCrane
);
espduCrane
.
setEntityOrientation
(
90
,
0
,
0
);
// espduCrane.setEntityOrientation(0, 0, 90); // ambiguous, degrees or radians? TODO javadoc
disChannel
.
sendSinglePduDelayed
(
rotationDelay
,
espduCrane
);
espduCrane
.
setEntityOrientation
(
orientationToPier
);
// TODO fix sendSinglePduDelayed thread handling since it is blocking...
// disChannel.sendSinglePduDelayed(containerHookupTime + rotationDelay, espduCrane);
// unhook
// unhook
// rotate back
// rotate back
// send PDUs accordingly
// if this container is special, meaning on watchlist, report it
//
Future work:
if this container is special, meaning on watchlist, report it
}
}
// 4. Crane stows boom in vertical position
// 4. Crane stows boom in vertical position
...
...
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