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 08-02-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default 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
Attached Files
File Type: fsm continuous update.fsm (29.6 KB, 128 views)
  #2  
Old 08-03-2011
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 271
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

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  
Old 08-03-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default

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  
Old 08-03-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default '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.
Attached Files
File Type: fsm WPF.continuous update3.fsm (78.7 KB, 128 views)
  #5  
Old 08-03-2011
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

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  
Old 08-03-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default

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  
Old 08-04-2011
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 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  
Old 08-04-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default

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.
Attached Files
File Type: fsm WPF.continuous update3.1.fsm (78.7 KB, 127 views)
File Type: fsm WPF.continuous update4.fsm (45.0 KB, 117 views)
File Type: fsm WPF.continuous update4.1.fsm (45.0 KB, 135 views)
  #9  
Old 08-05-2011
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

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  
Old 08-06-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default

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  
Old 08-06-2011
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

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


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.