question

Omar Aguilera Rico avatar image
0 Likes"
Omar Aguilera Rico asked Matthew Gillespie commented

Assign virtual distance by code

Hello everyone. Is it possible to assign the virtual distance between a path NN1 to NN2 per code? Try doing it with setvarnum () but do not succeed. Any idea how I can do this? What I want to do is that the virtual distance depends on a global table. I appreciate the support. captura.png

FlexSim HC 5.3.4
virtual distance
captura.png (12.7 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

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Matthew Gillespie commented
treenode NN = model().find("NN2");
int connectionNum = 2;
double newValue = Table("GlobalTable1")[1][1];

setsdtvalue(connectionsout(NN).subnodes[connectionNum], "userDistance", newValue);
optimizenetwork();
· 4
5 |100000

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

Omar Aguilera Rico avatar image Omar Aguilera Rico commented ·

Hello, I already tried with the code that you indicated me but the subnodes do not detect it and it marks me error. Attach the support model so that you notice that it does not detect that command. Thanks for the support! It is the version of FlexSim HC 5.3.4 problema.fsm

0 Likes 0 ·
problema.fsm (198.0 KiB)
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Omar Aguilera Rico commented ·

Dot syntax is not supported in HC. Change

connectionsout(NN).subnodes[connectionNum]

to

rank(connectionsout(NN), connectionNum)
1 Like 1 ·
Omar Aguilera Rico avatar image Omar Aguilera Rico Matthew Gillespie ♦♦ commented ·

How to represent in HC string.fromNum()?

0 Likes 0 ·
Show more comments