question

Lawrence Liang avatar image
0 Likes"
Lawrence Liang asked Lawrence Liang commented

How can I use storage.system class to call findslot method by dll maker?

Now I want to use dll marker to realize most business logics, but I can't find assignslot and findslot methods in FlexsimFuncs.h file.


How can I use storage.system class to call findslot method by dll maker before UNLOAD Task as below?


treenode ts = createemptytasksequence(rmg, 0, 0);

inserttask(ts, TASKTYPE_UNLOAD, unit, yardBlock,0,0,0,0);

dispatchtasksequence(ts);

FlexSim 24.1.0
c++dll makerstorage
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

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Lawrence Liang commented

I don't think you can access the storage system through the dll maker. From the manual:

Generally you can only access FlexSim's global user commands, not FlexSim's dot syntax methods and properties.

https://docs.flexsim.com/en/24.1/Reference/DeveloperAdvancedUser/ConnectingToExternalCode/ConnectingToExternalCode.html#building

The Storage system API counts as "dot syntax" as dots are used to access methods and properties:

Storage.system.findSlot()

So you can't use that API from the DLL maker.

However, you can access that API from the Module SDK:

https://docs.flexsim.com/en/24.1/Reference/DeveloperAdvancedUser/ModuleSDK/ModuleDevelopment/ModuleDevelopment.html

The FlexScript API is loosely related to the C++ API. C++ handles namespaces a little differently, and sometimes patterns in FlexScript aren't available in C++. So the line of code you need in the module SDK looks like this:

auto slot = FlexSim::StorageSystem::getInstance()->findSlot("WHERE ...");


· 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.

Thank you for your prompt feedback!


Now, I'm try to write a method to solve it.


Please check following these codes,

void FlexSimTools::assignRackSlot(treenode rack, treenode parent,treenode item, int baySeq, int rowSeq,int tierSeq)

{

treenode rootNode = model();

string rackName = getname(rack);

string parentName = getname(parent);

string itemName = getname(item);


string strNodeAssignedSlot = "/" + parentName + "/" + itemName + ">stored/1/assignedSlot/1";

treenode nodeAssignedSlot = findTreeNode(rootNode, strNodeAssignedSlot);


if (nodeAssignedSlot == NULL)

{

treenode node1 = node("/" + parentName + "/" + itemName + ">stored", model());


treenode node2 = nodeinsertinto(node1);

nodeadddata(node2, DATATYPE_STRING);

setnodestr(node2, "assignedSlot: size = 1,");


treenode currentSlotNode = nodeinsertinto(node2);

setnodename(currentSlotNode, "currentSlot");

nodeadddata(currentSlotNode, DATATYPE_NUMBER);

setnodenum(currentSlotNode, 0);


treenode node3 = nodeinsertinto(node2);

setnodename(last(node2), "assignedSlot");

nodeadddata(node3, DATATYPE_NUMBER);

setnodenum(node3, 0);


nodeinsertinto(node3);

nodeAssignedSlot = last(node3);

}

nodeadddata(nodeAssignedSlot, DATATYPE_STRING);

setnodestr(nodeAssignedSlot,

"/" + rackName + ">variables/bays/" + to_string(baySeq) +"/levels/" + to_string(rowSeq) + "/slots/1/slotItems/" + to_string(tierSeq));

}


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.