'Select rule resource' of the humanresourceteam atom
-
- Posts: 7
- Joined: Sunday 31 May, 2020 - 22:59
'Select rule resource' of the humanresourceteam atom
Hello everyone!
I am doing a proyect for my degree with ED and I would like to ask one thing.
In the simulation, I am using several humanresources and I have a problema with them. The thing I want is that when two or more humanresources are waiting for a task, the one I want to do the next task is the resource that have been waiting for it more time.
I know this thing has to be programmated on the hummanreourceteam atom as a strategy of "Select rule resource" but I don't know the 4DScript code I have to use.
Thank you in advance.
Borja Saenz
I am doing a proyect for my degree with ED and I would like to ask one thing.
In the simulation, I am using several humanresources and I have a problema with them. The thing I want is that when two or more humanresources are waiting for a task, the one I want to do the next task is the resource that have been waiting for it more time.
I know this thing has to be programmated on the hummanreourceteam atom as a strategy of "Select rule resource" but I don't know the 4DScript code I have to use.
Thank you in advance.
Borja Saenz
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: 'Select rule resource' of the humanresourceteam atom
Ha Borja,
That is an interesting one. At least you'll need somehow to keep track at which moment a Human Resource finished its last task.
I would do that by placing code on each HR when it is freed and set there a label, "Label([TimeBeingFreed], c) := Time"
Then, when a task becomes available, you'll have to loop over the available agents and find the one that has the required skills AND is the longest waiting (so the minimal label value). For that you'll have to look at the functionality that is already given and adjust it to your needs. for instance the one where the first free resource is chosen, is interesting. The small, gray box just under the arrow of the combo box allows you to see the code.
When you right click on a function, you can go to the definition. This will open the code of the function and allows you to see it (and adjust, but I would do that). Then I would copy the code and place it in the Interact window (Shift+F6) and start adjusting it.
So in your case you'll want to loop over all the available outgoing channels of the HumanResourceTeam (NrOc(c)) and pick the one that has the skills, is available and has the minimum value for label [TimeBeingFreed]. So, I would play with the 4Dscript function "Minimum":
I haven't tested this code, but I think it should point you in the right direction. ![Wink ;-)](./images/smilies/icon_e_wink.gif)
Success!
Harry
That is an interesting one. At least you'll need somehow to keep track at which moment a Human Resource finished its last task.
I would do that by placing code on each HR when it is freed and set there a label, "Label([TimeBeingFreed], c) := Time"
Then, when a task becomes available, you'll have to loop over the available agents and find the one that has the required skills AND is the longest waiting (so the minimal label value). For that you'll have to look at the functionality that is already given and adjust it to your needs. for instance the one where the first free resource is chosen, is interesting. The small, gray box just under the arrow of the combo box allows you to see the code.
When you right click on a function, you can go to the definition. This will open the code of the function and allows you to see it (and adjust, but I would do that). Then I would copy the code and place it in the Interact window (Shift+F6) and start adjusting it.
So in your case you'll want to loop over all the available outgoing channels of the HumanResourceTeam (NrOc(c)) and pick the one that has the skills, is available and has the minimum value for label [TimeBeingFreed]. So, I would play with the 4Dscript function "Minimum":
Code: Select all
Do(
Var([atmTeam], vbAtom, c),
Var([atmTask], vbAtom, cs),
Var([valSkillID], vbValue, HumanResourceTask.SkillColumn(atmTask)),
Var([valCurOc], vbValue, 0),
Minimum(
NrOc(atmTeam),
If(
And(
HumanResourceTeam_CheckAvailabilityResourceByChannel(atmTeam, atmTask, Count, valSkillID),
Label([TimeBeingFreed], out(count, atmTeam)) < Label([TimeBeingFreed], out(valCurOC, atmTeam))
),
valCurOC := Count
)
),
valCurOc
)
![Wink ;-)](./images/smilies/icon_e_wink.gif)
Success!
Harry
-
- Posts: 7
- Joined: Sunday 31 May, 2020 - 22:59
Re: 'Select rule resource' of the humanresourceteam atom
Thank you very much Harry, I understand the code and it has been really helpful but I have entered it and set the labels but it doesnt work.
When the simulation start, the HR dont move and the following errors appear:
· 1 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
· 2 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
· 3 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
· 4 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
I dont understand the syntax of these errors and I dont know how to solve them, can you help me with this?
Regards,
Borja
When the simulation start, the HR dont move and the following errors appear:
· 1 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
· 2 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
· 3 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
· 4 No atom currently selected: Do(Var([atmTeam], vbAtom),Var([atmTask], vbAtom),Var([valSkillID], vbValue),Var([valCurOc], vbValue),Label([TimeBeingFreed],Out(valCurOc,atmTeam))) -> HumanResourceTeam1 (AtomID: 194), ATTRIBUTE: AssignTo (Ln: 29, Col: 56) "Label" | Time: 1, c: HumanResourceTeam1 (AtomID: 194), i: product(AtomID: 679), OnEvent, EventCode: 1
I dont understand the syntax of these errors and I dont know how to solve them, can you help me with this?
Regards,
Borja
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: 'Select rule resource' of the humanresourceteam atom
Hi Borja,
Would it be possible to share your model or to sent it to me using a PM? Then I can have a look at it.
Cheers,
Harry
Would it be possible to share your model or to sent it to me using a PM? Then I can have a look at it.
Cheers,
Harry
-
- Posts: 7
- Joined: Sunday 31 May, 2020 - 22:59
Re: 'Select rule resource' of the humanresourceteam atom
Okey, I attach it to this message.
- Attachments
-
- Fase6b.mod
- (1.32 MiB) Downloaded 759 times
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: 'Select rule resource' of the humanresourceteam atom
Ha Borja,
I see that I missed a check, namely when valCurOC is still 0, it makes no sense to check if another member of the team is already waiting longer, since we hadn't found a fitting member yet anyway.
I've made a small change in the code (adding an OR-statement checking if valCurOC = 0 or, if not, if the new member is waiting longer than the previously found one) and it seems to be working now (at least the HR is moving).
Success with testing,
Gr. Harry
I see that I missed a check, namely when valCurOC is still 0, it makes no sense to check if another member of the team is already waiting longer, since we hadn't found a fitting member yet anyway.
I've made a small change in the code (adding an OR-statement checking if valCurOC = 0 or, if not, if the new member is waiting longer than the previously found one) and it seems to be working now (at least the HR is moving).
Code: Select all
Do(
Var([atmTeam], vbAtom, c),
Var([atmTask], vbAtom, cs),
Var([valSkillID], vbValue, HumanResourceTask.SkillColumn(atmTask)),
Var([valCurOc], vbValue, 0),
Minimum(
NrOc(atmTeam),
If(
And(
HumanResourceTeam_CheckAvailabilityResourceByChannel(atmTeam, atmTask, Count, valSkillID),
Or(
valCurOC = 0,
Label([TimeBeingFreed], out(count, atmTeam)) < Label([TimeBeingFreed], out(valCurOC, atmTeam))
)
),
valCurOC := Count
)
),
valCurOc
)
Gr. Harry
-
- Posts: 7
- Joined: Sunday 31 May, 2020 - 22:59
Re: 'Select rule resource' of the humanresourceteam atom
Now it works perfectly.
Thank you very much!
Cheers,
Borja
Thank you very much!
Cheers,
Borja
-
- Posts: 7
- Joined: Sunday 31 May, 2020 - 22:59
Re: 'Select rule resource' of the humanresourceteam atom
Now it works perfectly.
Thank you very much!
Cheers,
Borja
Thank you very much!
Cheers,
Borja
- HarryBunnik
- Posts: 362
- Joined: Monday 07 February, 2011 - 11:22
Re: 'Select rule resource' of the humanresourceteam atom
Hi Borja,
Good that it works.
One more thing. You'll have to write some code, for instance on the Initialize atom looping over the exit channels of the team, to set the label we've created on all the HR's back to zero on reset. Otherwise, they will have already a label on the start. And that might result in strange behavior in later simulations.
Cheers,
Harry
Good that it works.
One more thing. You'll have to write some code, for instance on the Initialize atom looping over the exit channels of the team, to set the label we've created on all the HR's back to zero on reset. Otherwise, they will have already a label on the start. And that might result in strange behavior in later simulations.
Cheers,
Harry
-
- Posts: 7
- Joined: Sunday 31 May, 2020 - 22:59
Re: 'Select rule resource' of the humanresourceteam atom
Hi Harry,
I have realised now about one thing, I have been working on it but I dont find a solution.
When the HRs of the simulation get freed, I would like them to go to an specific place and wait there to the next task.
Do you know how can I solve this?
Cheers,
Borja
I have realised now about one thing, I have been working on it but I dont find a solution.
When the HRs of the simulation get freed, I would like them to go to an specific place and wait there to the next task.
Do you know how can I solve this?
Cheers,
Borja