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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Nasty problem including files in Mathcad Prime (7.0.0.0)

Manfred_F
6-Contributor

Nasty problem including files in Mathcad Prime (7.0.0.0)

In my company, we use a library of files, which are included in our projects. These files can be for example datasheets of components, formulas out of toolboxes and so on. If we open a project file we encounter very often the problem that include files are marked red, meaning Mathcad reports an error with the file. The fact is, that there is no error in the file:

mfroehler_0-1637827631145.png

We found a workaround for this, but this takes a lot of time. When you edit the path, you can force MathCad to reread the file and the error is gone. This has to be done for all marked files. Sometimes even this does not work. Then you have to open the corresponding file, recalculate and store it again.

As we have include files, which include other files, this can get very very nasty. I reported this already more than 2 years ago, but no reaction. Now this problem got even worse. As the network path changed, MathCad hanged or got extremely slow (hours !), when opening a file with include file paths still on the old, not anymore existing, network location. After updating the paths, we still encountered this problem. I found out, that MathCad somehow "remembers" the old paths, even after correcting the paths. Very odd. I opened the Mathcad files with a text editor and found out, that the old network paths were still stored inside the file, even after correcting them. Besides I found out, that data from included files are somehow stored in the current Mathcad file, despite the fact that we disabled caching on all files. I also observed that, when I create data arrays, the file size gets bigger with the size of the arrays, even when disabling caching. I would not expect this. If caching is disabled, I would expect Mathcad to recalculate the complete sheet and to reread and recalculate all included sheets, even sheets included in included files and so on.
All this slows us down, making it hard to work with Mathcad. does anybody have a solution for this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Manfred_F
6-Contributor
(To:VladimirN)

The first case seems to be opened by our IT-support and the second problem was reported by me to our support and to a distributor of Mathcad Prime more than 2 years ago and it is still present. Seems that someone else now has the same problems. Up to now I didn't get the number of the ticket, but at the moment I can live with the solution we found here.

View solution in original post

21 REPLIES 21

1. Have you previously reported this to the PTC's technical support (by using "Case Logger": https://www.ptc.com/en/support/case-logger )?

2. What exactly are contained in these files?

Manfred_F
6-Contributor
(To:VladimirN)

1 In my company (Vitesco) with about 40000 employees we have an IT support. Together with the support I tried to open a ticket. But we encountered a problem. In my login profile the website stated Vitesco has a gold support contract. When I submitted the ticket I got the error that I am not allowed to open a ticket, because I only have silver status. I then gave this case over to the support, who told me later that they opened a ticket. I am not sure about that because I didn't hear anything about it. The ticket was opened on 18th or 19th November

2. The include files in the library contain for example datasheet values of electronic components such as resistance values, voltages of diodes etc. or for examples basic formulas, which are often used such as voltage divider ratio calculation or formulas for often used circuits. Include files in the project directory mostly consist of project wide values for example voltage ranges of power supplies etc. We also have include files, which again include other files

 

Here is an example of a file I mentioned above:

None of the included files contains a path including the string "conti":

mfroehler_0-1637833868718.png

When I open the file in a text editor, I can find paths containing "conti". This paths do not exist anymore, which lead to the problems mentioned above. But none of these paths are used in the Mathcad file. This is very odd:

mfroehler_1-1637834046969.png

 

If they did open a new Case, then there must be a number. Ask them for it.

StuartBruff
23-Emerald II
(To:Manfred_F)


@Manfred_F wrote:

In my company, we use a library of files, which are included in our projects. These files can be for example datasheets of components, formulas out of toolboxes and so on. If we open a project file we encounter very often the problem that include files are marked red, meaning Mathcad reports an error with the file. The fact is, that there is no error in the file:

mfroehler_0-1637827631145.png

We found a workaround for this, but this takes a lot of time. When you edit the path, you can force MathCad to reread the file and the error is gone. This has to be done for all marked files. Sometimes even this does not work. Then you have to open the corresponding file, recalculate and store it again.

As we have include files, which include other files, this can get very very nasty. I reported this already more than 2 years ago, but no reaction.


Have you tried:

 

  • recalculating the whole worksheet?
  • selecting an include region and pressing F5 (recalculate region)? {⁑} 

 

Stuart

 

{⁑} ... not forgetting, like I often do, to press the Fn key as well as F5 if needed, depending upon how I've set up my function keys.

 

Manfred_F
6-Contributor
(To:StuartBruff)

The problem is that Mathcad somehow tries to access "old" paths, which I did not specify in the file, see above, but are somehow inside the .mcdx file. This leads to the problem that already opening this file needs 30 minutes or longer. Recalculating didn't change anything.

For this file I had to open, recalculate  and store all include files and all files included by this files and so on, down to the lowest level. Takes me hours of work and we have a lot of other files. In my opinion this is a bug in Mathcad. why should it store and access some old paths, which are not anymore existing in my file? 

Additionally when I saved this file it took another half an hour to save it as long as the "workaround" was not done.

What warning does the program show next to the file link?

Manfred_F
6-Contributor
(To:VladimirN)

If you mean the red encircled paths   the error is : "this file contains calculation errors, open it to see the errors"  (translated from the german version).

If you open this file it does not contain any error.

And in the original in German?

Manfred_F
6-Contributor
(To:VladimirN)

Do you want to annoy me or what is the sense of this question?

The german message is " Diese Datei enthält Berechnungsfehler. Öffnen sie die Datei um die Fehler zu sehen"

No. I need an exact phrase to search the technical support database.

Manfred_F
6-Contributor
(To:VladimirN)

As I already described the problem is not the red encircled file, for this we have a workaround, which I also described.

The true problem is, that Mathcad tries to access a path (you can see in the text editor screenshot), which is not specified in the main file (there is no include file with this path as you can see in the picture from the worksheet). As this path is not existing anymore, Mathcad somehow takes a long time to open the main file.

LucMeekes
23-Emerald III
(To:Manfred_F)

If you have a sheet file with an included file, and you recalculate the sheet entirely (press the calculate butten)

LucMeekes_1-1637848508133.png

and then save it, then the path to the include file should be updated in the (referring) sheet file. But the included file is not updated by this process, so any path(s) to included file(s) in there are NOT updated. To update that, you have to open the include file itself, recalculate it and save it.

 

Hope this helps,

Success!
Luc

StuartBruff
23-Emerald II
(To:LucMeekes)


@LucMeekes wrote:

If you have a sheet file with an included file, and you recalculate the sheet entirely (press the calculate butten)

LucMeekes_1-1637848508133.png

and then save it, then the path to the include file should be updated in the (referring) sheet file. But the included file is not updated by this process, so any path(s) to included file(s) in there are NOT updated. To update that, you have to open the include file itself, recalculate it and save it.


That's why I suggested a recalculate as something to try.

 

However, it does introduce an interesting conundrum.  A "feature suggestion" might be to auto-calculate all worksheets in a chain, but I would suggest that it is optional.   

 

At the moment (AFAIG), the referenced worksheet doesn't update when it's read in.  At least part of the rationale for this behaviour is that it may have taken a long time to calculate in the first place and, by saving the data, the user doesn't have to wait for a recalculate (which Herr Froehler indicates is part of his problem).

 

A recalculation would only be necessary if something in the environment had changed or the user wanted to ensure all calculations were up to date.   

 

The next step in the "reference" problem is whether Mathcad should save changes to referenced worksheets.  Again, if I were a support customer, I might suggest it as an option on the Save dialog - whatever requires less thinking and effort on the user's part.

 

A feature I would definitely have had occasional, but heartfelt, use for would be the ability to specify a new library location and have Mathcad (optionally) automatically update all references that point to that new location.

 

Stuart

Manfred_F
6-Contributor
(To:LucMeekes)

Yes that is correct. In the beginning I did not do a recalculation of the sheets, because I just changed the paths in the include statement. Furthermore I thought if I disable caching on all files (this is standard on all of our files) MathCad has to reread all include files. What else is the sense of disable caching?

Nevertheless besides of all data inside these files, Mathcad also seems to cache the include paths and then tries to access an old path, which is not visible in the sheet anymore and fails. This is an absolute crazy behavior in my opinion and you don't see an error message or anything just Mathcad working extremely slow.

As we have hundreds of files and a big team working on them, additionally files, which include many files, which again include files... that means for every sheet you have to follow all these levels down and open/recalculate all sheets. This opens the way for many errors to happen without any error message. Even calculations can go wrong without knowledge. No wonder when the next NASA mission will crash....

 

Manfred_F
6-Contributor
(To:Manfred_F)

Stuart I agree. As I wrote in the last answer (for Luc) I expected that, disable caching would do it. Besides the calculation time is not so high that I couldn't accept it. The problem with this "automatic" caching is, that it opens the way for serious errors, when you forget to update all included files. Think about a NASA project with many files and a big team working on it.....Besides, our electronic control units have very high safety levels comparable to aeroplanes.

LucMeekes
23-Emerald III
(To:Manfred_F)

So I read, explicitly, that you did NOT open and recalculate all include files. So any files that you include in others, and that existed before the location migration, still have the old paths in them. There's NO OTHER WAY to get these paths corrected unless you actually reopen those files, recalculate them, and save them. The caching that you refer to only deals with calculation results, not to paths, since they are not calculation results. And results of calculations located in an include file are not cached in the referring sheet file.

Hmm. A correction is in order, read here: https://community.ptc.com/t5/PTC-Mathcad/Mathcad-ABC-I-Is-for-Include-Worksheets/m-p/445026#M175045 It appears that Prime will also cache definitions of included worksheets.

The suggestion of Stuart, to provide a setting where all include files are newly calculated and saved, may fail as I can think that many of those include files are set to read-only, because they are not meant to be changed (unless....).

Anyway, there should be no harm done to any of those files if all you do is open them, recalculate and then save. After all, you have to realise that such include files are recalculated whenever the referring sheet is recalculated.

Leaves the point where you say that you have a Prime sheet file that includes another sheet file, and the path to that included file as displayed on the sheet is different from its internal administration. Please attach one, if you can.

 

One other thing that very likely may cause your problems, especially with so many (levels of) include files, is that you may have inadvertently created a loop of include files. If that is the case, Prime will traverse that loop over and over again, which takes much time. And I would not be surprised that it marks include files as containing errors.

 

Success!
Luc

Manfred_F
6-Contributor
(To:LucMeekes)

Luc, I already found out that I have to open all include files and recalculate them. We also checked that we don't have a circular include, besides that our "systemic" approach already cares for this. Furthermore I already stated that caching is disabled for all files. As PTC states that include works the same way as when I would insert the file at the location of the include command, nobody expects, that I have to do a recalculation (as long as the include file is not changed when the main file is open). So after opening a file I would expect with caching disabled that all files are reread. I also observed that file size gets bigger when I create big arrays (caching disbled). Think about this, I have a small file with a few formulas and storing this file takes Gigabytes of memory (caching disabled). That is not what I expect. So the caching feature is surely very useful in cases where I dont want to wait a long time for results, but when it is disabled I expect that all data is not stored inside the file. Finally I really dont expect, that Mathcad stores the path of the include files (also with caching disabled). I remember I made an experiment with including files and I found a screenshot, which states that Mathcad stores these paths. At the time I made this experiment I didn't realize the consequences this has:

mfroehler_0-1637910338966.png

This picture shows that after changing the path of the include file Mathcad showed an error that it cannot find the file, but showing  a different path to the file in the error message. This is showing the cached path !!!! 

In principle we now have a solution, but a very annoying one, because we have a lot of work with updating all these sheets. Our library consists of hundreds of files. If this caching feature would work as expected, we wouldn't have any problems. 

LucMeekes
23-Emerald III
(To:Manfred_F)

I fully agree with you that when caching include files is switched off, Prime should not store the included calculations in the including sheet file. What Prime will store (and I don't know if you can switch that off, I don't remember seeing a Prime sheet without it.) is the results of calculations on the present sheet. That data can have the file grow substantially if e.g. large arrays are calculated...

 

Your picture of the include files triggers the following:

In (real) Mathcad (version 15 and before) there are two different ways of referring to an include file: Absolute (full pathname required) or Relative (to the currently open sheet). I assume that Prime supports the same, I can't check, since I'm limited to Prime express, and including sheets is one of the lacking features then.

If you use relative references, you have to make sure that your include files are always found through that relative path.Of course the same is true for absolute paths..

I would not be surprised if Prime (With PTC you always have to be prepared for any surprises, be they pleasent or not!), when saving a sheet that includes a reference to another sheet, stores the path to that relative sheet where it found it. Upon next time opening the sheet it would look there first to check the include sheet. Now if you move a sheet that includes another, you have to move the included sheet along. The error message indicates that, in your case: Prime will look for (all, to any level of depth?) included sheets relative to the path of the current sheets. My interpretation of the picture you show is that E.mcdx includes F.mcdx through a relative reference.

 

Success!
Luc

Manfred_F
6-Contributor
(To:LucMeekes)

We do not use relative paths. We have usually 2 directories we use; one library and one project. Mathcad sets the current working directory always to the path of the open file. This is usually a project file and everything would work fine with relative paths. But we have also lib files , which include other lib files. When you edit such a lib file (call it lib1) and use a relative path to include another lib file (lib2), you get problem when you open your project file and include lib1. Then the CWD is the path of the project file and the second include to lib2 won't work. Therefore I would like to have a feature, which allows to use string variables for include paths. Shouldn't be so hard to implement......

There are only a few suggested solutions that are somehow related:

 

 

P.S. By the way, did you manage to find out the number of the "Case" that your technical support opened, so that we can see its status at the current time? 

Manfred_F
6-Contributor
(To:VladimirN)

The first case seems to be opened by our IT-support and the second problem was reported by me to our support and to a distributor of Mathcad Prime more than 2 years ago and it is still present. Seems that someone else now has the same problems. Up to now I didn't get the number of the ticket, but at the moment I can live with the solution we found here.

Top Tags