Start event log by Flexscript

Start event log by Flexscript

laurenz_peleman
Not applicable
413 Views
14 Replies
Message 1 of 15

Start event log by Flexscript

laurenz_peleman
Not applicable

[ FlexSim 20.2.3 ]

Dear all

I am looking for a coded way to start the event log for each scenario/replication when using the Experimenter, and to export the event log to csv files.

Regarding the export step, I found this answer already

https://answers.flexsim.com/questions/99618/how-to-operationalize-a-flexsim-model-error-handli-1.htm...

However, I cannot find which function name to add to the applicationcommand() to start the event logging on the start of each replication. Is this function also available?

Many thanks, kind regards

Laurenz Peleman

0 Likes
Accepted solutions (1)
414 Views
14 Replies
Replies (14)
Message 2 of 15

joerg_vogel_HsH
Mentor
Mentor

I think it is a fundamental setting before you run a model, because you are going to log all of selected events of objects and the duration of the logging. And the first events occure on the list, when you hit the reset button already.

0 Likes
Message 3 of 15

patrick_zweekhorst
Collaborator
Collaborator
Accepted solution

Hi @Laurenz Peleman,

Have you tried:

applicationcommand("seteventlogging",1,-1); // enable logging
applicationcommand("seteventlogging",0,-1); // disable logging

I have never used this but it seems to be the code you are looking for.
I would give this a try

Patrick

Message 4 of 15

laurenz_peleman
Not applicable

Thanks for your quick reply. If what you say is correct, how do I get what I want in that situation?

0 Likes
Message 5 of 15

joerg_vogel_HsH
Mentor
Mentor
0 Likes
Message 6 of 15

laurenz_peleman
Not applicable

@Patrick Zweekhorst Thanks for your helpful answer. I don't know what the parameters 1 and -1 represent (is there any documentation on this applicationcommand()?), but it turns out that only a part of the events at time stamp 0 are collected when running your code...

0 Likes
Message 7 of 15

patrick_zweekhorst
Collaborator
Collaborator

The first parameter seems to be the toggle on/off. I don't know why the parameter -1 is there. All I can see is that this is the code that is called if the check the checkbox for logging the events. I would assume that all events after you have called the code would be logged. If that is not the case someone from the FlexSim team in the US might be able to help you further.

Message 8 of 15

patrick_zweekhorst
Collaborator
Collaborator

Have you switched off any of the events in the settings tab?

39228-1620394405130.png

0 Likes
Message 9 of 15

laurenz_peleman
Not applicable

No, nothing. Are you able to export the full event log this way? Perhaps the error is in the export statement of the link in my initial question?
So what I have: in the On Start Replication trigger

applicationcommand("seteventlogging",1,-1); // enable logging

in the On End Replication trigger

if (!objectexists(childexpfolder)) {
applicationcommand("saveeventlog", 0, "C:\\~\\eventlog.csv");}


0 Likes
Message 10 of 15

patrick_zweekhorst
Collaborator
Collaborator

If you run the code in your model without the experimenter, do you see all the events in the event log dialog in your view?
The code

applicationcommand("saveeventlog", 0, filePath);

Seems to be working, so I don't think the problem is there

0 Likes
Message 11 of 15

laurenz_peleman
Not applicable

No, when I run the code in a command window, I only get the same subset of events that I see in the export file. Moreover, when doing my above approach in the Experimenter, the export file turns out to be blank

0 Likes
Message 12 of 15

patrick_zweekhorst
Collaborator
Collaborator

Okay, in that case i am not sure what goes wrong. Maybe someone else can help you further

0 Likes
Message 13 of 15

philboboADSK
Autodesk
Autodesk

The -1 is for enabling/disabling event logging in general. You use the same command to enable/disable particular event type codes. See VIEW:/standardviews/eventlog/EventLogSettings>OnApply



Phil BoBo
Sr. Manager, Software Development
Message 14 of 15

philboboADSK
Autodesk
Autodesk

@Laurenz Peleman

No one can tell you what is wrong unless you post enough information to replicate what you are doing.

Post a sample model with your code if you want someone to be able to help you understand why your code isn't working.

As far as I can tell, everything is working perfectly. You didn't give enough information to duplicate your issue. Until you do, no one is going to be able to help you.

39281-eventlog-export.png



Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 15 of 15

Ben_WilsonADSK
Community Manager
Community Manager

Hi @Laurenz Peleman, was Patrick Zweekhorst's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes