Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Logging Script adding Time rows within a single variable output #86

Closed
robbieorvis opened this issue Aug 12, 2020 · 9 comments
Closed
Assignees

Comments

@robbieorvis
Copy link
Contributor

The data logging script appears to be adding some extra Time lines for certain variables when saving out data. See attached for an example
DataLoggingExample.xlsx

@jrissman
Copy link
Contributor

It looks like this is happening in bldgs/BCEU because the variable is of mixed type: most of the subscript elements are data type, populated by GET DIRECT DATA, but the "envelope" subscript element is a constant type, because it has a hard-coded zero in Vensim. Adding the extra "time" rows is the behavior of Vensim's VDF2TAB function when operating on variables of mixed type - it isn't an issue with the Python script.

I can fix this by reading in a CSV file for "envelope" for BCEU that is filled with zeroes. Then BCEU would not be of mixed type anymore - the variable would be entirely data type. On the downside, we'd have an extra blue tab in that Excel file, and an extra CSV file to read in, which should always contain only zeroes. I assume you think it's better to have the extra blue tab and extra CSV file full of zeroes in order to avoid the extra time rows in the script output, right?

Are there any other variables besides BCEU where you have seen this issue? I need to fix each variable individually, so I'd need to know which ones are of mixed type. There might not be any others besides BCEU - it's pretty rare for us to be taking in data from CSV files for some subscript elements and hard-code others. The handling of "envelope" in the buildings sector is unique, or close to unique.

@jrissman
Copy link
Contributor

Also, it only applies to the first variable to be listed, because I'm suppressing the time axis on all variables after the first. If you don't need any time axis at all, even on the first variable, I could suppress it there too. But I'm reluctant to do that because it can be a very important way to catch bugs - for instance, you might not notice time mis-alignments if there is no time axis showing. So I'd recommend against the approach of suppressing the time axis entirely.

@robbieorvis
Copy link
Contributor Author

robbieorvis commented Aug 12, 2020 via email

@robbieorvis
Copy link
Contributor Author

robbieorvis commented Aug 12, 2020 via email

jrissman added a commit that referenced this issue Aug 12, 2020
…t produce extra time axes when used on this variable (#86)
@jrissman
Copy link
Contributor

Completed in commit 175d793.

@robbieorvis
Copy link
Contributor Author

robbieorvis commented Aug 12, 2020 via email

@jrissman
Copy link
Contributor

I think you forgot to attach the output vars file. Or at least, the attachment didn't make it through to GitHub.

@robbieorvis
Copy link
Contributor Author

Here you go.
outputexample.xlsx

@jrissman jrissman reopened this Aug 13, 2020
jrissman added a commit that referenced this issue Aug 13, 2020
…d suppress Time row in Vensim command script to work around bug where Vensim includes multiple time rows (#86)
@jrissman
Copy link
Contributor

Okay, Vensim's behavior with including multiple Time rows is buggier than I thought. It doesn't just apply to variables of mixed type, like BCEU. It is not clear why Vensim includes Time rows for six of the variables in that output but not the others.

To work around this, I've modified the script so that we suppress the time row entirely from Vensim's VDF2TAB output. So that you still have a Time row, we now generate the tab-separated values output file when running the Python script and build the Time row using Python. Then you run the command script, and Vensim appends the run data to the .tsv file, rather than overwriting the file. This results in a clean output file with a single Time row at the top.

Completed in commit b5e5f12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants