Automating Model Creation and Buffer Transfer via Script

Automating Model Creation and Buffer Transfer via Script

Adak_Romero
Not applicable
378 Views
1 Reply
Message 1 of 2

Automating Model Creation and Buffer Transfer via Script

Adak_Romero
Not applicable

[ FlexSim 23.2.0 ]

script-flexsim.jpgI need help writing a code that automatically generates a model from a script. So far, I’ve managed to create and position the elements, but now I need to configure a process where, through the code, the worker takes the pieces and transfers them to the buffer.

What can I do to achieve this through the code?




Object F1= createinstance(library().find("?Source"), model());

F1.setLocation(0,0,0);

F1.name="F1";


Object M1 = createinstance(library().find("?Processor"), model());

M1.setLocation(0,10,0);

M1.name="Daria";


Object M2 = createinstance(library().find("?Queue"), model());

M2.setLocation(0,20,0);

M2.name="Buffer";


Object S1 = Object.create("Sink");

S1.setLocation(0,30,0);

S1.name="Salida";


objectconnect(Model.find("F1"),Model.find("Daria"));

objectconnect(Model.find("Daria"),Model.find("Buffer"));

objectconnect(Model.find("Buffer"),Model.find("Salida"));


Object T1= createinstance(library().find("?Operator"), model());

T1.setLocation(5,15,0);

T1.name="Trabajador";

0 Likes
379 Views
1 Reply
Reply (1)
Message 2 of 2

joerg_vogel_HsH
Mentor
Mentor

@Adak_Romero,so far you cannot generate a process flow logic chart by code. You can add 3D flow connections into a model. It is possible by command contextdragconnection. There are some restrictions if you connect module objects like conveyors.

Code based logic is a totally different aspect. Internally you put string data into a node and make this node later to a script node. Alternatively you can manipulate a stored model in XML format.
There is always a really large “BUT“. At some point you need to reset your model. And there is not a single command to achieve this internally from inside a running model AND get your model run again.

0 Likes