Page 1 of 1

several units in one subscripted variable?

Posted: Mon Jul 12, 2021 10:28 am
by kleemax
Example variable: Energey efficiency of Trucks: conventional Trucks units [liters/km], battery electric Trucks[kwh/km], Compressed Natural Gas Trucks [kg/km]...
Is it possible to have subscript elements that are conceptually basically the same but use different in units?
Of course I am aware that there are other potential solutions:
a) use several variables instead one for each unit or
b)convert all inputs to the same unit (.e.g. joules/km in the example above.
However, a has the disadvantage that I get more variables in a model that is too big already and b has the disadvantage, that I have to convert angain back later. Plus the units that are typically used have the advantage that they can be directly communicated. Most importantly however, I am working with models that someone else built, where the current situation is that the unit check no longer works because Vars have subscripts that quantitatively use different units, although the equation editor shows only one of them and the others are simply mentioned in the comment.

In text view however, when I define several equations, I actually see the syntax for one unit for each equation.
I have tried to enter units in text view (see attached model) but it seems the unit checker only uses the first units mentioned?
If you open the attached model in a text editor, you will see the differing units, you don't see them in the equation viewer and as soon as you save the model again in Vensim, all units but the first are lost.
If it's not possible to make this work, consider this as a feature request;-)

Re: several units in one subscripted variable?

Posted: Mon Jul 12, 2021 10:50 am
by Administrator
No, you cannot have different units within a single parameter. The only option is to convert to something common and back again if you need to.