diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/Example_ways_to_set_EntityType.png b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/Example_ways_to_set_EntityType.png new file mode 100644 index 0000000000000000000000000000000000000000..b1a99c0097b5c65dd7e39f2f201c10a363bfb67e Binary files /dev/null and b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/Example_ways_to_set_EntityType.png differ diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/Fisher_Project_-_PDU_Capture.pcapng b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/Fisher_Project_-_PDU_Capture.pcapng new file mode 100644 index 0000000000000000000000000000000000000000..0d1813180b4f01107618645169e12b4eec94372b Binary files /dev/null and b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/Fisher_Project_-_PDU_Capture.pcapng differ diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/MV3500ProjectFisher.java b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/MV3500ProjectFisher.java index ccb55e6530dad4afd4b2b6675c2ce49b5ae7f93a..96dab06203c26c9f4cfdd7473dc9edadd92bcf68 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/MV3500ProjectFisher.java +++ b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/MV3500ProjectFisher.java @@ -10,6 +10,9 @@ */ 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.pdus.*; // match any of the PDU classes, easier than listing individually import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface; @@ -55,82 +58,114 @@ public class MV3500ProjectFisher int simulationLoopCount = 0; // variable, initialized at 0 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_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 + entityID_1.setEntityID(1); // made-up example ID; EntityStatePdu entityStatePdu_1 = pduFactory.makeEntityStatePdu(); + entityStatePdu_1.setEntityType(new M1281CloseCombatWeaponsCarrierJLTVCCWC()); // create new object vice using the class Vector3Float pEntityLinearVelocity = new Vector3Float(); - pEntityLinearVelocity.setX(1); - pEntityLinearVelocity.setY(0); - pEntityLinearVelocity.setZ(0); + pEntityLinearVelocity.setX(1).setY(0).setZ(0); entityStatePdu_1.setEntityLinearVelocity(pEntityLinearVelocity); entityStatePdu_1.setEntityID(entityID_1); entityStatePdu_1.getEntityLocation().setX(0).setY(0).setZ(0); entityStatePdu_1.setForceId(ForceID.FRIENDLY); - entityStatePdu_1.setEntityType(entityType_1); + entityStatePdu_1.setAlternativeEntityType(new _762x51mmM240E4M240BGPMG() ); - EntityType entityType_2 = new EntityType(); - entityType_2.setCountry(Country.AFGHANISTAN_AFG); - entityType_2.setEntityKind(EntityKind.LIFE_FORM); - entityType_2.setCategory(1); // civilian male with cellphone - entityType_2.setSubCategory(171); // personal electronic - entityType_2.setSubCategory(1); // cell phone - +// Again, example of the not so good way to do things +// EntityType entityType_2 = new EntityType(); +// entityType_2.setCountry(Country.AFGHANISTAN_AFG); +// entityType_2.setEntityKind(EntityKind.LIFE_FORM); +// entityType_2.setCategory(1); // civilian male with cellphone +// 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_2.setEntityType(new CivilianAdultMalewCellPhone()); entityStatePdu_2.setEntityID(entityID_2); entityStatePdu_2.getEntityLocation().setX(10).setY(0).setZ(100); entityStatePdu_2.setForceId(ForceID.OPPOSING); - entityStatePdu_2.setEntityType(entityType_2); - - FirePdu firePdu_1a = pduFactory.makeFirePdu(); // for entity 1 first weapon (if any) - // should we customize this munition? what is it for your simulation? - EntityType fireType = new EntityType(); + // 762 munition to be fired from M240 + FirePdu firePdu_1a = pduFactory.makeFirePdu(); MunitionDescriptor fireDescriptor = new MunitionDescriptor(); - fireType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); - fireType.setEntityKind(EntityKind.PLATFORM); - fireType.setCategory(11); //US Army - fireType.setSubCategory(35); //Machine gun - fireType.setSpecific(59); //M240 + EntityType munitionType = new EntityType(); + munitionType.setCountry(Country.UNITED_STATES_OF_AMERICA_USA); + munitionType.setEntityKind(EntityKind.MUNITION); + munitionType.setCategory(2); // ballistic + munitionType.setSubCategory(2); //762 + munitionType.setSpecific(4); // _762x51mm4balland1tracerlinked + //fireDescriptor.setMunitionType(new _762x51mm4balland1tracerlinked()); firePdu_1a.setFiringEntityID(entityID_1); firePdu_1a.setTargetEntityID(entityID_2); firePdu_1a.setRange(1000.0f); // range 1000m - fireDescriptor.setMunitionType(fireType); fireDescriptor.setRate(200); //rate 200 rounds per minute Vector3Float pVelocity = new Vector3Float(); pVelocity.setX(0.0f); pVelocity.setY(0.0f); pVelocity.setZ(100.0f); firePdu_1a.setVelocity(pVelocity); + fireDescriptor.setMunitionType(munitionType); 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(); 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 DetonationPdu detonationPdu = pduFactory.makeDetonationPdu(); + detonationPdu.getLocationInWorldCoordinates().setX(12).setY(0).setZ(0); + pDescriotor.setMunitionType(iedMunitionType); detonationPdu.setDescriptor(pDescriotor); - detonationPdu.getLocationInWorldCoordinates().setX(10).setY(0).setZ(0); - detonationPdu.setExplodingEntityID(entityID_1).setSourceEntityID(entityID_2).setTargetEntityID(entityID_1); - detonationPdu.setDetonationResult(DetonationResult.ENTITY_PROXIMATE_DETONATION); - + detonationPdu.setSourceEntityID(entityID_2).setTargetEntityID(entityID_1); + // 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 while (simulationLoopCount < SIMULATION_MAX_LOOP_COUNT) // are we done yet? @@ -182,16 +217,35 @@ public class MV3500ProjectFisher System.out.println ("... [PDUs successfully sent for this loop]"); 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) { sendSinglePdu(detonationPdu); 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) { - contactCounter++; - sendSinglePdu(entityStatePdu_2); - sendSinglePdu(firePdu_1a); - sendCommentPdu(otherComment, "Entity 2 is hit"); + // To be changed by anyone, if we assume our first 2 bursts will not hit the enemy + // Can be changes to reflect better marksmanship or worse. + if (contactCounter <2) + { + 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!"); + } } } diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/README b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/README index fb73844fe4364e1d9683fc82736fa61da66c53f2..863f5cb213c113bf724cc458defe43941d29aae0 100644 --- a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/README +++ b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/README @@ -1,9 +1,22 @@ -The program I have designed is branching off of Homework 3 to expand the scenario a bit and add some more -PDUs to be utilized. +The program I have designed is branching off of Homework 3 to expand the scenario a bit and +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). -While on the route, the unit is struck by a command detonated IED 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 1100m firing at the rapid rate (200 rounds per minute). +My scenario starts with a US vehicle (JLTV) equipped with an M240 medium machine gun +starting at (0,0,0) and moving on a straight line route to (10,0,0). + +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. + +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. diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/project_screenshot_JLTV.png b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/project_screenshot_JLTV.png new file mode 100644 index 0000000000000000000000000000000000000000..d00d8c161eb72fe2396220b86f31070bc167e0f5 Binary files /dev/null and b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/project_screenshot_JLTV.png differ diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/project_screenshot_afg_male.png b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/project_screenshot_afg_male.png new file mode 100644 index 0000000000000000000000000000000000000000..2e93ba7496491e522fed3fa90f888e9b51fc4ee8 Binary files /dev/null and b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/project_screenshot_afg_male.png differ