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 Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 01-20-2010
Rhonda MacIntyre Rhonda MacIntyre is offline
Flexsim User
 
Join Date: Sep 2008
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 0
Rhonda MacIntyre is on a distinguished road
Default Dynamically assigning processors/people to time table

I need to be able to assign processors and/or people to a predefined time table at the start of a model run based on user input. I've managed to point to the "members" variable of the time table and insert node(s), but I don't know how to get a pointer to the processor in there. Also, should I be setting the "time tables" variable in the processor instead? or do I have to set both?
  #2  
Old 01-20-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Below is code that will add an object to a time table. This should be done before the model is reset. It gets reference to the time table and the object using a string path. If you are using this in a custom GUI, then you can use commands such as getviewtext() or getnodenum() to read the paths from widgets in your GUI. If you are doing it through a custom excel import, then you can read the paths from cells that are read. Depending on where the user is inputting this information depends on how you get a reference to the object, but the code below shows how you can do it with a string literal path and the node() command.

treenode thetimetable = node("/Tools/TimeTables/TimeTable3",model());
treenode theobject = node("/Processor13",model());

treenode members = node(">variables/members",thetimetable);
nodeinsertinto(members);
nodeadddata(last(members),DATATYPE_COUPLING);
setname(last(members),getname(theobject));

treenode timetables = node(">variables/timetables",theobject);
nodeinsertinto(timetables);
nodeadddata(last(timetables),DATATYPE_COUPLING);
setname(last(timetables),getname(thetimetable));

nodejoin(last(members),last(timetables));
  #3  
Old 01-20-2010
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: 773
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 think that's the memberadd function - looks like same thing :

memberadd(obj childobject, str parentname, num type)
Description:
If type = 1, then the childobject is added as a member to a Time Table named "parentname".
If type = 2, then the childobject is added as a member to a MTBFMTTR object named
The Following 5 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (01-20-2010)
  #4  
Old 01-20-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

That is much easier:

treenode theobject = node("/Processor13",model());
memberadd(theobject,"TimeTable3",1);
  #5  
Old 01-26-2010
Rhonda MacIntyre Rhonda MacIntyre is offline
Flexsim User
 
Join Date: Sep 2008
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 0
Rhonda MacIntyre is on a distinguished road
Default question on dynamically creating MTBFMTTR group

Thank you very much for the information and examples. This has worked well to dynamically assign members to predefined TimeTables in my model.

Now, I need to do something similar but slightly more complex with MTBF MTTR 'groups'. I can add members to predefined MTBF MTTR groups, but I need to create my MTBF MTTR groups dynamically while the model is running. For instance, I have a global table which contains all of the machine reliability data for a list of machines/processors in the model. On the GUI, the user can choose to either use the reliability data or not use it, for a particular model run. If the user chooses to use the reliability data, I need to read through the equipment/data table and create a MTBF MTTR group for each piece of equipment, add the piece of equipment as a member of that group, and add the appropriate reliability functions to the mtbf, mttr, and other variables under the new MTBF MTTR group. (I have data for Preventative Maintenace (PM) MTBF, PM MTTR, Machine Time Failure (MTF) MTBF, MTF MTTR, Calendar Time to Failure (CTF) MTBF, CTF MTTR, Number of Failures, Mean Wait Time, and Mean Wait Time Multi Runs).

I have figured out how to create a new MTBF MTTR group, however, it shows up as just an object and does not have any of the attributes (classes, variables, behaviour, spatial, special) that are created when an MTBF MTTR group is created by using the option under the Tools menu. I used the following code to create the new MTBF MTTR group:

treenode theMTBFMTTR = node("/Tools/MTBFMTTR",model());
nodeinsertinto(theMTBFMTTR);
nodeadddata(last(theMTBFMTTR),DATATYPE_OBJECT);
setnodename(last(theMTBFMTTR),"testname");

Can you please tell me how to make a fully-functional MTBF MTTR group called "testname" and to set the appropriate machine reliability functions attached to it? The other thing I noticed about MTBF MTTR groups created from the MTBFMTTR option on the Tools menu is that there is some Flexscript byte code underneath the mtbf and mttr (and maybe other) variables. Is this something that would have to be inserted by a program creating an MTBF MTTR group dynamically?

thank you.
  #6  
Old 01-26-2010
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: 773
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

Here;s the code if you don't know that the Tools or MTBF folder exists:

Code:
 
if (not(objectexists(node("/Tools",model()))))
{
nodeinsertinto(model());
setname(last(model()),"Tools");
}
if (not(objectexists(node("/Tools/MTBFMTTR",model()))))
{
nodeinsertinto(node("/Tools",model()));
setname(last(node("/Tools",model())),"MTBFMTTR");
}
createinstance(node("/MTBFMTTR",library()),
node("/Tools/MTBFMTTR",model())
);
updatetoolsmenu();

if you know they're there then it's just :

Code:
 
createinstance(node("/MTBFMTTR",library()),node("/Tools/MTBFMTTR",model()));
Then you just have to set the flexscript using setnodestr(getvarnode(<MyMTTR>,<varname>),<myCode> ) and use buildnodeflexscript which will generate that byte code for your new code string.
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post:
Tom David (01-27-2010)
  #7  
Old 01-28-2010
Rhonda MacIntyre Rhonda MacIntyre is offline
Flexsim User
 
Join Date: Sep 2008
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 0
Rhonda MacIntyre is on a distinguished road
Default Setting mtbfstates variable from code

Thanks again, creating the MTBFMTTR tables from within code is working well.

I am able to set several of the variables (mtbf, mttr, firstmtbf), but cannot figure out how to set the mtbfstates variable of the newly-created MTBFMTTR table. I need to set the mtbfstates variable to 4 states (processing, busy, blocked, waiting for operator).

I appreciate any suggestions. Please let me know if this information is contained in any reference material - user documentation, training materials or tutorial.
  #8  
Old 01-28-2010
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi,

This code will show you how to add states from code:
Code:
treenode obj=getvarnode(node("/Tools/MTBFMTTR/MTBFMTTR1",model()),"mtbfstates");
setnodenum(obj,1);        // Apply MRBF to states
nodeinsertinto(obj);
nodeadddata(last(obj),DATATYPE_NUMBER);
setnodenum(last(obj),2);    // MTBF on processing        
setnodename(last(obj),"_processing");    // Set name on the node
Good why to find how something is done by code is to right click with the mouse and choose View->Explore Sructure.
Normally you will find a lot of good information on how to do different things.

Lars-Olof
The Following 6 Users Say Thank You to Lars-Olof Leven For This Useful Post:
Tom David (01-28-2010)


Thread Thread Starter Forum Replies Last Post
Dynamically assigning 3D shapes to flowitems Iulian Marin Ion Q&A 9 08-05-2013 08:17 PM
Regarding the function of Time table in Flexsim Ong Wu Sheng Q&A 2 12-16-2009 08:58 AM
How to clear the people from conveyor Ong Wu Sheng Q&A 7 12-09-2009 10:21 AM
How to process with 2 processors at the same time wilmermoncada Q&A 2 11-25-2009 08:34 AM
Can I make a column of a global table to type table? qin tian Q&A 0 10-01-2008 09:27 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.