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
FAQ Downloads Calendar Search Mark Forums Read

FlexSim HC: Q&A Questions about FlexSim Healthcare

Reply
 
Thread Tools Display Modes
  #1  
Old 07-23-2014
Pongjetanapong Pongjetanapong is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 19
Downloads: 5
Uploads: 0
Thanks: 8
Thanked 2 Times in 2 Posts
Rep Power: 78
Pongjetanapong is on a distinguished road
Question getdatastat()

Hi All,

I need some help again.

I'm trying to print some statistic values at the end of the replication. I have a datacollector object that collects the Turnaround time of a group of patients.

Reference to user manual

getdatastat(num stat, obj dataset1, obj datatset2, num p1, num p2, num p3) Description: This command obtains a certain statistic of a dataset. dataset1 is a reference to a node that contains sub-nodes with values that represent all of the values in the dataset. dataset2 is not used and is reserved for future versions. The stat parameter defines what type of statistic is requested. 1 means retrieve the sample mean of the data set. 2 means retrieve the confidence interval half-width of the data set. In this case you need to pass the desired confidence percentage as p1 and the degrees of freedom as p2 (this should be content(dataset1)-1). A stat value of 3 returns the lowest value of a sub-range of the data set. Pass 0,0,0 in as p1, p2, and p3, and it will return the lowest value of the entire set. Otherwise, pass p1 as the start index, p2 as the end index, and p3 as a step parameter, and it will find the lowest value of that sub-range. For example, the parameters p1=3, p2=5, p3=1 will cause the command to find the lowest value between the dataset's 3rd and 5th values inclusive. A stat value of 4 retrieves the highest value in the set with p1,p2 and p3 being the same as with stat value 3. A stat value of 5 will retrieve the sample variance of the data set. A stat value of 6 will return the standard deviation of the data set.

for the second parameter I try referencing to several objects

treenode objectTAT = node("/TurnAroundTime/variables/rawdata",model());
treenode objectTAT = node("/TurnAroundTime/variables",model());
treenode objectTAT = node("/TurnAroundTime",model());


But I just keep getting 0 as a result. As you can see in the attached picture the dataset has 4 columns. How can I reference to the 4th column in the dataset? Is there any other way around?

Thank you!

Ploy
Attached Thumbnails
Click image for larger version

Name:	getdatastat.png
Views:	75
Size:	203.9 KB
ID:	2597  
Reply With Quote
  #2  
Old 07-23-2014
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 635
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hi,

your reference path starts a sub tree too late. Even the node DataCollectors belongs to the path, which starts at the subtree model. If you want to know, which branches a tree consists of, you can use the command nodetopath or nodetomodelpath in a script window. You define the reference obj. with selected object in the context menu of the tree window. The second parameter is a flag. This determines wether you get a path of the ranks of the branches or the names of each rank.

Even if you correct your path, the function getdatastats might not be working. I don't know it exactly, because I haven' tested. But I think this function belongs to a different approach collecting data in previous Flexsim versions, when the data was stored in sub nodes. In newer Versions we use the datatype bundle instead of nodes. As I stated, I am not sure.

Jörg

Last edited by Jörg Vogel; 07-23-2014 at 11:50 PM. Reason: information on getdatastats
Reply With Quote
The Following User Says Thank You to Jörg Vogel For This Useful Post:
Pongjetanapong (07-24-2014)
  #3  
Old 07-24-2014
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 766
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

You can also right click a node and choose "Edit>Copy Path to Clipboard".

Then you can paste the path into node without any reference path. In your case that's probably going to look like this:
Code:
node("MODEL:/Tools/DataCollectors/TurnAroundTime>variables/rawdata")
If you wanted the mean you'd do something like:

double mean=getdatastat(STAT_MEAN,getbundlenrentries(tatr awdatanode),getbundlevalue(tatrawdatanode,count-1,"Column1"));

However, it looks like that bundle is going to store all replication and scenario data for a child instance, so it might be simpler to use a query function.

Last edited by Jason Lightfoot; 07-24-2014 at 06:01 AM. Reason: typo
Reply With Quote
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
Jörg Vogel (07-24-2014), Pongjetanapong (07-24-2014)
  #4  
Old 07-24-2014
Pongjetanapong Pongjetanapong is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 19
Downloads: 5
Uploads: 0
Thanks: 8
Thanked 2 Times in 2 Posts
Rep Power: 78
Pongjetanapong is on a distinguished road
Default

Hi Jason,

Thank you for your reply. I think Flexsim HC is a bit different from general Flexsim. I cannot right click to get the path in HC and the getdatastat() functions are used differently too. The first parameter are numbers that determine stat types (STAT_MEAN is not recognized by HC) and the 2nd parameter takes subnode that contains the data. If I understand correct getbundle functions only return one specified value in the data bundle right?

Can you please also explain a little bit more about using a query function? I need to automate my model, run scenario and retrieve several performance measures rather than exporting bunch of output into excel.

Thank you for your help!
Ploy
Reply With Quote
  #5  
Old 07-25-2014
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 766
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

I'd check first to see if the replication and scenario columns are populated with different values or just left over from FlexSim version 5 (before child instances did the replications). If the rawdata gets cleared at reset you should be able to use getbundlestat. STAT_MEAN is defined as 1 so you can try that. Yes, getbundlevalue returns one value, but we use the keyword 'count' which allows the function to interate the expression for all entries.

If the data doesn't get cleared between replicatons you can just scan through the bundle data at the end of the replication and count the number of entries for that replication and sum the turnaround time. It's a small bit of code to do that.

HC probably doesn't have functions for the query method yet.
Reply With Quote
  #6  
Old 07-28-2014
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: 405
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

The getdatastats() command was totally overhauled in a more recent version of the FlexSim engine that the current release of HC does NOT use. The newer version of the getdatastats() command (that HC hasn't adopted yet) is a useful tool for users; however the earlier version of the command that HC still uses is basically useless for an end-user because it requires data be in a very specific format using subnodes and the documentation for the command is limited. The command was previously intended for developer use only.

Ploy, if you need help getting a DataCollector in conjunction with a user-defined dashboard widget (i.e. + > Model > Other > User-Defined) recording and displaying what you'd like, please post a complete description of the data you want (and a model containing your attempts) and I'll see if I can help you!
Reply With Quote
The Following 2 Users Say Thank You to Cliff King For This Useful Post:
Jason Lightfoot (07-29-2014), Pongjetanapong (07-29-2014)
  #7  
Old 07-29-2014
Pongjetanapong Pongjetanapong is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 19
Downloads: 5
Uploads: 0
Thanks: 8
Thanked 2 Times in 2 Posts
Rep Power: 78
Pongjetanapong is on a distinguished road
Default

Hi Cliff,


Thank you for the clarification, my objective really is to automate the experiment outside of FlexSim (planning to integrate with optimizer in the future). What I need is to get raw data/stat data (even better) out and input data points back in Flexsim automatically. I also tried using COM object in one of your post but I guess it does not support FlexSim HC right?


I've actually thought about getting a customized training on this. Could you please let me know how it works? my e-mail is [email protected]


In the mean time, please see the attached model. This is a cytology department model. The performance measure of the model are the turnaround times of PCI1 and PCI2 (mean and confidence interval). I've collected data using Data collector > Turnaroundtime.
The other performance measures are number of cancellations stored in the global variables (MeetingAbsence, Tcancel, Discardprep)


The experiment variable is the Priorate (Priority accumulation rate) assigned in the global variable.
Attached Files
File Type: fsm Controlunit_V1.fsm (353.0 KB, 45 views)
Reply With Quote
  #8  
Old 07-30-2014
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: 405
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

Ploy,

Very few (if any) of our FlexSim HC users feel comfortable with programming, so we do all we can to shield them from the need to write code. For this reason, there are several features common to standard FlexSim that we either hide or only make available through the tree view. By the way, to view the entire tree in HC, you must hold down the Ctrl key when clicking the Model Tree View menu.

Because FlexSim HC uses the same underlying engine as standard FlexSim, all interfacing features (e.g. COM objects, ODBC, Excel macros, DDL's etc.) should be available.

I personally know very little about FlexSim's COM object capabilities, so receiving training from me (or anyone working directly on HC development) would not be a good idea. The person you need to contact is Anthony Johnson (email protocols at FlexSim are standard for everyone, so you can guess his email address).

I look forward to checking out your model!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -6. The time now is 08:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.