When trying to save interim results including the model in PlantSimulation, a situation can be generated that crashes Plant Simulation:
filename := copy(modelfile, 1, strlen(filename) - 4;
filename := filename + "_" + time_to_str(Ereignsverwalter.zeit, true) + ".spp";
sichermodell(filename); -- and now, PlantSimulation crashes!!!
Your code contains syntax errors and logical errors.
I assume that you meant this:
is filename: string; do filename := copy(modelfile, 1, strlen(modelfile) - 4); filename := to_str(filename, "_", time_to_str(Ereignisverwalter.zeit, true), ".spp"); sicheremodell(filename); end;
Which version of Plant Simulation did you use, and what was your original filename?
I tried this code with Version 10.1.12 and 11.0.8, and it did not crash.
even if PSI 10.x wouldn't fail - which I could not check - PSI 12.x does not save files
with names like "Demo_filesave_bug_30:00_1:00:00.spp" which you're method is creating
This is more an operating system- than a PSI- matter as the OS does not accept filenames with this count of colons
I assume you didn't check the individually created filenames (through a simple print filename)
before saving the model and expected, the OS will accept any kind of individual filename
This is not the case.
I would have expected, that in any case the system command is not working out, PlantSimulation 10.1 returns some error and not crashes completely with an exception.
I now had the chance of testing your model with PSi 10.1.12. (32 bit).
As for latest V11 and V12 versions, the tested PSi 10.1.12 version does NOT crash but pops up a message window, telling , that the file(s) (with colons) cannot be saved....
I therefore suggest, you proceed with the workaround and do not create file names which are not accepted by the operating system ( e.g. with colons)
The problem is the colon ":", which has a special meaning in the Windows file system NTFS. The path "filename:streamname" creates an alternate data stream in the file "filename". Unfortunately the software does not handle this case correctly. We will fix this.
I advise that you do not use colons in the file name. For example you could replace all colons with an underscore.