Server events and handling SQL query from separate thread

83 views
Skip to first unread message

Carlos Garcia

unread,
Nov 21, 2020, 12:38:37 PM11/21/20
to Jaamsim Users Discussion Group
Hello

We are trying to generate events from servers that will trigger a call to a SQL stored procedure. We would like these calls to be handled in a separate thread to avoid delays in the main jaamsim thread. 

Could you point me in the right direction to do this?

Thanks in advance, and thanks for your great work in Jaamsim

Carlos

Harry King

unread,
Nov 21, 2020, 8:49:43 PM11/21/20
to Jaamsim Users Discussion Group
Carlos,

If you execute the SQL procedure on a separate thread, there will be no way to use the result of that procedure in the simulation. The simulation time at which the procedure is completed will not be repeatable.

You can use the ExternalProgram object to perform the SQL procedure. Launching an external program is quite slow so you should try to minimize the number of times it is performed.

Harry

Carlos A. García Santiago

unread,
Nov 24, 2020, 1:32:49 AM11/24/20
to Jaamsim Users Discussion Group
Thank you Harry

I´m planning to use this when running in real time, and a few seconds in simulated time will not make a difference to the result. We are dynamically updating the schedule of parts to produce from SQL.  I´ll test the ExternalProgram, thanks..

On a  related matter, what is the best place in a server object to launch an event when the state of the server changes? Im looking to signal whenever the server changes its state (working, idle. maintenance etc) or the entity it is serving.

Thank you

Carlos 

Carlos A. García Santiago

unread,
Nov 25, 2020, 11:15:30 AM11/25/20
to Jaamsim Users Discussion Group
I am now testing an implementation of ExpressionLogger, that will write to SQL instead of file

Carlos A. García Santiago

unread,
Nov 25, 2020, 1:24:04 PM11/25/20
to Jaamsim Users Discussion Group
And it´s working fine, case closed
Reply all
Reply to author
Forward
0 new messages