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 04-18-2013
Jay Chou's Avatar
Jay Chou Jay Chou is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 9
Downloads: 74
Uploads: 0
Thanks: 15
Thanked 0 Times in 0 Posts
Rep Power: 0
Jay Chou is on a distinguished road
Default question about "freeoperators"

hi all ,

I got a litter problem when use the command "freeoperators",i build a very simple model which only contain one source and one sink.
In the source's transport resource i add the below code to the Tasksequence example 1 right after the FRUNLOAD task,

inserttask(ts,TASKTYPE_SENDMESSAGE,current,item,0, 0,0,10);
inserttask(ts,TASKTYPE_UTILIZE,item,NULL,STATE_UTI LIZE);

In the message trigger i use freeoperators(centerobject(current,1),msgsendingob ject()); to free the operator.

But when i run the model it seems sometimes the operator can‘t be free correct.

To find out what's wrong , i make some test.

1、i use a queue to replace the sink, it’s work fine

2、in the source exit trigger i use tonum(item) to record the item's num, then
in the message trigger use freeoperators(centerobject(current,1),tonode(getla belnum(current,1))); it's work fine .

Then i go back to the original model, i use arrive schedule to control the time
the operator receive the tasksequence , i found that only when the operator
in the utilizi state receive a new tasksequence the operator can't be free
correct , also test for the up two method, work fine.

if i missed something or make something wrong ?
  #2  
Old 04-18-2013
Cameron Pluim Cameron Pluim is offline
Steelcase, Inc.
 
Join Date: Apr 2012
Location: MI
Posts: 30
Downloads: 27
Uploads: 11
Thanks: 5
Thanked 34 Times in 20 Posts
Rep Power: 120
Cameron Pluim will become famous soon enoughCameron Pluim will become famous soon enough
Default

Jay Chou,

The problem you are having has to do with the fact that you are using the item in reference to the TASKTYPE_UTILIZE, and the item is getting destroyed when it enters the sink. That is why it works when you use a queue instead of a sink, or tonum() to get a reference to the item, because the item either isn't destroyed, or the memory address is getting reallocated to another object/node and is actually pointing to something instead of nothing. If you change you code to be this in the "Use Transport"

Code:
inserttask(ts,TASKTYPE_SENDMESSAGE,current,outobject(current,1),0, 0,0,10);
inserttask(ts,TASKTYPE_UTILIZE,outobject(current,1),NULL,STATE_UTILIZE);
and then free operators using:
Code:
freeoperators(centerobject(current,1),outobject(current,1));
Then you will be referencing a fixed object in your model instead of one that is going to be destroyed.
The Following User Says Thank You to Cameron Pluim For This Useful Post:
Jay Chou (04-18-2013)
  #3  
Old 04-18-2013
Jay Chou's Avatar
Jay Chou Jay Chou is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 9
Downloads: 74
Uploads: 0
Thanks: 15
Thanked 0 Times in 0 Posts
Rep Power: 0
Jay Chou is on a distinguished road
Default

Hi Cameron ,

Thank you for your reply , about why tonum() can work you explain, i found
in the command reference :the second parameter of the freeoperators
command should match the involved1 parameter of the utilize task ,if the
memory address reallocated to another object/node, does the freeoperator() can still work correctly?

another question in my post , when i use freeoperator(TE,item) in my original
model, only when the operator in STATE_UTILIZE he receive a new
sequence, he can't be freeed correctly.Not all of the situation.

attach is my model, if you delete the "Arrival2" in Source 1, the operator will be freeed correctly.

Is there something more i should pay attention?

Thank you,
Jay Chou
Attached Files
File Type: fsm freeoperator.fsm (37.8 KB, 67 views)
  #4  
Old 04-21-2013
Jay Chou's Avatar
Jay Chou Jay Chou is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 9
Downloads: 74
Uploads: 0
Thanks: 15
Thanked 0 Times in 0 Posts
Rep Power: 0
Jay Chou is on a distinguished road
Default

I need help, anyone can gave me some advice?
  #5  
Old 04-23-2013
Jay Chou's Avatar
Jay Chou Jay Chou is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 9
Downloads: 74
Uploads: 0
Thanks: 15
Thanked 0 Times in 0 Posts
Rep Power: 0
Jay Chou is on a distinguished road
Default

why flexsim developer do not answer me this question?do i have some thing wrong?


Thread Thread Starter Forum Replies Last Post
How can you have a visual tool that has a mixture of "protected" and "no select"? thill Q&A 1 03-13-2012 12:44 AM
Question regarding 2 "in-line" gate processes Jamie Santa Ana Container Terminal (CT) Library 3 09-02-2009 07:45 PM
simple question about "Separator" Vic Li Q&A 5 01-14-2009 09:45 PM
Is it possible one object comprised of the function of "combiner" and "separetor"? Vic Li Q&A 1 08-19-2008 04:41 AM
about "no select" and "show parameter window from side bar" qin tian Gripes and Goodies 3 03-21-2008 08:10 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.