question

King-Ki F avatar image
0 Likes"
King-Ki F asked King-Ki F commented

Custom Rack Logic

Hello,

I'm trying to create a logic for putting product into rack via a specific sequence. The sequence is determined in a Global Table named tbl_LocationMaster. My logic is as follows

  • Generate a token every 15 seconds.
  • Assign a label to the token with a value of a default sequence, which is 1
  • Assign an address schema based on the sequence via the Global table
  • Check if the address schema is empty
    • When empty, place a box in the address schema
    • When not empty, increment the address schema and check again if the address schema is empty

The issue I'm having is with the syntax of my Decide activity. I'm getting errors which I do not understand. The condition i specified in my Decide activity is

Storage.system.getSlot(token.Address).slotItems.length=0

but I am receiving the following errors in the Compile Console

Flexscript Error	MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision Line 9		The value of property length cannot be set
Flexscript Error	MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision Line 9		Invalid type for left side of assignment operation. Must be valid l-value. Type is (invalid)
Flexscript Error	MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision	
Could not finish parsing because of previous errors.

May I please receive some help with this? Is my logic flawed and I should be approaching this in another way? I've uploaded my project. Thanks in advance for any assistance!

custom-rack-logic.fsm

FlexSim 20.0.2
process flowrack storage
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

·
Allister Wilson avatar image
0 Likes"
Allister Wilson answered Joerg Vogel commented

You're trying to assign the value 0 to a read-only property length.

I'm guessing you actually wanted to check if length is equal to zero.

Flexscript is a C-like language, so it uses == for equality testing.

Manual page : Flexscript comparison operators

· 3
5 |100000

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

King-Ki F avatar image King-Ki F commented ·

Yes, I was attempting to look in the Address Scheme for any boxes and wanted to do equality testing to 0 (a empty location). Thank you for understanding.

After I changed the condition in the Decide activity to include the "==", I'm getting the following error in the System Console below. Every token I've generated is only taking the first address ("--1-3-1"). Is this because the boxes are not actually inside the rack address/location?

time: 15.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 30.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 45.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 60.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 75.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 90.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 105.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/Rack Logic/Decide: Location Full?>variables/decision
0 Likes 0 ·
Allister Wilson avatar image Allister Wilson King-Ki F commented ·

If you split the code over multiple lines and set a breakpoint, you'll see that getSlot isn't actually finding a slot with the provided address :

Looking at the value of token.Address, it doesn't correspond to a valid slot address.
You're trying to find the slot with address :

--1-3-1

But you defined your bay, level and slot IDs with a fixed width of 2, so a valid address looks like :

--01-03-01

0 Likes 0 ·
breakpoint.png (4.7 KiB)
King-Ki F avatar image King-Ki F Allister Wilson commented ·

Thanks for helping me with this. I was able to fix it and add in some more coding, but I've run into another problem. For some reason, my boxes do not show up in the rack.

When I exceed 25 boxes/tokens (the max locations in the rack), the boxes are sent to the queue. I can see the boxes in the queue, but there are no boxes in the rack. I've made sure the box size is smaller than the location size, but still no boxes show up in the rack. The connectors on the Decision activities are correctly ranked, as far as I know. What else am I missing?

Image of Model:

custom-rack-logic.png

Model

custom-rack-logic-v2.fsm

0 Likes 0 ·

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.