question

Vahideh M avatar image
0 Likes"
Vahideh M asked Jeff Nordgren edited

Query expression for task priority considering amount of acquiring resource

@Jordan Johnson, @Phil BoBo, @Matthew Gillespie, @Matt Long, @anthony.johnson

Hi All,

I am trying to use the Query in an Acquire but it does not work properly.

The version of my Flexsim: 2020.1.3

I have three tasks. Two of them need two operators and one of them needs one operator, which has been assign by labels and recall later in Acquire resource. There are only three operators in my model.

Also, I have two kinds of priority: Overall_prio and Prio. It is like external (Product production priority) and internal priority (task priority), which I need it for the rest of my process flow.

Overall_prio = 1 means that it has the highest priority among other products and it should be done in the first place.

Prio = 1 means that it has the highest priority among other tasks related to the same production.

Tasks are pushing to the list, and pulling by Query ORDER BY prio ASC, overall_prio ASC that is ok and I need it this way.

I am want to assign operators to the tokens in this order:

first: production 1, task 1

second: production 2, task 1

third: production 2, task 2

Although I define ORDER BY Puller.Prio ASC for Acquire operator, but it doesn’t work right and the last task (production 2, task 2) acquire operator before production 2, task 1.

Thank you in advance,

Query for Assigning the operators.fsm

FlexSim 20.1.3
flexsim 20.1.3token priority
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Vahideh M, was Jeff Nordgren's answer helpful, along with Tanner's comment? If so, please click the red "Accept" button on the answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

1 Like 1 ·

1 Answer

Jeff Nordgren avatar image
0 Likes"
Jeff Nordgren answered tannerp commented

@vahideh.m,

Attached is your model with the changes that I've made to it.

First, you are trying to do a query on the Resource (Operators) but the Resource list is just the Operator objects. They don't have any other information (like Prio, Overall_prio or Amount_Emp) so you can't use non-existent info from a list, whether it be an item list, resource list or any other list.

You are also trying to use an internal list and pushing the token to that internal list. Doing this, the list only has one field which is the token ID. Even though you assign labels to your token, those labels (fields) don't exist on the internal list. So I created a Global List (ItemList) and added those three fields that you need.

You only need those fields when you are pulling from the item list, which is where you need your query info. This query needs to have the fields spelled properly (including caps) so I had to change that but you essentially have that query correct, I just had to add some caps to your field names.

Next, because you only want to do one process at a time, I added a Zone, which only allows one token to enter and finish before another token is allowed in. Otherwise, after the first token is assigned Overall_prio 1 and Prio 1, it Acquires two Operators, leaving one Operator free. The next token pulled also requires two operators but there is only one free one left, so that task can't Acquire 2 Operators. Then the third token comes in and only need 1 Operator. So that token can Acquire the last operator because it only need one, putting the sequence out of order. That is why I put the Zone in so that each operation need to complete before another one is allowed to enter.

Take a look at the model and see if it is now doing what you are wanting it to do. If you have any questions or problems, please let us know.

Thanks.

query-for-assigning-the-operators-JN3.fsm


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Vahideh M2 avatar image Vahideh M2 commented ·

@jeff.nordgren, Thank you for your time and clear explanation.

The thing is I do not want to do one process at a time. Several productions can be constructed in parallel (e.g: four productions at the same time) if there are enough operators. That is why adding a Zone is not solving this problem. As I mentioned before every production has internal priority (Prio) which provides sequence among its own tasks.

Assume two task has been pulled from list: A (Overall_prio = 1, prio = 3, Amount_Employee= 2) and B (Overall_prio = 2, prio = 1, Amount_Employee= 1). I need to assign operators to task A in the first place and then to B, because when A has been pulled it means that all previous task of production 1 has been done. However, both A and B can be run through Process Flow if there are enough operators.

In another example, the Overal_prio of tasks are the same and Prios are different. Assume there are A (>Overall_prio = 2 , prio = 1, Amount_Employee= 2) and B (Overall_prio = 2 , prio = 2, Amount_Employee= 1), again we need to assign operators to task A and then B, but it can be assigned to both task if adequate operators are available.

I have also created a mechanism to control the internal priority, later on, so do not be worry about tasks execution sequence. In this step, my problem is just about assigning the operators.

Thank you,

Vahideh

0 Likes 0 ·
tannerp avatar image tannerp Vahideh M2 commented ·

@Vahideh M2,

If you're able to prioritize the tasks well, you might be able to pull the operators from a list rather than acquire them. This would give you the ability to dynamically indicate the number of employees needed for each job.

For example, if your two example jobs, A and B, are evaluated, you can select A first based on the priority. Then, at the next step, you can pull 2 employees based on the Amount_Employee value.

The list will give you more freedom in querying operators than the Acquire activity, in my opinion.

1 Like 1 ·