Assign virtual distance by code

Assign virtual distance by code

omar_aguilera_rico
Not applicable
592 Views
5 Replies
Message 1 of 6

Assign virtual distance by code

omar_aguilera_rico
Not applicable

[ FlexSim HC 5.3.4 ]

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

0 Likes
Accepted solutions (1)
593 Views
5 Replies
Replies (5)
Message 2 of 6

philboboADSK
Autodesk
Autodesk
Accepted solution
treenode NN = model().find("NN2");
int connectionNum = 2;
double newValue = Table("GlobalTable1")[1][1];

setsdtvalue(connectionsout(NN).subnodes[connectionNum], "userDistance", newValue);
optimizenetwork();


Phil BoBo
Sr. Manager, Software Development
Message 3 of 6

omar_aguilera_rico
Not applicable

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
Message 4 of 6

Matthew_Gillespie
Autodesk
Autodesk

Dot syntax is not supported in HC. Change

connectionsout(NN).subnodes[connectionNum]

to

rank(connectionsout(NN), connectionNum)


Matthew Gillespie
FlexSim Software Developer

Message 5 of 6

omar_aguilera_rico
Not applicable

How to represent in HC string.fromNum()?

0 Likes
Message 6 of 6

Matthew_Gillespie
Autodesk
Autodesk
numtostring()


Matthew Gillespie
FlexSim Software Developer

0 Likes