Skip to content
Snippets Groups Projects
Commit 57685378 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

Merge origin/master

parents 1ed98150 e3d72487
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
*/ */
package MV3500Cohort2021JulySeptember.projects.Fisher; package MV3500Cohort2021JulySeptember.projects.Fisher;
import edu.nps.moves.dis7.entities.afg.lifeform.land.CivilianAdultMalewCellPhone;
import edu.nps.moves.dis7.entities.usa.lifeform.land.*;
import edu.nps.moves.dis7.entities.usa.platform.land.M1281CloseCombatWeaponsCarrierJLTVCCWC;
import edu.nps.moves.dis7.enumerations.*; // match any import edu.nps.moves.dis7.enumerations.*; // match any
import edu.nps.moves.dis7.pdus.*; // match any of the PDU classes, easier than listing individually import edu.nps.moves.dis7.pdus.*; // match any of the PDU classes, easier than listing individually
import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface; import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface;
...@@ -55,82 +58,114 @@ public class MV3500ProjectFisher ...@@ -55,82 +58,114 @@ public class MV3500ProjectFisher
int simulationLoopCount = 0; // variable, initialized at 0 int simulationLoopCount = 0; // variable, initialized at 0
boolean simulationComplete = false; // sentinel variable as termination condition,, are we done yet? boolean simulationComplete = false; // sentinel variable as termination condition,, are we done yet?
// TODO reset clock to zero each time for consistent outputs
// Your model setup: define participants. who's who in this zoo?
// Assuming you keep track of entity objects... here is some support for for Entity 1.
// create PDU objects and set their values.
// This is an example of the not to good way to do things
// entityType_1.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); // 225 = USA
// entityType_1.setEntityKind(EntityKind.PLATFORM);
// entityType_1.setCategory(6); //Small wheeled utility vehicle
// entityType_1.setSubCategory(30); // JLTV
// entityType_1.setSpecific(37); // Up armored with M240
//Entity 1 is a US JLTV traveling down the road with a M240
EntityID entityID_1 = new EntityID(); EntityID entityID_1 = new EntityID();
entityID_1.setEntityID(1); // made-up example ID; entityID_1.setEntityID(1); // made-up example ID;
// create PDU objects and set their values.
EntityID entityID_2 = new EntityID();
entityID_2.setEntityID(2);
// TODO someday, use enumerations; is there a unique site triplet for MOVES Institute?
EntityType entityType_1 = new EntityType();
entityType_1.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); // 225 = USA
entityType_1.setEntityKind(EntityKind.PLATFORM);
entityType_1.setCategory(6); //Small wheeled utility vehicle
entityType_1.setSubCategory(30); // JLTV
entityType_1.setSpecific(37); // Up armored with M240
EntityStatePdu entityStatePdu_1 = pduFactory.makeEntityStatePdu(); EntityStatePdu entityStatePdu_1 = pduFactory.makeEntityStatePdu();
entityStatePdu_1.setEntityType(new M1281CloseCombatWeaponsCarrierJLTVCCWC()); // create new object vice using the class
Vector3Float pEntityLinearVelocity = new Vector3Float(); Vector3Float pEntityLinearVelocity = new Vector3Float();
pEntityLinearVelocity.setX(1); pEntityLinearVelocity.setX(1).setY(0).setZ(0);
pEntityLinearVelocity.setY(0);
pEntityLinearVelocity.setZ(0);
entityStatePdu_1.setEntityLinearVelocity(pEntityLinearVelocity); entityStatePdu_1.setEntityLinearVelocity(pEntityLinearVelocity);
entityStatePdu_1.setEntityID(entityID_1); entityStatePdu_1.setEntityID(entityID_1);
entityStatePdu_1.getEntityLocation().setX(0).setY(0).setZ(0); entityStatePdu_1.getEntityLocation().setX(0).setY(0).setZ(0);
entityStatePdu_1.setForceId(ForceID.FRIENDLY); entityStatePdu_1.setForceId(ForceID.FRIENDLY);
entityStatePdu_1.setEntityType(entityType_1); entityStatePdu_1.setAlternativeEntityType(new _762x51mmM240E4M240BGPMG() );
EntityType entityType_2 = new EntityType(); // Again, example of the not so good way to do things
entityType_2.setCountry(Country.AFGHANISTAN_AFG); // EntityType entityType_2 = new EntityType();
entityType_2.setEntityKind(EntityKind.LIFE_FORM); // entityType_2.setCountry(Country.AFGHANISTAN_AFG);
entityType_2.setCategory(1); // civilian male with cellphone // entityType_2.setEntityKind(EntityKind.LIFE_FORM);
entityType_2.setSubCategory(171); // personal electronic // entityType_2.setCategory(1); // civilian male with cellphone
entityType_2.setSubCategory(1); // cell phone // entityType_2.setSubCategory(171); // personal electronic
// entityType_2.setSubCategory(1); // cell phone
// Entity 2 is an enemy Afghan male with cell phone.
EntityID entityID_2 = new EntityID();
entityID_2.setEntityID(2);
EntityStatePdu entityStatePdu_2 = pduFactory.makeEntityStatePdu(); EntityStatePdu entityStatePdu_2 = pduFactory.makeEntityStatePdu();
entityStatePdu_2.setEntityType(new CivilianAdultMalewCellPhone());
entityStatePdu_2.setEntityID(entityID_2); entityStatePdu_2.setEntityID(entityID_2);
entityStatePdu_2.getEntityLocation().setX(10).setY(0).setZ(100); entityStatePdu_2.getEntityLocation().setX(10).setY(0).setZ(100);
entityStatePdu_2.setForceId(ForceID.OPPOSING); entityStatePdu_2.setForceId(ForceID.OPPOSING);
entityStatePdu_2.setEntityType(entityType_2);
// 762 munition to be fired from M240
FirePdu firePdu_1a = pduFactory.makeFirePdu(); // for entity 1 first weapon (if any) FirePdu firePdu_1a = pduFactory.makeFirePdu();
// should we customize this munition? what is it for your simulation?
EntityType fireType = new EntityType();
MunitionDescriptor fireDescriptor = new MunitionDescriptor(); MunitionDescriptor fireDescriptor = new MunitionDescriptor();
fireType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); EntityType munitionType = new EntityType();
fireType.setEntityKind(EntityKind.PLATFORM); munitionType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA);
fireType.setCategory(11); //US Army munitionType.setEntityKind(EntityKind.MUNITION);
fireType.setSubCategory(35); //Machine gun munitionType.setCategory(2); // ballistic
fireType.setSpecific(59); //M240 munitionType.setSubCategory(2); //762
munitionType.setSpecific(4); // _762x51mm4balland1tracerlinked
//fireDescriptor.setMunitionType(new _762x51mm4balland1tracerlinked());
firePdu_1a.setFiringEntityID(entityID_1); firePdu_1a.setFiringEntityID(entityID_1);
firePdu_1a.setTargetEntityID(entityID_2); firePdu_1a.setTargetEntityID(entityID_2);
firePdu_1a.setRange(1000.0f); // range 1000m firePdu_1a.setRange(1000.0f); // range 1000m
fireDescriptor.setMunitionType(fireType);
fireDescriptor.setRate(200); //rate 200 rounds per minute fireDescriptor.setRate(200); //rate 200 rounds per minute
Vector3Float pVelocity = new Vector3Float(); Vector3Float pVelocity = new Vector3Float();
pVelocity.setX(0.0f); pVelocity.setX(0.0f);
pVelocity.setY(0.0f); pVelocity.setY(0.0f);
pVelocity.setZ(100.0f); pVelocity.setZ(100.0f);
firePdu_1a.setVelocity(pVelocity); firePdu_1a.setVelocity(pVelocity);
fireDescriptor.setMunitionType(munitionType);
firePdu_1a.setDescriptor(fireDescriptor); firePdu_1a.setDescriptor(fireDescriptor);
// TODO simulation management PDUs for startup, planning to design special class support //Pdu for impacts of 762 on the dirt before making contact with enemy
DetonationPdu fireDetPdu1 = pduFactory.makeDetonationPdu();
fireDetPdu1.getLocationInWorldCoordinates().setX(12).setY(0).setZ(0);
fireDetPdu1.setDetonationResult(DetonationResult.GROUND_IMPACT);
fireDetPdu1.setSourceEntityID(entityID_1).setTargetEntityID(entityID_2);
// Pdu for impacts of 762 on the enemy
DetonationPdu fireDetPdu2 = pduFactory.makeDetonationPdu();
fireDetPdu2.getLocationInWorldCoordinates().setX(12).setY(0).setZ(0);
fireDetPdu2.setDetonationResult(DetonationResult.ENTITY_IMPACT);
fireDetPdu2.setSourceEntityID(entityID_1).setTargetEntityID(entityID_2);
// IED blast and detonation details
MunitionDescriptor pDescriotor = new MunitionDescriptor(); MunitionDescriptor pDescriotor = new MunitionDescriptor();
pDescriotor.setWarhead(MunitionDescriptorWarhead.HE_FRAGMENTATION); //High explosive frag pDescriotor.setWarhead(MunitionDescriptorWarhead.HE_FRAGMENTATION); //High explosive frag
pDescriotor.setQuantity(2); EntityType iedMunitionType = new EntityType();
iedMunitionType.setCountry(Country.OTHER);
iedMunitionType.setEntityKind(EntityKind.MUNITION);
iedMunitionType.setCategory(3); // fixed
iedMunitionType.setSubCategory(3); //PipeBombPVC
//pDescriotor.setMunitionType(new PipeBombPVC());
pDescriotor.setFuse(MunitionDescriptorFuse.COMMAND_ELECTRONIC_REMOTELY_SET); //command detonated pDescriotor.setFuse(MunitionDescriptorFuse.COMMAND_ELECTRONIC_REMOTELY_SET); //command detonated
DetonationPdu detonationPdu = pduFactory.makeDetonationPdu(); DetonationPdu detonationPdu = pduFactory.makeDetonationPdu();
detonationPdu.getLocationInWorldCoordinates().setX(12).setY(0).setZ(0);
pDescriotor.setMunitionType(iedMunitionType);
detonationPdu.setDescriptor(pDescriotor); detonationPdu.setDescriptor(pDescriotor);
detonationPdu.getLocationInWorldCoordinates().setX(10).setY(0).setZ(0); detonationPdu.setSourceEntityID(entityID_2).setTargetEntityID(entityID_1);
detonationPdu.setExplodingEntityID(entityID_1).setSourceEntityID(entityID_2).setTargetEntityID(entityID_1);
detonationPdu.setDetonationResult(DetonationResult.ENTITY_PROXIMATE_DETONATION);
// User chooses cases to see effects based on det probability
float probabilityOfDetonation = 0.2f;
// experiment with munition reliability
if (0.0f < probabilityOfDetonation && probabilityOfDetonation <= 0.8f)
{
detonationPdu.setDetonationResult(DetonationResult.ENTITY_PROXIMATE_DETONATION);
}
else if (probabilityOfDetonation > 0.8f)
{
detonationPdu.setDetonationResult(DetonationResult.ENTITY_IMPACT); // worst case IED direct hit
}
else if (probabilityOfDetonation == 0.0f)
{
detonationPdu.setDetonationResult(DetonationResult.NONE_OR_NO_DETONATION_DUD); // best case IED dud
}
// loop the simulation while allowed, programmer can set additional conditions to break out and finish // loop the simulation while allowed, programmer can set additional conditions to break out and finish
while (simulationLoopCount < SIMULATION_MAX_LOOP_COUNT) // are we done yet? while (simulationLoopCount < SIMULATION_MAX_LOOP_COUNT) // are we done yet?
...@@ -182,16 +217,35 @@ public class MV3500ProjectFisher ...@@ -182,16 +217,35 @@ public class MV3500ProjectFisher
System.out.println ("... [PDUs successfully sent for this loop]"); System.out.println ("... [PDUs successfully sent for this loop]");
int contactCounter = 0; int contactCounter = 0;
// When entity reaches a point on the route detonate IED and
// begin firing at the enemy
if (entityStatePdu_1.getEntityLocation().getX() == 10) if (entityStatePdu_1.getEntityLocation().getX() == 10)
{ {
sendSinglePdu(detonationPdu); sendSinglePdu(detonationPdu);
sendCommentPdu(otherComment, "IED detonated near Entity 1"); sendCommentPdu(otherComment, "IED detonated near Entity 1");
// This would show the 4 bursts to be shot at the enemy. We can adjust
// how quicly we get effects on target.
while (contactCounter < 4) while (contactCounter < 4)
{ {
contactCounter++; // To be changed by anyone, if we assume our first 2 bursts will not hit the enemy
sendSinglePdu(entityStatePdu_2); // Can be changes to reflect better marksmanship or worse.
sendSinglePdu(firePdu_1a); if (contactCounter <2)
sendCommentPdu(otherComment, "Entity 2 is hit"); {
contactCounter++;
sendSinglePdu(entityStatePdu_2);
sendSinglePdu(firePdu_1a);
sendSinglePdu(fireDetPdu1);
sendCommentPdu(otherComment, "Missed entity 2!");
}
else
{
contactCounter++;
sendSinglePdu(entityStatePdu_2);
sendSinglePdu(firePdu_1a);
sendSinglePdu(fireDetPdu2);
sendCommentPdu(otherComment, "Entity 2 is hit!");
}
} }
} }
......
The program I have designed is branching off of Homework 3 to expand the scenario a bit and add some more The program I have designed is branching off of Homework 3 to expand the scenario a bit and
PDUs to be utilized. add some more PDUs to be utilized in a simulation.
My scenario starts with a US vehicle (JLTV) starting at (0,0,0) and moving on a straight line route to (10,0,0). My scenario starts with a US vehicle (JLTV) equipped with an M240 medium machine gun
While on the route, the unit is struck by a command detonated IED by a civilain male with a cell phone at starting at (0,0,0) and moving on a straight line route to (10,0,0).
coordinates (10,0,100). Upon being struck, the friendly unit fires at the enemy with an M240 machine gun with a
range of 1100m firing at the rapid rate (200 rounds per minute). While on the route, the unit is struck by an IED detonated by a civilain male with a cell
phone at coordinates (10,0,100). Upon being struck, the friendly unit fires at the enemy
with an M240 machine gun with a range of 1000m firing at the rapid rate (200 rounds per minute).
After a few seconds of firing, the threat has been neutralized and the simulation ends. After a few seconds of firing, the threat has been neutralized and the simulation ends.
You will notice a few things in this code that can be changed by the user for simulating
different scenarios and effects. First, there are three different detonation effects used depending on the
probability of detonation used. If we set a low probability of the detonation, the effect will be a dud.
If we put a medium probability (0.2-0.8) then we receive a proximate detonation. If we use a high detonation
rate (>0.8) then we will see a direct hit. Future developers could then assess levels of damage based on this.
I have also added a contactCounter. This can be used to see effects on the enemy based on marksmanship of
the shooter. It is currently set to 50% (2/4) meaning the first 2 of 4 bursts will impact the dirt around the
enemy. This is done using another detonation PDU with dirt impact effects. After the first 2 bursts hit
short of the target, we then see the next 2 impacts show in the detonation PDU as direct hit effects.
After this the enemy has been neutralized and the simulation is over.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment