Need help with Calling and freeing Human Resource

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Maxim1
Posts: 4
Joined: Tuesday 13 December, 2022 - 10:45

Need help with Calling and freeing Human Resource

Post by Maxim1 »

Hi everyone,

at the moment my model works like I will explain in the following sentences:

There are two different production lines. Each production line has its own Source, Queue, Server and sink.

The goal is that there can only be one server manufacturing at a time. So for example when the server "Side1" is manufacturing, the server "Side2" cannot be running.


For this my actual attempt on this is like this:

First I have a trigger on entry for "Side1":

Code: Select all

Do(
  CloseInput(AtomByName([Side2],Model)),
  CloseInput(c)
  )
With this I can make sure that the Input channels of "Side1" and "Side2" are closed once a product enters "Side1".


The second code I wrote is for trigger on exit for "Side1":

Code: Select all

OpenInput(AtomByName([Side2],Model))
With this code I can make sure that once "Side1" is finished manufacturing, the Input channel of "Side2" is opened and "Side2" begins with manufacturing.


The third code I wrote is again a trigger on entry but now it is for server "Side2":

Code: Select all

CloseInput(c)
Now I only need to close the Input channel of "Side2" as the input channel for "Side1" is already closed.


The fourth code is similar to the second code, but it is a trigger on exit for server "Side2":

Code: Select all

OpenInput(AtomByName([Side1], Model))
With this code I will open the input channel of "Side1" once the server "Side2" is finished with manufacturing.


This model is working well, but there is something that I cant make work.

From now on there should be a trigger on exit that calls a human resource which then opens the input channer of the other server.

For trigger on exit at "Side1" I then tried:

Code: Select all

HumanResourceTeam_CallResources(refHRTeam1, c, i,1)
and for the Human Resource I worte following code for trigger when called:

Code: Select all

OpenInput(c)

My question: How can I now tell the Human resource to go to "Side2" to open the input channel?
I dont know what code I need to write for the trigger on exit, so that the human resource goes to the other side to fulfill his task.


Thank you for your Help and please let me know if you need any more informations :)

Maxim
Kopie_von_Versuch6.mod
(24.56 KiB) Downloaded 21 times
User avatar
Deena
Posts: 7
Joined: Monday 21 November, 2022 - 10:22

Re: Need help with Calling and freeing Human Resource

Post by Deena »

Hi Maxim1,

Thank you for the question.
As per the information given by you, I have a suggestion that you can use the functions " CallHumanResources and FreeHumanResources" .
The parameters required for the function can be viewed under the Help Tab, under the following sequence:
Atom Reference Guide > Human Resource > CallHumanResources.

As per your model, the function to call the human resource can be triggered at the exit of the Side1 and can be freed at the entry of Side2.
I hope the explanation is clear for you to proceed further with your model. Kindly let us know if you still have any doubts and questions :)

Kind Regards,
Deena
Maxim1
Posts: 4
Joined: Tuesday 13 December, 2022 - 10:45

Re: Need help with Calling and freeing Human Resource

Post by Maxim1 »

Hi Deena,

I now implemented the following code for trigger on exit of "Side1":

Code: Select all

HumanResourceTeam_CallResources(refHRTeam1, c, i, 1)
Now I have the Problem that this error occurs when the trigger on exit is executed:

Access violation at address 00000000004755C9 in module 'ED.exe'. Read of address 0000000000000008 -> HumanResource (AtomID: 81), EVENT: OnEvent (Ln: 42, Col: 4) "HumanResource_EventReceiveTask" | Time: 81, c: HR1 (AtomID: 210), OnEvent, EventCode: 5
CallStack: OnEvent(5)|SCRIPTTYPE_EVENT|HumanResource (81)


Maybe you can also help me with this? :)

Tia,

Maxim
User avatar
Deena
Posts: 7
Joined: Monday 21 November, 2022 - 10:22

Re: Need help with Calling and freeing Human Resource

Post by Deena »

Hi Maxim,

The code you are implementing seems correct. I would like to know if you have attached the human resource to the team? You can do that by clicking the Human Resource team atom and setting the team configuration in the Team Members tab (Ref the screenshot attached). In case this does not resolve the issue. Can you please send me your model so I can have a look into the cause of the error :) .

Best Luck!
Kind Regards,
Deena
Screenshot 2023-01-12 115654.png
Screenshot 2023-01-12 115654.png (38.49 KiB) Viewed 367 times
Post Reply