ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Healthcare (HC) > FlexSim HC: Q&A
Downloads

FlexSim HC: Q&A Questions about FlexSim Healthcare

  #1  
Old 04-17-2013
markbol markbol is offline
Flexsim User
 
Join Date: Apr 2013
Posts: 1
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
markbol is on a distinguished road
Default simulation of an inhomogeneous poisson process

Hello everybody
I've been working on a model with an inhomogeneous arrival process. For this I created a code for an inhomogeneous poisson arrival. It works in the R script, but when I use a similar code in flexsim HC, the results are not the same. Attached are the test model and code of the R scripts. Is somebody able to explain the diffrence? Error/diffrence in my flexsim code?

model:

rm(list=ls())

DPfad <- "C:\Users\" # the path of the method arrival
setwd(DPfad)
source("arrival.R")

t=0
#lambda=runif(24)
lambda = 1:6
lambda = rep(lambda,4)

event=c()
for(i in 1:1e5)
{
iat=arrival(t,lambda)

t=t+iat
event=c(event,t)
}

hist(event%%24,breaks=0:24,freq=FALSE)
points(0:23+0.5,lambda/sum(lambda))

# comparison with flexsim data
## load data
sim <- read.csv(paste(DPfad,"test_model2.csv", sep=""), sep=",")

# transform minutes into hours
sim$TIME <- sim$TIME/60

# create a histogram
hist(sim$TIME%%24,breaks=0:24,freq=FALSE)
points(0:23+0.5,lambda/sum(lambda))

#------------------------------------------

arrival:

# Funktion zur Berechnung der nächsten Interarrival Time
arrival=function(t,lambda)
{
t0=t # aktuellen Zeitpunkt speichern
p=runif(1) # Zufallszahl ziehen
F=0; # Initialisierung der Verteilungsfunktion
l=lambda[trunc(t%%24)+1] # aktuelles lambda ermitteln
dt=ceiling(t)-t # Zeitspanne bis zum nächsten lambda
P=(1-exp(-l*dt)) # Dichtefunktion der aktuellen Zeitspanne

while(F+(1-F)*P {
F=F+(1-F)*P # Verteilungsfunktion erweitern
t=t+dt # Zeitspanne hinzufügen
l=lambda[trunc(t%%24)+1] # aktuelles lambda berechnen
dt=1 # aktuelle Zeitspanne
P=(1-exp(-l*dt)) # Dichtefunktion der aktuellen Zeitspanne
}

t=t-log((1-p)/(1-F))/l # letzte angebrochene Zeitspanne hinzufügen

return(t-t0) # berechneter Zeitunterschied
}


Thanks for your respond.
Attached Files
File Type: fsm test_model2.fsm (40.5 KB, 106 views)
  #2  
Old 04-30-2013
Cliff King's Avatar
Cliff King Cliff King is offline
Vice President Technical Services
 
Join Date: Jul 2007
Location: Utah
Posts: 272
Downloads: 158
Uploads: 14
Thanks: 102
Thanked 304 Times in 110 Posts
Rep Power: 412
Cliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud ofCliff King has much to be proud of
Default

If you're suspecting a mismatch in code translation, have you tried putting breakpoints into your code to check the value of variables at various steps in the code? Go to Tools>Debugging>Breakpoints to turn on breakpoints, and then simply click to the left of each line in the interarrival time code window to add a breakpoint (red dot will appear). As you run the model, the breakpoint manager window will popup allowing you to further investigate your code.
  #3  
Old 05-01-2013
Lou Keller Lou Keller is offline
Flexsim Software Products, Inc.
 
Join Date: Mar 2010
Posts: 13
Downloads: 0
Uploads: 0
Thanks: 2
Thanked 50 Times in 13 Posts
Rep Power: 154
Lou Keller has a spectacular aura aboutLou Keller has a spectacular aura about
Default

There may be a much easier and less cumbersome way to model the nonhomogeneous arrival process you're dealing with using a Log-Linear function. I'm assuming, of course, that your underlying pattern is Poisson distributed. Whatever the case, if you'd send me your data, I might be able to create the arrival pattern you're looking for.

Thanks,

Lou Keller
The Following User Says Thank You to Lou Keller For This Useful Post:
Cliff King (05-02-2013)
  #4  
Old 06-12-2013
hu xiaoling hu xiaoling is offline
Flexsim User
 
Join Date: May 2013
Posts: 2
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
hu xiaoling is on a distinguished road
Default

Quote:
Originally Posted by Lou Keller View Post
There may be a much easier and less cumbersome way to model the nonhomogeneous arrival process you're dealing with using a Log-Linear function. I'm assuming, of course, that your underlying pattern is Poisson distributed. Whatever the case, if you'd send me your data, I might be able to create the arrival pattern you're looking for.

Thanks,

Lou Keller
hi i am a student in tp and doing a project for a hospital by using the flexsim hC, i do not know how to use the expertfit to create the arrival patten . i have the visiting data, could u kindly help me? thx


Thread Thread Starter Forum Replies Last Post
Picking process Simon Farsah Q&A 9 03-23-2015 06:55 AM
How to set the process time ...? Steffen Hainke Q&A 3 08-24-2011 03:35 AM
Banking Process simulation using Flexsim Simon Farsah Q&A 1 08-06-2010 06:05 AM
different process times mohanboyapati Q&A 1 11-02-2009 11:59 AM
Re-entrant Process ankus d Q&A 2 02-09-2009 07:53 PM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.