[font=Monaco, Menlo, Consolas, "Courier New", monospace]Is there a way to adjust to the VTrun.cmd file generated when pressing solve in Veda?
I would like to include a gams times-report-script at the end of the VTrun.cmd file after the GDX2VEDA GAMSSAVE line.
The purpose of the gams times-report-script is to collect all relevant output from TIMES in long format, i.e. all attributes and dimensions from our TIMES model are organised into a single parameter and saved as a GDX.
Currently, I run the times-report-script manually after solving TIMES; however, I think it would be a great improvement if it was possible to make the times-report-script run automatically when solving the TIMES from VEDA.
Any help or suggestions would be greatly appreciated :-)
Cheers,
Kristoffer[/font]
Kristoffer S. Andersen
<br />Advisor, Danish Energy Agency
Thanks for this request. We have already made it possible to write GAMS statements in several different locations of the RUN file, at the top/bottom of scenario DD files, and pass GAMS switches to the GAMS call statement in the VTrun.CMD file. See the *cmd* attributes. We can create another parameter to serve your purpose. Can you upload a CMD file with an example of the statement you wish to add?
06-04-2022, 12:06 PM (This post was last modified: 10-04-2022, 12:37 PM by kristofferand.)
(05-04-2022, 03:22 PM)AKanudia Wrote: Thanks for this request. We have already made it possible to write GAMS statements in several different locations of the RUN file, at the top/bottom of scenario DD files, and pass GAMS switches to the GAMS call statement in the VTrun.CMD file. See the *cmd* attributes. We can create another parameter to serve your purpose. Can you upload a CMD file with an example of the statement you wish to add?
Dear Amit, thank you for your positive and fast reply. I attached a illustration of the vtrun (vtrun.txt). In essence, I would like to replace the following code in the VTrun.CMD:
Code:
@echo off
Title kp22 [ Test case] [GAMS_WRKTIMES]
CALL ..\GAMS_SrcTIMES.v4.6.0\VT_GAMS kp22 GAMS_SrcTIMES.v4.6.0 GAMSSAVE\kp22 '' ..\ lo=1 2>&1 | tee "kp22.txt"
GDX2VEDA GAMSSAVE\kp22 ..\GAMS_SrcTIMES.v4.6.0\times2veda.vdd kp22_0404
@echo Closed >RunTerminated
With:
Code:
@echo off
Title kp22 [ Test case] [GAMS_WRKTIMES]
CALL ..\GAMS_SrcTIMES.v4.6.0\VT_GAMS kp22 GAMS_SrcTIMES.v4.6.0 GAMSSAVE\kp22 '' ..\ lo=1 2>&1 | tee "kp22.txt"
GDX2VEDA GAMSSAVE\kp22 ..\GAMS_SrcTIMES.v4.6.0\times2veda.vdd kp22_0404
gams c:\%pathtimesreportscript%\timesreport.gms --scenname=kp22
@echo Closed >RunTerminated
Since the gams times-report-script needs to run on different computers, it would be ideal if the individual user controls the path for the script, hence the %pathtimesreportscript%\.
Cheers,
Kristoffer
Kristoffer S. Andersen
<br />Advisor, Danish Energy Agency
I could not managed to make this functionality work. I would like to run a python script after gdx2veda. It is a powershell command “python script.py”.
I have tried this implementation which appears in the browse but the VTRUN.cmd is not modified.
Do you have any suggestion to make it work please?
21-04-2023, 06:47 PM (This post was last modified: 21-04-2023, 06:50 PM by Antti-L.)
Thanks, found it now, after launching VEDA2 and looking at the list there!
Instead of launching VEDA2 for such documentation, I seem to have a habit of searching the online VEDA documentation for info on VEDA attributes, and it is not mentioned there: https://veda-documentation.readthedocs.io/en/latest/pages/Run%20Manager.html
I also tried it now, but could not get it working.
Apologies for the confusion. These attributes were only partly implemented, and that too only under the restart file option. The version just released enables these attributes in the regular solve as well. Note that the CmdF_* attributes will not be available under Veda online.
Thank you for this new feature, I managed to use it.
I am trying to do a postprocess on the vd file each time I do a model run. I attached an example in this post of a modified VTRUN.cmd .
I want to apply my command postprocess to the newly created vd file. I added a line after gdx2veda but I am having difficulties to correctly name the vd file. In my example, I would like to have demos_012_postprocess.vd instead of casename.vd .
Is there a possibility to have an access to the veda variable casename ? This value is already used in the VTRUN.cmd for the title.
Do you have suggestions to handle this difficulty ? I can use *.vd but it does not separate the last run from older ones. Something like $casename.vd might be more appropriate.
(30-06-2023, 04:05 PM)VictorG Wrote: Thank you for this new feature, I managed to use it.
I am trying to do a postprocess on the vd file each time I do a model run. I attached an example in this post of a modified VTRUN.cmd .
I want to apply my command postprocess to the newly created vd file. I added a line after gdx2veda but I am having difficulties to correctly name the vd file. In my example, I would like to have demos_012_postprocess.vd instead of casename.vd .
Is there a possibility to have an access to the veda variable casename ? This value is already used in the VTRUN.cmd for the title.
Do you have suggestions to handle this difficulty ? I can use *.vd but it does not separate the last run from older ones. Something like $casename.vd might be more appropriate.
Hi Victor,
I have modified VTRUN.cmd file to give you access to vd file name variable. Just try it out and let me know if this serves your purpose.
thank you for your answer. It does not meet my need yet. I will try to be more explicit.
My goal is to automate the postprocess of my vd files, I have a python command I want to execute after every run on the newly created vd.
I have few constraints:
-python procedure called after gdx2veda has created the vd file
-be sure it is the newly vd file that is processed and not an older one
-the procedure is linked to the model and the gams_wrk can be executed on different computers with no extra adjustment of the code as long as the computer has the python script
I thought that the attribute CmdF_bot was well suited for my problem because it can store the information of the modification in the dd files and the cmd is modified automatically each time dd files are generated. However there is a small difficulty here because the regular scenarios in excel contain input data while the casename (prefix of the vd)
is linked to the run manager.
The solution that would fit my need is to have an access to the veda variables of the Run manager with the attribute CmdF_bot. I noticed the %1 flag which corresponds to the case name in the VT_GAMS.CMD in the TIMES source code.
A suggestion would be to have an excel file with the following string 'postprocess %1.vd' for CmdF_bot in an excel file and that is interpreted as writing a line after the gdx2veda in the cmd corresponding to: postprocess casename.vd
04-07-2023, 08:31 PM (This post was last modified: 04-07-2023, 09:29 PM by Antti-L.)
If producing a *.vd file with the case name (without any date postfix added) would help, accomplishing that is quite easy. Please try putting the attached file (extract it from the zip file) to the work folder. It will cause producing *.vd* files with the correct case name.
[Edit:] Ah... I forgot to change one "demo5" in that cmd to the case name, sorry. It is now updated.