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
1965faab
Commit
1965faab
authored
3 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
twenty minutes following class
parent
b5a82872
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
+69
-2
69 additions, 2 deletions
...es/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java
with
69 additions
and
2 deletions
examples/src/SimkitOpenDis7Examples/TwoCraneBerthsOpenDis7.java
+
69
−
2
View file @
1965faab
package
SimkitOpenDis7Examples
;
package
SimkitOpenDis7Examples
;
import
edu.nps.moves.dis7.enumerations.DisPduType
;
import
edu.nps.moves.dis7.pdus.EntityStatePdu
;
import
edu.nps.moves.dis7.utilities.DisChannel
;
import
edu.nps.moves.dis7.utilities.PduFactory
;
import
java.util.SortedSet
;
import
java.util.SortedSet
;
import
java.util.TreeSet
;
import
java.util.TreeSet
;
import
simkit.Priority
;
import
simkit.Priority
;
...
@@ -16,7 +20,9 @@ import simkit.SimEntityBase;
...
@@ -16,7 +20,9 @@ import simkit.SimEntityBase;
* @author abuss@nps.edu@nps.edu
* @author abuss@nps.edu@nps.edu
* @author brutzman@nps.edu
* @author brutzman@nps.edu
*/
*/
public
class
TwoCraneBerthsOpenDis7
extends
SimEntityBase
{
public
class
TwoCraneBerthsOpenDis7
extends
SimEntityBase
{
private
final
DisChannel
disChannel
=
new
DisChannel
();
/**
/**
* Queue of Ships waiting to go into the berth
* Queue of Ships waiting to go into the berth
...
@@ -159,7 +165,7 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase {
...
@@ -159,7 +165,7 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase {
*/
*/
public
void
doStartUnloadingOneCrane
()
{
public
void
doStartUnloadingOneCrane
()
{
SortedSet
<
Ship
>
oldQueue
=
getQueue
();
SortedSet
<
Ship
>
oldQueue
=
getQueue
();
Ship
ship
=
queue
.
first
();
Ship
ship
=
queue
.
first
();
// TODO rename ship queue
queue
.
remove
(
ship
);
queue
.
remove
(
ship
);
firePropertyChange
(
"queue"
,
oldQueue
,
getQueue
());
firePropertyChange
(
"queue"
,
oldQueue
,
getQueue
());
...
@@ -171,9 +177,70 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase {
...
@@ -171,9 +177,70 @@ public class TwoCraneBerthsOpenDis7 extends SimEntityBase {
SortedSet
<
Ship
>
oldBerth
=
getBerth
();
SortedSet
<
Ship
>
oldBerth
=
getBerth
();
berth
.
add
(
ship
);
berth
.
add
(
ship
);
firePropertyChange
(
"berth"
,
oldBerth
,
getBerth
());
firePropertyChange
(
"berth"
,
oldBerth
,
getBerth
());
performCraneUnloadOperations
(
10
,
// numberOfContainers
0.0
// initial position
);
// TODO indicate berth
waitDelay
(
"EndUnloadingOneCrane"
,
ship
.
getRemainingUnloadingTime
(),
ship
);
waitDelay
(
"EndUnloadingOneCrane"
,
ship
.
getRemainingUnloadingTime
(),
ship
);
}
}
PduFactory
pduFactory
=
new
PduFactory
();
public
void
performCraneUnloadOperations
(
// which crane
// which berth
int
numberOfContainers
,
double
positionOfCrane
// lenthOfCrane
)
{
double
craneLinearSpeed
=
1.0
;
// m/sec
double
craneRotationRate
=
10.0
;
// degrees/second
double
containerHookupTime
=
60.0
;
// seconds average
double
containerDetachTime
=
30.0
;
// seconds average
EntityStatePdu
espduCrane
=
(
EntityStatePdu
)
pduFactory
.
createPdu
(
DisPduType
.
ENTITY_STATE
);
// 1. Crane at head of pier, operatior present, boom elevated vertically in stow postion
// espduCrane1.setPosition 0 0 0
// 2, Ship arrives, tug departs
// shop PDU here or assum it happened earlier
// 3. Crane moves to position of ship
espduCrane
.
setEntityLocation
(
positionOfCrane
,
0.0
,
0.0
);
// TODO compute travel time
// update: travel to positionOfCrane by craneLinearSpeed
// 4. repeat until done: Crane rotates, lift container, rotates, lower container
for
(
int
containerIndex
=
1
;
containerIndex
<=
numberOfContainers
;
containerIndex
++)
{
// perform one operation
espduCrane
.
setEntityOrientation
(
0
,
0
,
0
);
disChannel
.
sendSinglePdu
(
espduCrane
);
espduCrane
.
setEntityOrientation
(
0
,
0
,
0
);
double
rotationDelay
=
90.0
/
craneRotationRate
;
disChannel
.
sendCommentPdu
(
disChannel
.
COMMENTPDU_NARRATIVE
,
"Hooking up Container "
+
containerIndex
+
" to crane"
);
disChannel
.
sendSinglePduDelayed
(
containerHookupTime
,
espduCrane
);
disChannel
.
sendCommentPdu
(
disChannel
.
COMMENTPDU_NARRATIVE
,
"Container hooked up"
);
disChannel
.
sendSinglePduDelayed
(
containerHookupTime
,
espduCrane
);
espduCrane
.
setEntityOrientation
(
90
,
0
,
0
);
disChannel
.
sendSinglePduDelayed
(
rotationDelay
,
espduCrane
);
// unhook
// rotate back
// if this container is special, meaning on watchlist, report it
}
// 4. Crane stows boom in vertical position
// espcudCrnet orientation
// 5. Crane returns to head of pier
// update: travel from positionOfCrane to head by craneLinearSpeed
espduCrane
.
setEntityLocation
(
positionOfCrane
,
0.0
,
0.0
);
disChannel
.
sendSinglePdu
(
espduCrane
);
}
/**
/**
* Remove given Ship from berth<br>
* Remove given Ship from berth<br>
...
...
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