Class ExampleSimulationProgram

java.lang.Object
edu.nps.moves.dis7.examples.ExampleSimulationProgram
Direct Known Subclasses:
ExampleTrackInterpolation

public class ExampleSimulationProgram extends Object
The purpose of this inheritable class is to provide an easily modifiable example simulation program that includes DIS-capable entities performing tasks of interest, and then reporting activity via PDUs to the network. Default program initialization includes PDU recording turned on by default.
See Also:
  • Field Details

    • disChannel

      protected DisChannel disChannel
      DIS channel defined by network address/port combination includes multiple utility capabilities
    • pduFactory

      protected PduFactory pduFactory
      Factory object used to create new PDU instances
    • entityID_1

      protected EntityID entityID_1
      EntityID settings for entity 1
    • entityID_2

      protected EntityID entityID_2
      EntityID settings for entity 2
    • entityID_3

      protected EntityID entityID_3
      EntityID settings for entity 3, a potential third-party observer and after-action reporter
    • entityStatePdu_1

      protected EntityStatePdu entityStatePdu_1
      ESPDU for entity 1
    • entityStatePdu_2

      protected EntityStatePdu entityStatePdu_2
      ESPDU for entity 2
    • firePdu_1a

      protected FirePdu firePdu_1a
      FirePdu for entity 1 first weapon (if any)
    • firePdu_1b

      protected FirePdu firePdu_1b
      FirePdu for entity 1 second weapon (if any)
    • munitionDescriptor1

      protected MunitionDescriptor munitionDescriptor1
      MunitionDescriptor for these weapons
    • detonationPdu_1a

      protected DetonationPdu detonationPdu_1a
      TODO DetonationPdu for entity 1 second weapon (if any)
    • detonationPdu_1b

      protected DetonationPdu detonationPdu_1b
      TODO DetonationPdu for entity 1 second weapon (if any)
    • thisProgram

      protected static ExampleSimulationProgram thisProgram
      Locally instantiable copy of program, can be subclassed.
  • Constructor Details

    • ExampleSimulationProgram

      public ExampleSimulationProgram()
      Constructor to create an instance of this class. Design goal: additional built-in initialization conveniences can go here to keep your efforts focused on the runSimulation() method.
    • ExampleSimulationProgram

      public ExampleSimulationProgram(String newDescriptor)
      Constructor to create an instance of this class.
      Parameters:
      newDescriptor - describes this program, useful for logging and debugging
    • ExampleSimulationProgram

      public ExampleSimulationProgram(String address, int port)
      Utility Constructor that allows your example simulation program to override default network address and port
      Parameters:
      address - network address to use
      port - corresponding network port to use
  • Method Details

    • initializeSimulationEntities

      public void initializeSimulationEntities()
      Get ready, get set... initialize simulation entities. Who's who in the zoo?
    • runSimulationLoops

      public void runSimulationLoops()
      This runSimulationLoops() method is for you, a customizable programmer-modifiable code block for defining and running a new simulation of interest. Welcome! Other parts of this program handle bookkeeping and plumbing tasks so that you can focus on your model entities and activities. Expandable support includes DIS EntityStatePdu, FirePdu and CommentPdu all available for modification and sending in a simulation loop. Continuous improvement efforts seek to make this program as easy and straightforward as possible for DIS simulationists to use and adapt. All of the other methods are setup, teardown and configuration that you may find interesting, even helpful, but don't really have to worry about.
    • sendAllPdusForLoopTimestep

      public void sendAllPdusForLoopTimestep(double simTimeSeconds, EntityStatePdu entityStatePdu, FirePdu firePdu, VariableRecordType commentType, String... comments)
      Send EntityState, Fire, Comment PDUs that got updated for this loop, reflecting state of current simulation timestep.
      Parameters:
      simTimeSeconds - simulation time in second, applied to PDU as timestamp
      entityStatePdu - the ESPDU to send, if any
      firePdu - the FirePDU to send, if any
      commentType - enumeration value describing purpose of the narrative comment PDU
      comments - String array of narrative comments
      See Also:
    • handleArguments

      protected void handleArguments(String[] args)
      Initial execution via main() method: handle args array of command-line initialization (CLI) arguments here
      Parameters:
      args - command-line parameters: network address and port
    • getDescriptor

      public String getDescriptor()
      Get simple descriptor (such as parent class name) for this network interface, used in trace statements
      Returns:
      simple descriptor name
    • setDescriptor

      public void setDescriptor(String newDescriptor)
      Set new simple descriptor (such as parent class name) for this network interface, used in trace statements
      Parameters:
      newDescriptor - simple descriptor name for this interface
    • getSimulationTimeStepDuration

      public double getSimulationTimeStepDuration()
      parameter accessor method
      Returns:
      the simulationTimeStepDuration in seconds
    • setSimulationTimeStepDuration

      public void setSimulationTimeStepDuration(double timeStepDurationSeconds)
      parameter accessor method
      Parameters:
      timeStepDurationSeconds - the simulationTimeStepDuration in seconds to set
    • main

      public static void main(String[] args)
      Main method is first executed when a program instance is loaded.
      Parameters:
      args - command-line parameters: network address and port. Command-line arguments are an array of optional String parameters that are passed from execution environment during invocation
      See Also: