Parsing Error: Expression too long to be parsed.

4 posts / 0 new
Last post

Hi Friends,

I have encountered an expression evaluation error that would seem pretty self-explanatory on the surface:
[cid:image004.png at 01D35D3E.2C04E470]

After a couple passes to do the logical thing and reduce the line count and character count in the expression (trimming whitespace, removing annotations), I realized a mistake where I used #L instead of #LR for a reference to C-ACTIVITY-DESC.

Trimmed Example - the highlighted characters should read #LR:
switch(#SV(#PS()))
case 1 : 38800.32*#L("SPACE","AREA")/10260.77 $Exh*Area/Total Unit Area
case 2 : 27584.18*#L("SPACE","AREA")/7294.65 $Exh*Area/Total Unit Area
case 3 : 33622.74*#L("SPACE","AREA")/8891.55 $Exh*Area/Total Unit Area
case 4 : 12621.09*#L("SPACE","AREA")/3337.66 $Exh*Area/Total Unit Area
case 5 : 8551.12*#L("SPACE","AREA")/2901.15 $Exh*Area/Total Unit Area
case 7 : 18717.66*#L("SPACE","AREA")/6350.37 $Exh*Area/Total Unit Area
case 8 : 8066.63*#L("SPACE","AREA")/2899.83 $Exh*Area/Total Unit Area
case 10 : 24826.83*#L("SPACE","AREA")/8924.85 $Exh*Area/Total Unit Area
default : no_def
endswitch

Fixing that function, unintuitively, caused the above "expression too long" error to go away!

This however raises a couple questions - I'd be sincerely interested to see any replies or thoughts around either prompt:

1. I didn't think there was a limit for expression length (or at least a practical limit). The existence of this error suggests otherwise. To avoid crossing that line and to better interpret these errors in the future: Does anyone know what the actual character/line/other limits are for expression length?
* For reference, after trimming this was a relatively hefty expression clocking in at 2737 characters and 73 lines, according to my text editor... so if there is a limit it would be above those figures since it's now working again.
2. To further help interpret/troubleshoot similar situations in the future... Why would using #L (which I would think should resolve in an error along the lines "you're using the wrong function here, dummy") trigger an expression length error? Is there a hierarchy of error messages that maps out "throw error X before checking for root cause Y," that we could construct and keep as a reference for interpreting what different expression evaluation errors could mean when they come up?

Thanks everyone!

~Nick

[cid:image002.png at 01D35D3B.BED9BA30]
Nick Caton, P.E., BEMP
Senior Energy Engineer
Regional Energy Engineering Manager
Energy and Sustainability Services
Schneider Electric

D 913.564.6361
M 785.410.3317
F 913.564.6380
E nicholas.caton at schneider-electric.com

15200 Santa Fe Trail Drive
Suite 204
Lenexa, KS 66219
United States

[cid:image003.png at 01D35D3B.BED9BA30]

Nicholas.Caton at schneider-electric.com's picture
Joined: 2016-02-26
Reputation: 0

Hi Nick,
It is not too hard to exceed this limit for long expressions. I'm wondering if your original expression exceeded it and your revised did not, so that it has nothing to do with the #L vs. #LR issue you mention.
Regards,
~Bill

William Bishop, PE, BEMP, BEAP, CEM, LEED AP | Pathfinder Engineers & Architects LLP
Senior Energy Engineer

[cid:image005.jpg at 01D35D54.1AD50340] [cid:image007.jpg at 01D35D54.1AD50340]

134 South Fitzhugh Street Rochester, NY 14608

T: (585) 698-1956 F: (585) 325-6005

bbishop at pathfinder-ea.com www.pathfinder-ea.com

[http://png-5.findicons.com/files/icons/977/rrze/720/globe.png]Carbon Fee and Dividend - simple, effective, and market-based.

Bill Bishop's picture
Offline
Joined: 2012-02-25
Reputation: 7

For everyone's benefit, I was further informed by JJH that every linefeed and carriage return counts as a character, thus the "every line counts as 2 characters" from the reference manual.

There is however normally one of each for every line, except for the last line which only has a line feed.

So technically, the check for expression length is:
C + L*2 - 1 <= 4096

where
C = # of characters (including whitespaces), and
L = number of lines in your text editor

Nailed that one to the wall!

I'm going to retract my 2nd query regarding #L vs. #LR as a non-issue, as I think this truly was an expression length problem that I accidentally hid from myself in troubleshooting the expression with a separate model.

Thanks everyone,

~Nick

[cid:image001.png at 01D35E04.D225D050]
Nick Caton, P.E., BEMP
Senior Energy Engineer
Regional Energy Engineering Manager
Energy and Sustainability Services
Schneider Electric

D 913.564.6361
M 785.410.3317
F 913.564.6380
E nicholas.caton at schneider-electric.com

15200 Santa Fe Trail Drive
Suite 204
Lenexa, KS 66219
United States

[cid:image002.png at 01D35E04.D225D050]

Nicholas.Caton at schneider-electric.com's picture
Joined: 2016-02-26
Reputation: 0

In addition to the character length of an expression, there is also a line length; i.e. # of characters per line of text. However, I forget what the exact maximum character length.

[ARCH | NEXUS]
DAVID W. GRIFFIN II
BEMP
ENERGY ANALYST
2505 E Parleys Way
Salt Lake City, UT 84109
Office 801.924.5028
archnexus.com
[Twitter][Facebook][Youtube][LinkedIn]

David Griffin II's picture
Joined: 2015-01-03
Reputation: 0