cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Multi-threading Mathcad + Excel

DM_10127316
7-Bedrock

Multi-threading Mathcad + Excel

Hi all,

 

I have an Excel file with thousand of cases. The inputs of each case are sent to Mathcad through its API, and the results are sent back to the Excel file. This process is repeated sequentially, solving each case one-by-one. As you can imagine, it takes several hours to finish all cases.

 

I wonder if there is an option to use multithreading/parallel programming to solve several cases simultaneously and speed up this process.

 

Also, is there an API command that returns TRUE or FALSE if Mathcad is busy calculating? At the moment I am waiting a fixed amount of time (15 seconds) between cases. Maybe I can ask each second if Mathcad is calculating until it is not and then extract the output values.

 

Thanks!

Regards,

 

 

 

 

 

5 REPLIES 5

Capture.JPG

It is unclear what happens when several files are open at once with independent calculations. 

You could put several independent load cases in one sheet.  Say ten at a time, then the ten would run in separate threads.

Does multithreading only work on the one sheet?

You could try setting the multithreading calculation option and opening several files at once and see if they solve together.

 

Cheers

Terry

Thanks for the reply. I am using the multithreading option and the time per case is significantly reduced by half. That's good.

 

Do you know which API command is able to do what you mention? I couldn't find it in the documentation. Thanks!

Do you know which API command is able to do what you mention? 

Can you expand on the question, not sure what you mean.

Cheers

Terry

 

Sorry, I received a notification and I was replying to the following message:

 

Yes, there is an option to use multithreading/parallel programming to speed up the process of solving multiple cases simultaneously. This can significantly reduce the time required to finish all cases. Additionally, you can check if Mathcad is busy calculating by using an API command that returns TRUE or FALSE. Instead of waiting a fixed amount of time between cases, you can continuously check if Mathcad is calculating and extract the output values once it is not. This will help optimize the process and improve efficiency.

 

I can't find the message though. I basically wonder if there is a way to know through the API if Mathcad Prime is busy calculating? I can't find it through the documentation. My idea is to change imposing a fixed time per case for a dynamic time dependent on how long Mathcad takes per calculation.

You replied to a spammer whose posting was deleted in the meantime.

Top Tags