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

Added "four-line" proposal for units of literals #3266

Open
wants to merge 24 commits into
base: MCP/0027
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7524b11
Initial commit of ReadMe.md for MCP-0027
henrikt-ma Oct 4, 2022
a762fc7
Added "four-line" proposal for units of literals
casella Oct 25, 2022
bdbea3b
Reformatted to use sentence-based line breaks. Added inline codes for…
casella Oct 26, 2022
eb116d7
Wrote out LHS and RHS
casella Oct 26, 2022
b676ad9
Outputs of transcendental functions should be dimensionless
casella Oct 26, 2022
11dc52d
Fixed type
casella Oct 27, 2022
9a1deda
Updated proposal
casella Oct 28, 2022
df6242b
Update chapters/lexicalstructure.tex
casella Nov 2, 2022
5d5f466
Update chapters/lexicalstructure.tex
casella Nov 2, 2022
398c013
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
7a9f340
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
77eaae7
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
8916f6e
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
2c817dd
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
942776f
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
b3e0dc1
Update chapters/lexicalstructure.tex
casella Nov 9, 2022
3370313
Update lexicalstructure.tex
casella Nov 10, 2022
7539f1b
Update lexicalstructure.tex
casella Nov 10, 2022
15bb554
Update chapters/lexicalstructure.tex
HansOlsson Nov 11, 2022
26bce83
Update chapters/lexicalstructure.tex
HansOlsson Nov 11, 2022
ba23447
Update chapters/lexicalstructure.tex
HansOlsson Nov 11, 2022
4a7c941
Update chapters/lexicalstructure.tex
HansOlsson Nov 11, 2022
0f5c46a
Update lexicalstructure.tex
casella Nov 15, 2022
e325f6f
Used LaTeX instead of rST for itemized list
casella Nov 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chapters/lexicalstructure.tex
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ \subsection{Units of Literal Constants}\label{units-literal-constants}

The following rules apply:
- The result of `x + L`, `L + x`, `x - L`, `L - x`, `x*L`, `L*x`, `x/L`, where `x` is an expression with non-empty \lstinline!unit! attribute string `<s>` and `L` is an expression containing only literal constants, shall have the same \lstinline!unit! attribute string of `x`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm off-base or too precise again, but I don't think expressions even have a unit attribute string -- only Real does (4.8.1).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could write "real expression". Note that the literal can also be an integer literal, but the assumption is that both x and x+L (etc) are "real expressions".
Alternatively, we could view it as expressions having a unit - in general - but that may require more work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall have the same \lstinline!unit! attribute string as x.

Copy link
Collaborator

@qlambert-pro qlambert-pro Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could write "real expression".

What about arrays?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could write "real expression".

What about arrays?

That's messier - let's focus on their scalar elements first.

Usually, arrays are homogenous - i.e., all elements have the same unit - but sometimes they are not (especially when applying filtering to an array).

Note that you can write Real x[2](unit={"m","m/s"}), so you can create non-homogenous arrays - but it's not common.
(I believe we added support for that in Dymola in 2013.)

HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
- The result of `L/x` shall the the \lstinline!unit! attribute string `1/(<s>)`.
- The result of `L/x` shall the the \lstinline!unit! attribute string `1/(<s>)`.
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
HansOlsson marked this conversation as resolved.
Show resolved Hide resolved
- The result of `x^L` shall have the \lstinline!unit! attribute string of `product(fill(x, L))` if L is a positive Integer, or the unit of `1/product(fill(x, L))` if L is a negative Integer
casella marked this conversation as resolved.
Show resolved Hide resolved
- If either side of a relational operator is a literal constant, then it is assumed to have the same \lstinline!unit! attribute string of the other side, if that is well-defined.

Expand Down