ATTENTIONThis 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 |
#1
|
||||
|
||||
Memberadd
Hi,
I try to dynamicaly add members to the MTTRMTBF list. As they add themself 'onReset' I have to clear the list in a 'userevent' first. I can now see the member in the 'MTBFMTTR'-table but the breakdown is not executed? Please take a look at the attached modell...
__________________
kind regards Nico. |
#2
|
|||
|
|||
Hi Nico,
I had the same problem in a model I created and using buildnodeflexscript helped for me. Try to add this line after your code: buildnodeflexscript(node("/Tools/MTBFMTTR/MTBFMTTR",model())); Lars-Olof |
#3
|
|||
|
|||
Hi,
I tested my suggested solution and it does not work. I know that it worked in version 4.3 to use memberadd, but it look likes it is not working in 4.32. Will check my old model to see if they still work with memberadd. Lars-Olof |
The Following User Says Thank You to Lars-Olof Leven For This Useful Post: | ||
Nico Zahn (08-28-2008) |
#4
|
|||
|
|||
Hi Nico,
If you un-check the option to break down members individually it will work. If you do not, then unfortunately you are adding the members after the MTBF has been scheduled (at reset). This is because the MTBF is in the Tools folder and is higher in the tree than the processor. Note - to see what's really happening with the scheduled events, you should really have the UserEvents folder above the MTBFMTTR folder within the Tools folder. This way the members are cleared out before the MTBF is scheduled and you don't get a false positive event created. The only way to add individually breaking members dynamically is to accompany the memberadd function call with a createevent call on the MTBF that samples the breakdown time and sets involved to be the processor member coupling, with the correct event code : Code:
treenode current = ownerobject(c); string mtbfname="MTBFMTTR"; treenode mtbf=node(concat("/Tools/MTBFMTTR/",mtbfname),model()); memberadd(current,mtbfname,2); treenode coupling=last(getvarnode(mtbf,"members")); createevent(mtbf,nodefunction(getvarnode(mtbf,"firstmtbf")),EVENT_BEGINDOWNTIME,"DownEvent",coupling); |
The Following 6 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (08-27-2008) |
#5
|
|||
|
|||
Similarly, if you dynamically add a member to a timetable (with the memberadd function) that is already in a down state then the newly added member will not go down until the next down cycle. The timetable object also does not memorize its current state (up or down). If you need the new member to go down immediately like other members then you have to yourself memorize the state of the timetable (for example in a label) and , if down, explicitly call the timetable's downfunction on this member. We recently use the following C++ code to do it
Code:
... memberadd(newmember,timetablename,1); if(timetableisdown) { TimeTable *thisobjectdata=&o(TimeTable,timetable); nodefunction(thisobjectdata->node_v_downfunction,tonum(newmember),STATE_ON_BREAK,0, 0); } ... |