Running Mecway solve from a Windows batch file

I have the following batch file (simplified) that runs from a Windows 10 cmd window --

D:\Engineering\Mecway_15\Mecway.exe %1 solve :: %1 is the liml file that will be analyzed. D:\Engineering\Mecway_15\Mecway.exe %1 :: Opens Mecway UI to view the analysis results. ECHO Debug1

The problem is that after Mecway's UI is opened, no further commands (e.g., the ECHO command) in the batch file are executed until the UI is closed. This also means than the cmd window is frozen until the UI is closed so the cmd window can't be used for anything else. However, I want the UI to remain open even after the batch file has completely finished.

Of course, I could open the UI outside of the batch file but this would be less convenient.

Thanks,
Don C.



Comments

  • Put "start" in front of the command to have the batch file continue immediately.

    start D:\Engineering\Mecway_15\Mecway.exe %1
  • Victor --

    I tried this but the UI didn't start and I got the following error messages (the first was immediate and the second appeared after several minutes with the first message still open) --



    If click Yes on the second message then the first message is just regenerated. If click "Close program" on the first message then I got the following message --



    If click OK then the first message is just regenerated. If click "Close program" then the last message is just regenerated. If click OK then the model is finally loaded but without results (can be resolved with "\Analysis\Save after solve" about which I may inquire later.)

    A bigger issue is the increased run times for command line versus the UI. For a fairly simple model (H10a.liml) the run time increases from 48 seconds to 71 seconds (+48%). I thought this might be a fixed offset. However, for a more complex model (H301a.liml) run time increases from 139 seconds to 304 seconds (again +48%). This might be bearable these models but wouldn't be for even more complex models.
  • edited August 2022
    Oh dear, that failure with the geometry preview is terrible! I'm not sure what's wrong and can't find a workaround yet but I'll fix it for the next release. Sorry for such a frustrating experience.

    I'm not seeing any speed difference between command line and GUI. However, the GUI does show "finished" when CCX has finished but before it's loaded the solution and calculated the formulas which takes time. Did you measure the complete time till the solution appeared in the outline tree?
  • Victor --

    For the GUI analysis I just used the time that was shown in the "Details ..." in the bottom left of the CCX Solver popup panel.

    For the cmd command line analysis, I put a timer (DateTime.exe, attached) just before and just after the call to "Mecway filename.liml solve". The difference between these two times gave the net runtime. The UI wasn't called. (DateTime.exe executes almost immediately so it shouldn't have contributed to the indicated analysis time. However, I'm open to other timing suggestions if you think this might have been a problem.)

    I wonder if there might be a difference in the way the CPU (Intel Core i7 vPro) is processed by the GUI vs the cmd window. Also, are both analyses running the same CCX with identical parameters?

    (In case I wasn't clear, the command line analysis was the one that always took longest.)
  • I'm not sure then. Perhaps you're using multithreading and some environment variables for that are different in the cmd shell? I'm using the copy of ccx.exe that comes with Mecway which doesn't support multithreading.

    For me, H10a.liml with the command line takes 46 seconds using an online stopwatch and the GUI take 43 seconds according to the solver window you also used.

    Yes, they both use the same CCX with the same parameters and Mecway doesn't try to identify the CPU or anything like that for CCX, only the internal solver.

    Are you sure there was no existing solution present in the file which would take time to load with the command line but be excluded from the GUI's timer?
  • Victor --

    I started the GUI and verified that no results were shown under Solution. (This model had previously been analyzed in the GUI. However, I had chosen Solution\Clear prior to running from the command line).

    I then reran H10a.liml from the command line. The results were --

    ==========================
    Now : 8/9/2022 22:33:14

    H10a.liml ... done
    Finished
    Now : 8/9/2022 22:34:27
    ==========================

    This gives a net time of 1:13 or 73 secs (nearly the same as above).

    However, I also just reran from the GUI with a time of 70 secs (an increase from the previous 48 secs). Obviously something has changed between between the previous and current FEA but not sure what. (I didn't reboot.) I'll keep an eye on this.

    Note -- For my previous post I had run the FEA several times for both the GUI and command line for which the time scatter was negligible. Same here for current FEA. For example, current GUI analyses gave 70, 69, and 72 secs.

    Suggestion -- When running from the command line, it would be nice to see some real-time output similar to the "Details ..." in the GUI. This would verify that the analysis hadn't hung. The output could also be piped to a file for later inspection.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!