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-05-2008
Yasemin Vatandas's Avatar
Yasemin Vatandas Yasemin Vatandas is offline
Flexsim User
 
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 36
Downloads: 9
Uploads: 0
Thanks: 29
Thanked 3 Times in 3 Posts
Rep Power: 146
Yasemin Vatandas is on a distinguished road
Default Problem with user event

Hello,
I've been trying to develop a user event, but couldn't succeed so far.

My model contains two sources, creating different flowitems going through different processes. However, flowitems use the same operator to be transported and to be processed.
My aim is to create a global "request operator table" and to optimize this list of requests using different strategies.
As a first step, Queue FR's write the flowitem-related data to a global table via 'OnEntry Trigger'.

As the second step, I try to create a user event, which will look up the table periodically and schedule the jobs for that period.Consequently, custom TS's will be assigned to the operator, to process the given schedule.

The first step of the event is to stop creating items at the moment of scheduling. Next, jobs with priority are going to be selected and written to a second table. This second table will serve as the schedule and some more optimization steps are going to be applied. But I could't get that far because I couldn't transfer the data from Table1 to Table2 at the first step.
There is a problem with my code but couldn't find out where.
I need your advices.

I attach my model and code, so that it can be understood better.
Thanks in advance

Code:
 
stopobject(node("/IncomingGoodsSource",model()),4);
stopobject(node("/OutgoingGoodsSource",model()),4);
int i  = 1;
int j  = 1;
double Check  = (geteventtime("ScheduleJobs",2)+500.0000);
int numberofjobs  = gettablerows("Request Operator");
while(i < numberofjobs)
{
 int RD  = and(gettablenum("Request Operator",i,2)==1,gettablenum("Request Operator",i,7)<=Check);
 if (RD == 1)    // Search for Type 1 jobs
 {                  // Transfer data to table 2
  settablenum("Schedule",j,1,gettablenum("Request Operator",i,1));
  settablenum("Schedule",j,2,gettablenum("Request Operator",i,2));
  settablenum("Schedule",j,3,gettablenum("Request Operator",i,3));
  settablenum("Schedule",j,4,gettablenum("Request Operator",i,4));
  settablenum("Schedule",j,5,gettablenum("Request Operator",i,7));
  settablesize("Schedule",j+1,5);
  j=j+1;
  settablenum("Request Operator",i,2,3);
 }
 else
 {
  i=i+1;
 }
}
resumeobject(node("/IncomingGoodsSource",model()));  //Resume creation
resumeobject(node("/OutgoingGoodsSource",model()));
Attached Files
File Type: zip Model.zip (63.4 KB, 318 views)
  #2  
Old 08-05-2008
Pablo Concha Pablo Concha is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 104
Downloads: 100
Uploads: 1
Thanks: 103
Thanked 52 Times in 37 Posts
Rep Power: 232
Pablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nice
Default

Hello,

-i'm no expert on code, but i checked the model and i would change the i variable you define, because "i" is a command in flexsim (it's on color blue on the code editor). Another thing is i printed the value of geteventtime("ScheduleJobs",2) to check it out and it says value zero when the user code executes.. so the condition gettablenum("Request Operator",xx,7)<=Check would never meet. Changed the "Check" for something it would meet condition (double Check = time()+500.0000 and it does work the table search and write

hope this helps ...

regards

Pablo Concha E.
The Following User Says Thank You to Pablo Concha For This Useful Post:
Yasemin Vatandas (08-06-2008)
  #3  
Old 08-06-2008
Yasemin Vatandas's Avatar
Yasemin Vatandas Yasemin Vatandas is offline
Flexsim User
 
Join Date: Jul 2008
Location: Hamburg, Germany
Posts: 36
Downloads: 9
Uploads: 0
Thanks: 29
Thanked 3 Times in 3 Posts
Rep Power: 146
Yasemin Vatandas is on a distinguished road
Default

Thank you Pablo, code now works as expected.


Thread Thread Starter Forum Replies Last Post
problem with automatic generation of objects by using a user library and c++ Martin Saler Q&A 17 06-05-2009 09:56 AM
profileevents() and order of event nodes under project/exec/events Tom David Q&A 3 05-15-2008 11:33 PM
question about User Event Ning Wang Q&A 3 04-22-2008 10:56 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.