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 |
|
Downloads |
Flexsim Student Forum Forum for discussion for Flexsim Students using the Flexsim Textbook. |
#1
|
|||
|
|||
Problem Movement of crane
For the scenario in the attached file:
-when the new box gone through the processor in each station, it will convert from itemtype1 to itemtype2, brown color to blue color. What we expect to happen is: -when the blue color box is finished and waiting on the queue, it will send message to the crane to let it perform the new tasksequence which has been coded in the trigger/on message. -The code for the queue to send messagethe code has applied to all the queues infront of the two conveyors) /**Custom Code*/ treenode item = parnode(1); treenode current = ownerobject(c); int port = parval(2); if (itemtype(current)==2) { sendmessage(centerobject(current, 1),current); } -The code in crane: Trigger/on message: /**Custom Code*/ treenode current = ownerobject(c); treenode item = parnode(1); treenode nts = createemptytasksequence(current,0,0); inserttask(nts,TASKTYPE_TRAVEL,centerobject(curren t, 1),NULL); inserttask(nts,TASKTYPE_LOAD,item,centerobject(cur rent, 1)); inserttask(nts,TASKTYPE_TRAVEL,msgsendingobject(), NULL); inserttask(nts,TASKTYPE_LOAD,item,msgsendingobject ); inserttask(nts,TASKTYPE_TRAVEL,node("Queue3", model()),NULL); inserttask(nts,TASKTYPE_UNLOAD,item,node("Queue3", model())); dispatchtasksequence(nts); |
#2
|
||||
|
||||
Hello,
may it be possible for you to attach a model which contains only one process and not all. Thanks! If you write a code which prints a text to the output console, you will see that the OnMessage Trigger of the Crane8 is never executed. Your model behave different as you expect. Please build a smaller model. Test a normal material flow without any changes to the flow. Develop a small part of the flow you want to exchange. Anytime you can place in the source code commands which print text or numbers to the output console to test what happens in your code. Another method is to use the debugger with the break points. Another hint the command line Code:
treenode item = parnode(1); Code:
treenode item = tonode(msgparam(1)); |
The Following 2 Users Say Thank You to Jörg Vogel For This Useful Post: | ||
RalfGruber (05-06-2015) |
#3
|
|||
|
|||
Coding and Conditions
Hi,
Thank you for your answer. To be honest, actually I just started to learn the coding by myself, which I feel very confused about most of the codes and condition when using them. Due to some reason and time constraint, I need to solve this problem as soon as possible. Thus, would you mind explain to me what is the point of converting the number to a pointer? As when I put that into my code on crane-trigger-on message.... It seems that have no impact on the model. |
#4
|
||||
|
||||
Hi Chris,
in the source code you are sending a message all transmitting parameters have to be numbers. The reference item is a pointer. But you can convert it to a number by the command tonum(obj). Therein is obj. the item. Code:
double itemAsNumber = tonum(item); Code:
senddelayedmessage(ToObject, NumberDelayTime, FromObject, ItemAsNumber); In the OnMessage Trigger you convert the number back to a pointer with the command tonode(num). Code:
treenode item = tonode(msgparam(1); ps: I can't look into your model right now. Jörg |
The Following 2 Users Say Thank You to Jörg Vogel For This Useful Post: | ||
sagar bolisetti (05-10-2015) |
Thread | Thread Starter | Forum | Replies | Last Post |
Model 3d view only updates on mouse-over movement | Christian Norregaard | Q&A | 2 | 09-05-2013 02:21 AM |
Robot base movement | Manoj Kumar | Q&A | 1 | 01-09-2013 06:03 AM |
Coordinated task movement error | shashanktrivedi | Q&A | 1 | 05-09-2011 08:49 AM |
Crane Logic: How to find out what a crane currently is doing? | Tom David | Q&A | 5 | 06-02-2008 11:57 PM |
Changing the direction of flowitem movement on a processor | shivrash | Q&A | 3 | 04-09-2008 10:31 PM |