question

MR avatar image
0 Likes"
MR asked Jason Lightfoot commented

OnBeginOffset in processflow

Dear all:

There are three attachment below. Name called "basicturntables" is the reference I want to use. I had using the code of OnBeginOffset to processflow.

Name called "use token" is assign labels to X Location, Y Location,...rotatewhiletraveling in event-triggered source, and let variables be token.xloc ,token.yloc in the code node. But it will have system console.v1654086703773.png

1654086691998.png

Name called "use param" is didn't assign labels to X Location, Y Location,...rotatewhiletraveling in event-triggered source, and let variables be param in the code node. But it still will have system console.

1654086731064.png

While I am debugging, the results of variables using param will same as the results using OnbeginOffset in the trigger, which is the attachment called basicturntables.

basicturntables.fsmuse param.fsmuse token.fsm

FlexSim 20.0.10
conveyorflexsim scriptturntable
1654086691998.png (147.0 KiB)
1654086703773.png (145.2 KiB)
1654086731064.png (193.9 KiB)
basicturntables.fsm (57.7 KiB)
use-param.fsm (57.8 KiB)
use-token.fsm (61.1 KiB)
5 |100000

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

1 Answer

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

Here is some student level guidance:

  • Change your process flow to an object based one so that you can refer to 'current' as the basicTE (you can copy the activities across and edit the fields).
  • Add your BasicTE20 instance as a member of that process flow.
  • In the OnBeginTravel offset event triggered source activity assign the token label values
  • Check the "Override return value" on the event triggered source
  • Use an "AssignLabel" activity to write the kinematicDelay label to your token.
  • Use code of the label value to return the correct delay - using the code you have in "Rotate to the offset location.....etc". Preserve the default header and remove any duplicated local variables you have in "Rotate to the offset location....." code.
  • Change the references in that code to read token.xloc, token.yloc instead of param(1), param(2) etc as these are used by the default header (you do this correctly in UpdateKinematics so not sure why you're not doing the same thing in your "Rotate to the offset location..." code.
  • Add a "Finish" activity instead of a sink and select the "kinematicDelay" label as the value to be returned.

The OnBeginOffset section should look like this:

1654091949356.png


1654091949356.png (12.9 KiB)
· 18
5 |100000

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

MR avatar image MR commented ·

Should it be like this:

1654104450950.png1654104463500.png1654104473988.png1654104491553.png

0 Likes 0 ·
1654104450950.png (47.8 KiB)
1654104463500.png (18.5 KiB)
1654104473988.png (23.6 KiB)
1654104491553.png (10.0 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦ MR commented ·

You don't need to assign all those labels in the AssignLabels activity - that's there just to record the return value of the kinematic code you have - all those labels listed should be set by the EventTriggered Source. So the AssignLabels activity just set the value of one label called, for example, "kinematicDelay" which you then use on the Finish activity as the return value. The expression to return that is just :

token.kinematicDelay

Again the value field of the label should be kinematic code that returns the time.

0 Likes 0 ·
MR avatar image MR Jason Lightfoot ♦ commented ·

Did you mean be like this:

1654133667810.png1654133752654.png

1654133774516.png

Besides, should I keep the Custom Code?

0 Likes 0 ·
1654133667810.png (17.4 KiB)
1654133752654.png (16.0 KiB)
1654133774516.png (8.2 KiB)
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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