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

Equations with more than two lines result in bad comments #174

Closed
ToddFincannon opened this issue Mar 19, 2022 · 1 comment · Fixed by #175
Closed

Equations with more than two lines result in bad comments #174

ToddFincannon opened this issue Mar 19, 2022 · 1 comment · Fixed by #175
Assignees
Labels
Milestone

Comments

@ToddFincannon
Copy link
Collaborator

Long Vensim equations extending over multiple lines may be turned into a bad comment. For instance,

This Year Change in Process Emissions by Policy and Industry[water and waste 36T39,indst methane destruction\
		,Pollutant]=
	Industry Process Emissions Policy to Pollutant Mappings[indst methane destruction,Pollutant\
		]
	*
	(
	  -SUM(Process Emissions Abated due to Carbon Tax by Marginal Cost[waste management methane destruction\
		,Marginal Abatement Cost
!])

	  - (
	      SUM(PERAC Mass CO2e Avoidable by Marginal Cost[waste management methane destruction\
		,Marginal Abatement Cost!])
	      - SUM(Process Emissions Abated due to Carbon Tax by Marginal Cost[waste management methane destruction\
		,Marginal Abatement Cost
!])
	    )
	    * Fraction of Methane Destruction Opportunities Achieved This Year[water and waste 36T39\
		]
	) ~~|

becomes:

// This Year Change in Process Emissions by Policy and Industry[water and waste 36T39,indst methane destruction,Pollutant] = Industry Process Emissions Policy to Pollutant Mappings[indst methane destruction,Pollutant]*(-SUM(Process Emissions Abated due to Carbon Tax by Marginal Cost[waste management methane destruction,Marginal Abatement Cost!])-(SUM(PERAC Mass CO2e Avoidable by Marginal Cost[waste management methane destruction,Marginal Abatement Cost!])-SUM(Process Emissions Abated due to Carbon Tax by Marginal Cost[waste management methane destruction,Marginal Abatement Cost
!]))*Fraction of Methane Destruction Opportunities Achieved This Year[water and waste 36T39])

Note the join fails to include the last line of text.

@ToddFincannon ToddFincannon self-assigned this Mar 19, 2022
@ToddFincannon
Copy link
Collaborator Author

Vensim may split a very long equation over multiple lines. EquationGen joins them into one long line when emitting the comment with the original equation. However, this was done with a string replace that only handled the first newline. Use a global replace to join multiple lines.

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