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
|
|||
|
|||
Continuous update
Hi,
I am trying to simulate a model in which a label "timeRemain" on each item is updated every 10 seconds. On creation, label is set to the total remaining process time for an item. As the item passes through the processor(with processing time=100s) the label should decrease by 10 every 10s like 100...90..80..70... How can that be done? Chieng |
#2
|
|||
|
|||
Hello Chieng,
I am not sure why you would want to decrease the label every 10 seconds, but if you would like to display the remaining process time when the processor is processing an item, you could add a VisualTool, that displays text and connect it to your processor. You would have to write code yourself for the text to display and check if there is an item on the processor or not. To determine the remaining time you can use the formula: double ProcessTime = 100; double RemainingProcessTime = ProcessTime - ( time() - getentrytime( item ) ); |
The Following User Says Thank You to Esther Bennett For This Useful Post: | ||
Chieng Kai Seng (08-03-2011) |
#3
|
|||
|
|||
Thanks, Esther. I will try to put those codes to use. The reason I am doing this is to simulate in a more continuous way in this particular model I am working on. It provides some level of accuracy.
|
#4
|
|||
|
|||
'item' and 'first(current)'
In this model, the label on the flowitems are updated as time passes. I need to understand a concept. Please look at /tank2/onMessage trigger. Why is it that if I use 'item' instead of 'first(current)' the label stops to be updated in a continuous manner? Please ask if I have not explained clear enough.
|
#5
|
|||
|
|||
You've not 'assigned 'item' to a passed parameter for the item.
Try using 'item' instead of 'fromobject' when you send the message, and then in the message use 'msgsendingobject' where you want to refer to the item. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Chieng Kai Seng (08-03-2011) |
#6
|
|||
|
|||
Hi Jason,
Thanks for replying but I don't see how that can solve the problem. I need 'item' on /tank2/onMessage to refer to item currently on tank 2. 'first(current)' is able to reference that but 'item' did not. How can I get 'item' to do the same as 'first(current)' did? I've tried declaring [treenode item=parnode(1)] at the /tank2/onMessage trigger. What does parnode(1) mean anyway? Chieng |
#7
|
|||
|
|||
I said you could use msgsendingobject - parnode(1) changes based on which trigger is getting parameters passed in.
As for solving your problem, maybe you could give a better overview of what you're trying to achieve. I believe what I've seen in your model also doesn't reflect the very good advice that Esther gave. With respect, we're trying to help, but you don't seem to be listening. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Chieng Kai Seng (08-04-2011) |
#8
|
|||
|
|||
Jason,
Wow. I opened up this thread early in the morning and your last sentence felt like a spank in my face. LOL. I have taken Esther's advice and implement it in another model of mine. But there were some other errors I need to correct before the model works fine. Such as the 'item' and 'first(current)' issue I posted. So I apologize if I don't 'seem' to be listening, Jason. Fact is, I am listening. I feel I must explain that I'm really new to Flexsim. I don't get the idea of parnode(1). Is parnode(1)=item in every case? I've gone through the help file and it says little about parnode, parval, ownerobject(c). If I know what those terms mean I might be able to exploit them better. To the point, the issue I'm having right now is that the onMessage trigger on the 'tanks' except for 'tank 1' (refer to model) does not execute the way I'd like it to. To simplify things, 'source 5' creates a flowitem every second only to trigger the 'onMessage' on all the tanks except for tank 1. I need the onMessage trigger on the tanks to: 1. increment the label 'timeRemain' for flowitem if a flowitem is on them.(you can run the model in 3 and click on flowitem, check label to view this. the label is inc every second.) 2. carry out a code that decides when to openinput on tank 1. The logic seems fine to me. Problem is the syntax. msgsendingobject, as suggested by you seems to reference the object created by source5. I need to reference the item on the tanks, if there is one on them. Do correct me if I'm wrong. I'll attach 3 models of wetbench, a tool in semiconductor fabs here. I model the tools for fabs. The model shouldn't allow any blocked% in any of the tanks. WPF.continuous update3.1 - to show what i mean by updating the label every second. The other 2 models aren't able to to this. blocked% does not exist. WPF.continuous update4 - I have declared 'treenode item=parnode(1)' and used item to reference item on tanks, if there is one. but blocked% exists for some of the tanks. WPF.continuous update4.1 - using msgsendingobject. blocked% exists. I'm doubtful about what the msgsending object references. I need it to reference item on tanks. I'd appreciate any help there is. Cheers, Chieng. |
#9
|
|||
|
|||
Aha! That's good - thanks for explaining. Since you're quite new it seems a shame that we need to explain the ins and outs of passing parameters etc, but since you're already looking at that and trying to copy code from one place to another I think it's worth explaining in some detail.
The parameters are numbered and in most triggers are accessed by the functions parval(n), partstr(n) and parnode(n), (where n is the parameter number) which will cast the type of the parameter for you (double, string and treenode respectively). Depending on which trigger you're looking at, they get different parameters passed in - some pass in the item - others do not. Each trigger template tells you what parameters you can expect to be passed in and in which order, and the manual also lists these. Now looking at the message sending function definitions (the parameter hint pops up when you start typing a parenthesis or comma after the function name) you'll see you're asked for the message sender, and up to 3 parameters. The message is slightly different from the other triggers in that the parameters are not normally accessed using parval/str/node and instead have predefined macros for accessing them: msgsendingobject , which is an object and msgparam(1)...msgparam(3) which are doubles. There's only three parameters because the event information currently doesn't support the passing of more - unlike the nodefunction call, which does. Now for ownerobject(). This does two things. First, it checks if you've used ownerobject on the node before, and if not, it stores into a cache which Flexsim object contains that node you pass in as a parameter. Secondly it returns the value of that cache ie. which Flexsim object contains it. In the tree a Flexsim object is the one with the square, triangle and circle icon. In triggers the node you pass in is usually 'c' which is usually the trigger code node itself. There are other places in Flexsim where 'c' isn't the code node, but instead refers to the object that contains it, and it can actually be any node in the tree. So if you just want to fire a message on another object which looks at its own item first(current) is fine - you'll probably just want to add a check that the object exists (since the processor could be empty). treenode item=first(current); if (objectexists(item)) inc(label(item,"timeRemain"),-1)(Personally I don't like the synchronous model approach you describe as it just creates lots more events in the system than you might need. Can you not instead just calculate and then schedule an event for when you want something to happen? |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Chieng Kai Seng (08-06-2011) |
#10
|
|||
|
|||
Jason,
Thanks for the explanation! That gave me a better idea. As for the calculating and scheduling, I am having problem with that but I guess I'll try to settle that. One question. Are there cases where time passes before a task is carried out? Say in a model with lots of codes to be executed at a specific time. Is there a chance the the model will just miss the codes because time has moved on? Discrete event simulation shouldn't have that sort of problem, am I right? Chieng |
#11
|
|||
|
|||
The only events similar to those you're describing are those created for drawing objects - that's why nothing that will affect the model logic should be placed in the OnDraw code.
|
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Chieng Kai Seng (08-07-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
GUI Combo Box Update | Chris Moon | Q&A | 3 | 04-14-2011 03:55 PM |
update flexsim 5.10,can not save model | LINWEIXU | Q&A | 5 | 01-31-2011 07:11 AM |
Update of global variables | BenjaminBuecklein | Q&A | 4 | 11-18-2008 03:43 AM |
Update Flexsim.com | Lolke Koopmans | Marketing and Sales Information | 12 | 10-17-2008 02:09 PM |
can I use an edit box entry to update multiple labels? | KelvinHo | Q&A | 10 | 03-28-2008 07:17 AM |