question

Asif A avatar image
0 Likes"
Asif A asked Joshua S commented

writing a code for interaction with model

i m trying to interact with the simulation model. if i m using the method of sending a request to http address. how can i get one http server that i can use in codes

FlexSim 19.1.0
interactionwriting code
· 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.

1 Answer

Benjamin W2 avatar image
1 Like"
Benjamin W2 answered Joshua S commented

Hi @Asif A,

I think that this code should work, however you will have to test it on your end since I don't have access to your client.

On your Tools tab, click into your recieveOnSocket User command.

I added this code underneath line 18:

  1. // Add Logic for processor
  2. if (input == "Down")
  3. {
  4. Model.find("Processor1").as(Object).stop(STATE_STOPPED);
  5. }
  6. else if (input == "Resume")
  7. {
  8. Model.find("Processor1").as(Object).resume(STATE_IDLE);
  9. }

Note that you will need to change "Down" and "Resume" in the if statements to whatever you are reading from your client.

I hope this helps!

flexsimasserver.fsm


flexsimasserver.fsm (18.3 KiB)
· 6
5 |100000

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