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
|
||||
|
||||
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())); |
#2
|
|||
|
|||
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) |
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 |