Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

About source.

 Hello everyone,

 

My problem this time is might be a little bit tricky.

 

In my factory model, there are 7 types of products in total. And when a customer order comes in, the order contains the information about how many of which types of products being needed. There are 40 kinds of customer order in total, and customer order is generated randomly by the source.

 

Order.png

 

For example, Customer order Nr.1 contains the information that 1 time of Model_A and 2 times of Model_D is needed. And when it goes through the sensor, I need the factory knows that it's time to produce 1 time of Model_A and 2 times of Model_D.

 

I only know that I can use if...else if... dialog to do this, but for 40 orders it would be extremly complecated.  

Is there any easier way to do this?

Best regards,

Lee

 

3 REPLIES

Re: About source.

why don't you use a Loop ?

Re: About source.

[ Edited ]

Like how? How do I randomly generate 40 different orders at the first place? And how do I recognize them by the sensor? Do I have to build 40 MUs?

Solution
Solution
Accepted by topic author Leeooj
‎11-05-2016 04:53 AM

Re: About source.

[ Edited ]

@ randomly generate 40 orders

    As you have already mentioned in your initial quote - through a source object.

    For details on configuring the source object s. help

     You can set a reference to your table / order row by copying the

      the row number to the mu.label attribute.

 

@ sensor.

 

Through the mu.label reference to the row, you know which row to scan for models to be produced.

 

e.g.

 

.
.
.

local i: integer; for i:=1 to modelTable[i,str_to_num(mu.label)] loop if modelTable[i,row] >0 then print "order to produce: ", chr(9),modelTable[i,0],chr(9),modelTable[i,row]; end; next;
.
.
.