modeling and simulation Academic Essay

modeling and simulation

Order Description

DEVSJAVA
Write a DEVS model for the ?Bridge Segment? ?Besides the ?Bridge Segment? atomic model, also write two ?car generator? atomic models (one to generate cars coming from
the west, and the other to generate cars coming from the east), and then couple the three models togetherto test your ?Bridge Segment? model.?Finally, couple the car
generators and the three ?Bridge Segments? as shown below to form a traffic system. (Assumethe roadsegments between two bridge segments have zero travel time and
infinite capacity.)?You need to package all your source code into a package hierarchy named ?Homework2016.BridgeSegment.XXX?, where XXX is your first name initial plus
last name.For example, if your name is Peisheng Wu, the package name should be Homework2016.BridgeSegment.PWu. Note that to make the package work, you will need to
create a directory Homework2016, and then a directory BridgeSegment under Homework2016, and then PWuunder BridgeSegment.?Besides the source code, each student also
needs to turn in a document (no more than two pages) to describe the design of your ?Bridge Segment? model. This should cover the basic logic of your deltext(),
deltint(), deltcon(), and out()functions. Your description can be aninformal English description of themodel design, or a state diagram (similar to those in the DEVS
class slides)with explanations. We will use this document to help grading your model. Note that a formalanddetaileddescription of the model behavior is not needed
because we already have your source code. Place the model description document inside your source code directory.?Turn in your DEVSJAVA code and documents
throughiCollage. You should compress all your filesby zipping your source code directory (e.g., the directoryof PWu in the above example) and upload it with a single
zip file. (including a brief explanation of the design of the model and a live demo of the model).

More information:Two Approaches1.Model the traffic light and bridge segment together.2.Model the traffic light separately. In this case, each bridge segment is a
coupled model with a bridgeSegment and a traffic light. If you like, you may program your logic in a stepwise fashion(your final code should finish step2):1.Step 1: As
long as the traffic light is green, a vehicle can move ahead. If the traffic light changes to red when a car is still on the bridge, the cars on the other direction
should wait until this car finishes.2.Step 2: A vehicle can go through the green traffic light only when at least 10 seconds is left before the traffic light changes
to red.

Additional Requirementsof HW1:1.Download ?Homework2016.BridgeSegment?package, which contains 4classes:?AbstractBridgeSystem??CarGenerator??Transducer? ?Test?Put them
to ?src/Homework2016/BridgeSegment/?In ?AbstractBridgeSystem?, the TAhas already implemented some codefor car generation and resultmaintenance. You have to use it
(seeinstructions below), and you must not modify it, or the grading code maynotrecognize your code.2.When building your bridge systemcoupled model, instead of
extending ?ViewableDigraph?, extend ?AbstractBridgeSystem?3.Use ?AbstractBridgeSystem.westCarGenerator? and ?AbstractBridgeSystem.eastCarGenerator? as your two car
generators on the west and on the east. E.g.://…// when you need to use the 2 generators, use them directly, and DO NOT create your own add
(this.westCarGenerator);add(this.eastCarGenerator);addCoupling(westCarGenerator,”out”,bridgeSegment3,”westbound_in”);addCoupling
(eastCarGenerator,”out”,bridgeSegment1,”eastbound_in”);//…Note: The above sample code shows how to use the two car generators. You should modify the code accordingly
based on your own models. However, when you use car generators, use westCarGenerator and eastCarGenerator from AbstractBridgeSystem. The bridgeSegment3,
bridgeSegment2, bridgeSegment1 are the three bridge segmentsfrom west to east, respectively.The westCarGenerator generates cars driving from west toeast, so connect it
with your bridgeSegment3. 4.For each bridge, you need to set the ?initial state?and its ?traffic light duration time?according to the globalsetting class in
AbstractBridgeSystem:publicstaticclassBridgeSystemSetting{//Bridge1, the east most onepublicstaticBridgeState
Bridge1InitialState;publicstaticdoubleBridge1TrafficLightDurationTime;// Bridge2, the middle onepublicstaticBridgeState
Bridge2InitialState;publicstaticdoubleBridge2TrafficLightDurationTime;// Bridge3, the west most onepublicstaticBridgeState
Bridge3InitialState;publicstaticdoubleBridge3TrafficLightDurationTime;}The sample code below illustrateshow you may use the global setting in the initialize() of a
bridgeSegement:if(AbstractBridgeSystem.BridgeSystemSetting.Bridge3InitialState==AbstractBridgeSystem.BridgeState.WEST_TO_EAST)holdIn(?westToEastGreen?,
AbstractBridgeSystem.BridgeSystemSetting.Bridge3TrafficLightDurationTime);
5.Couple each bridge segment?s west output port and east output port to the transducer (provided by the AbstractBridgeSystem)?s input ports as illustrated below: add
(this.transduser);addCoupling(bridgeSegment1, “eastbound_out”, this.transduser, “Bridge1_EastOut”);addCoupling(bridgeSegment1, “westbound_out”, this.transduser,
“Bridge1_WestOut”);addCoupling(bridgeSegment2, “eastbound_out”, this.transduser, “Bridge2_EastOut”);addCoupling(bridgeSegment2, “westbound_out”, this.transduser,
“Bridge2_WestOut”);addCoupling(bridgeSegment3, “eastbound_out”, this.transduser, “Bridge3_EastOut”);addCoupling(bridgeSegment3, “westbound_out”, this.transduser,
“Bridge3_WestOut”);where bridgeSegment3,bridgeSegment2,bridgeSegment1are the three bridge segmentsfrom west to east, respectively. How the TA may test your modelUse
the?Test.java?:publicstaticvoidmain(String[] args){// Set the initial states for the systemAbstractBridgeSystem.BridgeSystemSetting.Bridge3InitialState=
AbstractBridgeSystem.BridgeState.WEST_TO_EAST; // the westmost bridgeAbstractBridgeSystem.BridgeSystemSetting.Bridge3TrafficLightDurationTime=
200;AbstractBridgeSystem.BridgeSystemSetting.Bridge2InitialState= AbstractBridgeSystem.BridgeState.WEST_TO_EAST; // the middle
bridgeAbstractBridgeSystem.BridgeSystemSetting.Bridge2TrafficLightDurationTime= 200;AbstractBridgeSystem.BridgeSystemSetting.Bridge1InitialState=
AbstractBridgeSystem.BridgeState.WEST_TO_EAST; // the eastmost bridgeAbstractBridgeSystem.BridgeSystemSetting.Bridge1TrafficLightDurationTime= 200;// Create a bridge
system objectBridgeSystem sys = newBridgeSystem(“a_bridge_system”); // change it to your bridge system class// Simulate the systemcoordinator r = new coordinator
(sys);r.initialize();System.out.println(“Simulation started”);r.simulate(100);System.out.println(“Simulation finished”);// Show resultssys.printResults();}After
executing it, the simulation should printoutputs similar as below:Simulation startedSimulation finishedEvent number: 21WestGen_Car0 exits from BridgeSegment3 at
24.47212428641887WestGen_Car0 exits from BridgeSegment2 at 34.472124286418875WestGen_Car0 exits from BridgeSegment1 at 44.472124286418875WestGen_Car1 exits from
BridgeSegment3 at 61.79186369796051WestGen_Car1 exits from BridgeSegment2 at 71.79186369796051WestGen_Car1 exits from BridgeSegment1 at 81.79186369796051WestGen_Car2
exits from BridgeSegment3 at 95.11551765680146WestGen_Car2 exits from BridgeSegment2 at 105.11551765680146

find the cost of your paper

Is this question part of your Assignment?

We can help

Our aim is to help you get A+ grades on your Coursework.

We handle assignments in a multiplicity of subject areas including Admission Essays, General Essays, Case Studies, Coursework, Dissertations, Editing, Research Papers, and Research proposals

Header Button Label: Get Started NowGet Started Header Button Label: View writing samplesView writing samples