Computer Simulation Modeling Jonathan Thaler Department of - - PowerPoint PPT Presentation

computer simulation modeling
SMART_READER_LITE
LIVE PREVIEW

Computer Simulation Modeling Jonathan Thaler Department of - - PowerPoint PPT Presentation

Computer Simulation Modeling Jonathan Thaler Department of Computer Science 1 / 61 Modeling Modeling Modeling is the process of abstraction of a simulation model from the part of the real world it is representing. However, there are an


slide-1
SLIDE 1

Computer Simulation Modeling

Jonathan Thaler

Department of Computer Science

1 / 61

slide-2
SLIDE 2

Modeling

Modeling Modeling is the process of abstraction of a simulation model from the part of the real world it is representing. However, there are an infinite number of models that could be selected within a given range. The art of modeling is to choose the right model for a given purpose by including

  • nly the necessary details and to make the right simplifications.

The goal is to build the simplest model possible to meet the objectives of the simulation study.

2 / 61

slide-3
SLIDE 3

Modeling

Figure: Simulation modeling process.

3 / 61

slide-4
SLIDE 4

Modeling

  • 1. Objectives: know the model purpose to create an appropriate simplification.
  • 2. Inputs and Outputs: inputs define the experimental factors which can be

adjusted, the output are statistics giving answers.

  • 3. Scope and Level of Detail: defines the boundaries of what to include and what

to leave out (more importantly!).

  • 4. Assumptions: incorporate uncertainties about the real world.
  • 5. Simplifications: for reducing complexity are necessary.

4 / 61

slide-5
SLIDE 5

Modeling

Model Correspondence and Validity The degree of correspondence between the computer model and the real world depends on the degree to which the model contains assumptions that are correct, the simplifications maintain the accuracy of the model, and the model design and computer code are free of errors.

5 / 61

slide-6
SLIDE 6

Modeling

Figure: Modeling Framework

  • 1. Understanding the problem situation.
  • 2. Determining the modelling and

general project objectives.

  • 3. Identifying the model outputs

(responses).

  • 4. Identifying the model inputs

(experimental factors).

  • 5. Determining the model content (scope

and level of detail), identifying any assumptions and simplifications.

6 / 61

slide-7
SLIDE 7

Modeling

Model Simplification Model simplification involves reducing the scope and level of detail in a model. Reduced Scope: removing components and interconnections that have little effect on model accuracy. Reduced Level of Detail: representing more simply components and interconnections while maintaining a satisfactory level of model accuracy. The most effective approach is to start with the simplest model possible and to gradually add to its scope and level of detail.

7 / 61

slide-8
SLIDE 8

Modeling

Simplifications Excluding Components and Details omit components which have little effect

  • n accuracy, e.g. birth and death dynamics and public transport in Covasim.

Aggregation of Model Components: representing an operation as black box using a time-delay; grouping of entitites e.g. dynamic scaling in Covasim by aggregating infected. Replacing Components with Random Variables: sample from a random distribution instead of fully modeling for certain emergent properties e.g. making contact in Covasim. Excluding Infrequent Events e.g. birth and death dynamics in Covasim.

8 / 61

slide-9
SLIDE 9

Modeling How to build Agent-Based Models 1

1From The Big Book of Simulation Modeling by Andrei Borshchev. 9 / 61

slide-10
SLIDE 10

Agent-Based Modeling

Agent-Based Modeling Identify which objects of the real system are important for solving the problem and create those same objects in the model. Think of the behaviour in the model. Is supposed to be easier than SD or DES. No need to assume a highly abstract top-down view such as in SD; or to always think in terms of processes as in DES.

10 / 61

slide-11
SLIDE 11

Agent-Based Modeling

To build an ABM, the following questions need to be answered:

  • 1. Which objects in the real system are important? These will be agents.
  • 2. Are there any persistent relationships between the real objects? These will make

up the connections between the agents.

  • 3. Is space important? E.g. are the agents situated in 2D, 3D, discrete,...
  • 4. Identify important events in agents’ life. They may be triggered from outside or

internally by the agent’s behaviour.

11 / 61

slide-12
SLIDE 12

Agent-Based Modeling

  • 5. Define the agents’ behaviour:
  • 1. Does the agent just react to the external events? Use message handling and

function calls.

  • 2. Does the agent have a notion of state? Use a statechart.
  • 3. Does the agent have internal timing? Use events or timeout transitions.
  • 4. Is there any process inside the agents? Draw a process flowchart.
  • 5. Are there continuous-time dynamics? Use SD inside the agent.

12 / 61

slide-13
SLIDE 13

Agent-Based Modeling

  • 6. Do agents communicate? Use message sequence diagrams to design

communication / timing patterns.

  • 7. What information does the agent keep? This will be the memory / state of the
  • agent. Use variables and statechart states.
  • 8. Is there any information / dynamics, external to all agents and shared by all

agents? This is the environment.

  • 9. What output are you looking for? Define the statistics at individual an aggregate

level.

13 / 61

slide-14
SLIDE 14

Field Service Example

14 / 61

slide-15
SLIDE 15

Field Service Example

Problem Statement

A fleet of equiement units (in this example: wind turbines) are distributed geographically within a certain area. Each equipment unit generates revenue while it is working. However, it sometimes breaks down and needs to be repaired or replaced. Maintenance is due every maintenance period. Late maintenance, as well as advanced age, increase the probability of failure. The service system consists of a number of service crews that are based in a single central,

  • r ”home” location. When a service or maintenance request is received by the service system,
  • ne of the crews takes it, drives to the equipment in question, and performs the required work.

During the failure examination, it may turn out that the equipment cannot be repaired, in which case it is replaced. If already due, any currently scheduled maintenance is done after the repair, within the same

  • visit. (The service crew also replace aged equipment even if it is still working, subject to the

replacement policy). Having finished the work, the service crew may take another request and drive to the next unit location, or, if there are no requests, return home.

15 / 61

slide-16
SLIDE 16

Field Service Example

The goal is to find the number of service crews and the replacement policy, that results in maximum profit for the equipment fleet.

16 / 61

slide-17
SLIDE 17

Field Service Example Phase 1: Who are the agents?

What objects in the real system do we observe and are interested in.

17 / 61

slide-18
SLIDE 18

Who are the Agents?

Figure: Agents in the field service model.

18 / 61

slide-19
SLIDE 19

Equipment Unit Agent

Figure: Refining the states of the Equipment Unit Agent.

19 / 61

slide-20
SLIDE 20

Equipment Unit Agent

Figure: Transitions of Equipment Unit Agent.

20 / 61

slide-21
SLIDE 21

Equipment Unit Agent

Figure: Transition triggers of Equipment Unit Agent.

21 / 61

slide-22
SLIDE 22

Service Crew Agent

Figure: Initial states of the Service Crew Agent.

22 / 61

slide-23
SLIDE 23

Service Crew Agent

Figure: Refined states and transitions of the Service Crew Agent.

23 / 61

slide-24
SLIDE 24

Service Crew Agent

Figure: Refined states, transitions and triggers of the Service Crew Agent.

24 / 61

slide-25
SLIDE 25

Service Crew Agent

Figure: Refined states, transitions and triggers of the Service Crew Agent.

A composite state is a group of states that have some common behaviour - for example, the same reactions to events, or common timeouts.

25 / 61

slide-26
SLIDE 26

Field Service Example Agent Communication

Use message sequence diagrams to design communication / timing patterns.

26 / 61

slide-27
SLIDE 27

Agent Communication

Communication instances of the equipment units and service crews:

  • 1. Service crew arrival: a message from a service crew to an equipment unit.
  • 2. Finished: a message from an equipment unit to the service crew.
  • 3. Check if there are requests: A message from a ”central dispatcher” to all

service crews.

27 / 61

slide-28
SLIDE 28

Agent Communication

Figure: Message sequence diagram, version 1. It is unclear who initiates the sequence.

28 / 61

slide-29
SLIDE 29

Agent Communication

Figure: Message sequence diagram, version 2.

29 / 61

slide-30
SLIDE 30

Agent Communication

Figure: Message sequence diagram with two service crews. Dispatcher event notification to the service crews happens conceptually simultaneously, but ordered. Therefore only one the first crew answering the call will take the maintenance / repair task.

30 / 61

slide-31
SLIDE 31

Agent Communication

Communication of the equipment unit with the agent service crew. To establish a temporary link between agents, you can either call the agent’s function connectTo() or simply remember a reference to another agent in a variable. The advantage of a variable is that we can explicitly specify the type of another agent and can identify the kind of relation in case there are many (like best friend, parent, colleagues). Don’t forget to delete the reference (set the variable to null) when the releation- ship ceases to exist.

31 / 61

slide-32
SLIDE 32

Agent Communication

32 / 61

slide-33
SLIDE 33

Field Service Example Global Parts

Information, external to all agents and shared by all agents.

33 / 61

slide-34
SLIDE 34

Environment

Assumptions & Simplifications Uniform randomly distributed equipment units. No road map, driving in straight. Service crew drives on average 500 miles in 24 hours.

34 / 61

slide-35
SLIDE 35

Queue and Dispatcher

Another global part is the request queue and its dispatcher. Nature of the Dispatcher Is the dispatcher passive or active? Does it have state or timing? It simply inserts a message in a queue and immediately broadcasts the notification to all service crews. Stimulus and immediate response without any state or timing. A simple function call suffices.

35 / 61

slide-36
SLIDE 36

Queue and Dispatcher

Figure: The queue of service requests and the service dispatcher.

36 / 61

slide-37
SLIDE 37

Field Service Example Phase 2: Build an initial version of the model in AnyLogic.

That will take a while...

37 / 61

slide-38
SLIDE 38

Field Service Example Phase 3: The missing functionality.

More functionality: maintenance of equipment and dependency of failure rate

  • n equipment age and timeliness of maintenance.

Collect: statistics. Model costs and earnings: calculate revenue brought by equipment and the cost associated with maintaining it. Experiment: with number of service crews and/or replacement policy.

38 / 61

slide-39
SLIDE 39

Equipment Unit Agent

Figure: Changes in the Equipment Unit Agent: maintenance, age and failure rate. A statechart does not remember time when states have been entered: remember it with seperate variables.

39 / 61

slide-40
SLIDE 40

Equipment Unit Agent

Figure: Two parallel activities in the Equipment Unit Agent: statechart and timer. Define timer for maintenance request in a parallel event cycle. We have to cancel sometimes a running timer with ”restart”.

40 / 61

slide-41
SLIDE 41

Service Dispatcher

Figure: The service dispatcher that handles two types of requests.

41 / 61

slide-42
SLIDE 42

Maintenance Scheduling

Model dependency of the failure rate on the equipment age and the timeliness

  • f maintenance.

If maintenance is overdue, the increase of the failure rate is proportional to the

  • verdue period divided by the maintenance period.

Similarly, the equipment older than 3 maintenance periods has the failure rate increased (multiplied) by the age divided by 3 maintenance periods.

42 / 61

slide-43
SLIDE 43

Maintenance Scheduling

Figure: Maintenance Scheduling.

43 / 61

slide-44
SLIDE 44

Field Service Example Phase 4: Model output: Statistics, Cost and Revenue.

Equipment availability. Service crew utilization. Cost of the service system Revenue.

44 / 61

slide-45
SLIDE 45

Statistics

Defining statistics for agent collections will create functions in the Main object

Figure: Statistics defined in the collection of the equipment units.

45 / 61

slide-46
SLIDE 46

Statistics

Figure: Use the time stack chart to display statistics.

46 / 61

slide-47
SLIDE 47

Field Service Example Phase 5: Using the optimizer to find the best solution.

How do we calculate the cost of our service system? How do we calculate the revenue of our service system?

47 / 61

slide-48
SLIDE 48

Model Cost and Revenue Calculation

Calculating the cost of the service system has two components of cost:

  • 1. Cost of service crews: (number of service crews) * (daily cost of a

crew) * (365). Potentially vary the number of service crews during a year, so use the time average number (continuous statistics) of service.size().

  • 2. Per-operation cost of maintenance, repair, and replacement.

48 / 61

slide-49
SLIDE 49

Model Cost and Revenue Calculation

Figure: Equipment Unit statechart updated to calculate the cost of operations.

49 / 61

slide-50
SLIDE 50

Model Cost and Revenue Calculation

Calculating the revenue of our service system: MeanNumberOfWorkingUnits * DailyRevenuePerUnit * 365 MeanNumberOfWorkingUnits is the mean of a statistic bound to equipment.NWorking() DailyRevenue is a mean monetary daily gain depending on the wind intensity and

  • n the price of electricity at the energy market.

50 / 61

slide-51
SLIDE 51

Model Cost and Revenue Calculation

Changing #Agents in ABMs is not as easy as changing the number of resources in an entity flow model - we must control explicitely when to remove an agent:

Figure: Service Crew statechart updated to react to service capacity changes.

51 / 61

slide-52
SLIDE 52

Model Cost and Revenue Calculation

Varying # Crews: Profit virtually same with 4 and 3 crews. Equipment availability considerably higher with 4 crews. No increase of availability with increase of service capacity > 4. Slightly lower profit with service capacity > 4. Less than 3 crews cannot handle 100 equipment units.

52 / 61

slide-53
SLIDE 53

Model Cost and Revenue Calculation

Varying Replacement Policies: 3 crews can successfully maintain high equipment availability and bring high profit if old equipment is replaced after 3 maintenance periods. Hard to manually explore parameter space (crews, policies, months after replacement) → use automatic

  • ptimizer.

53 / 61

slide-54
SLIDE 54

Optimization Experiment

Figure: Define optimization objective function for profit.

54 / 61

slide-55
SLIDE 55

Optimization Experiment

Figure: Define optimization experiment duration.

55 / 61

slide-56
SLIDE 56

Optimization Experiment

Figure: Define optimization parameters.

56 / 61

slide-57
SLIDE 57

Optimization Experiment

Figure: Optimization Results.

57 / 61

slide-58
SLIDE 58

Field Service Example Assumptions & Simplifications

In a properly performed project, each assumption and simplification should be discussed with the client and approved at the model design phases. It is highly recommendable to involve the client in the project on all stages and to make as many iterations with the client and getting as much feedback from the client as possible.

58 / 61

slide-59
SLIDE 59

Assumptions & Simplifications

  • 1. The formula for the equipment failure rate is one of our central assumptions,

along with the exponentially distributed time between failures.

  • 2. Repair, replacement, and maintenance times are triangularly distributed.
  • 3. Repair, replacement, and maintenance have a fixed flat cost.
  • 4. There are no roads in the area. Service crews drive in straight lines directly from
  • rigin to destination at a constant speed. The more correct formulation of this

assumption is ”the driving time is always proportional to the straight line distance from origin to destination”.

59 / 61

slide-60
SLIDE 60

Assumptions & Simplifications

  • 5. There are no shifts or breaks. All service crews work 24 hours a day.
  • 6. Service crews never fail and always have all necessary parts and tools on board.

They never need to drive to the base location to pick up missing stuff.

  • 7. Service crews do not optimize their routes, but just take the next request from the

queue and drive there, whereas they could choose a request from a closest location.

  • 8. Service crews are equipped with a radio and can take new assignments while

driving.

  • 9. Revenues are not modelled stochastically (energy prices, wind).

60 / 61

slide-61
SLIDE 61

AnyLogic Field Service Demo

61 / 61