question

Ben Wilson avatar image
1 Like"
Ben Wilson asked Ben Wilson answered

How to operationalize a FlexSim model, error handling

Hi,

I need to operationalize a FlexSim model (no gui) in a production server. I want FlexSim to capture and store any errors (while running or in the event of abrupt exit) as text/csv files in a folder. e.g. unable to connect to db due to ODBC connection error.

Also, is there is a way to export event log, system/complier console using FlexScript?

Please also advise whether FlexSim can send emails if i have SMTP access.

Thanks

FlexSim 20.0.10
flexsim 20.0.10event logerror handlingconsole exportsmtp
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

Ben Wilson avatar image
1 Like"
Ben Wilson answered

FlexSim does not have a built-in feature to establish SMTP connections. You could create a custom module to do so, or you could use the HTTP API to send a request to a webserver under your control, which could send an email or whatever other kind of alert you desire.

@jason.lightfoot had an idea to use OPC UA to send messages to node-RED, which could then send emails or other alerts. He thought it could be pretty elegant (hopefully I'm not overpromising :)). When he gets a chance he may comment below with more info. Otherwise, at least it is something new for you to look into.

Here is the command to save the event log:

applicationcommand("saveeventlog", 0, filePath);

filePath should be an escaped string, like "C:\\logs\\eventlog.csv".

getviewtext(systemwindow(consoleType)) will return the text from a console window, assuming that console window is open.

For a "nogui" FlexSim instance it is a bit more complicated, but given a good point to call it, you can use:

applicationcommand("getconsoletext", consoleType)

Where consoleType is an integer as described in the systemwindow() description.

5 |100000

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