question

Chaoqing X avatar image
0 Likes"
Chaoqing X asked Jacob Gillespie answered

under socket,the 3D animation of flexsim model is discontinuous

I want the flexsim model interact information with the Algorithmic Model which is coded in pathon.

The flexsim model as a client connect to Algorithmic Model which is as a server. The process is that the model send a request to Algorithmic Model and freeze the model , then the Algorithmic Model cacculate the result which will take some seconds. Last the Algorithmic Model send the result back to flexsim model and the model unfreeze.

The problem is that when the model have received the result, the model is unfreezed , but the 3D animation of flexsim model is discontinuous and the run time jumps. the freeze do not affect the simulation result, and but affect the 3D animation. is that right? And how to solve the problem?flexsim-is-client-client-02-english.fsm

FlexSim 18.2.3
socket3d animation discontinuous
· 5
5 |100000

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

Chaoqing X avatar image Chaoqing X commented ·

the model's logic is showed by this picture.

0 Likes 0 ·
model-logic.jpg (585.8 KiB)
Chaoqing X avatar image Chaoqing X commented ·

I have found the solution, before clientreceive() command, stop the model,and after clentreceive() command go the model.

but there is another question, if the clientreceive() is block mode. when the clientreceive(socket,NULL,20, 0) command has not receive any message form server, drag the model by mouse in 3D mode, The model will crash.

is there any solution to avoid the crash?

0 Likes 0 ·
tannerp avatar image tannerp Chaoqing X commented ·

I apologize this question was left without a reply for so long. It is possible to stop the model using code, but we generally don't advise this kind of coding, hence there are not many users that use FlexSim like this.

According to the Command Help section on "clientreceive," If noblocking = 0, FlexSim program execution will block (freeze) until something is received from the client. I think that because you are sending "0" for "noblocking" it is causing FlexSim to freeze and crash. But that is just my best guess. Hopefully this helps if you haven't yet resolved this issue.

1 Like 1 ·
Jacob Gillespie avatar image Jacob Gillespie ♦ Chaoqing X commented ·

I'm not sure why it would be crashing.

You could try this to disable and then re-enable user interaction with the window:

treenode mainPanel = node("VIEW:/active/MainPanel");
windowgray(windowfromnode(mainPanel), 1);

// do clientreceive()

windowgray(windowfromnode(mainPanel), 0);
1 Like 1 ·
Chaoqing X avatar image Chaoqing X commented ·

@Jacob Gillespie, thanks for your reply. I have try the code "windowgray", but it does not work.

Is there any command in flexsim script which can disable the mouse, and we can not do anything in model by mouse.

0 Likes 0 ·

1 Answer

·
Jacob Gillespie avatar image
0 Likes"
Jacob Gillespie answered

@Chaoqing X

What do you mean it does not work? Have you tested the windowgray() code to see if it is actually disabling interaction with view?

I tested using windowgray() on the MainPanel from the Script Console and it stops responding to mouse inputs.

I don't think there is any other way of disabling the mouse. Maybe you could open a window to cover the 3D view and then remove it after the clientreceive()?

I'm not able to open your attached model to see what you are doing.

5 |100000

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

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.