I am trying to add a custom surface label to a drawing. The Label will be used to calculate an ‘LS’ value between two points on a surface. The ‘LS’ value is dependant on two pieces of input information: Surface Slope Distance, and Surface Slope (%). I am using standard surface labels {Surface Slope Distance} and {Surface Slope} in the drawings currently, and they are working fine with no problems. The problem comes when I try to create the 3rd custom label to calculate the ‘LS’ value using the values of the standard {Surface Slope Distance} and {Surface Slope} labels.
The ‘LS’ Calculation is a fairly complicated formula which varies depending on the % Surface Slope; Here is the formula for each slope range:
0.00% < Surface Slope <= 1.00% :
‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.2] *[SIN(ATAN(Surface Slope)]
1.00%< Surface Slope <= 3.00%:
‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.3] *[SIN(ATAN(Surface Slope)]
3.00%< Surface Slope <= 5.00%:
‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.4] *[SIN(ATAN(Surface Slope)]
5.00%< Surface Slope <= 9.00%:
‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.5] *[SIN(ATAN(Surface Slope)]
Surface Slope > 9.00%
‘LS’ = 10.8*[(Surface Slope Length / 22.13)^0.5] *[(SIN(ATAN(Surface Slope))/22.13]^0.6
The label that I am trying to make will show an arrow in the direction of flow (higher elevation to lower) between two points, showing:
i) Surface Slope (%)
ii) Surface Slope Length (m)
iii) Calculated ‘LS’ Value
I have created an expression in Surface Slope Labels containing the above formula using an IF statement. The formula seems to work accurately 90% of the time, but I am noticing deviation in the output when:
- the Surface Slope Length values are small (<~25m),
- the Surface Slopes are high (>~3.00%)
The strangest issue I have been having is that the label gives different output values when the arrows are drawn in opposite directions between the same two points. Ie: When drawn from point A to B the ‘LS’ Value may be 0.28, however when drawn from the same Point B to A the ‘LS’ Value is0.26. At first I thought this could have been due to the slopes being read into the formula as +’ve or –‘ve causing the errors. I changed my code to take the absolute value by using the following if statement:
SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))
However, the output is still different between the same two points in different directions.
If anyone is able to offer any suggestions at all please let me know. I have copied my code down below. Thanks very much in advance to anyone with any suggestions!
IF(0.00<{Surface Slope}<=0.01, 0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))*10.8), IF({Surface Slope}<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))*10.8),IF({Surface Slope}<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))*10.8),IF({Surface Slope}<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(IF({Surface Slope}>0,1*{Surface Slope},-1*{Surface Slope})))*10.8),IF(1.0>{Surface Slope}>0.09, ((({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(IF({Surface Slope}>0,1*{Surface Slope},-1*{Surface Slope})))/0.0896)^0.6),0)))))
Solved! Go to Solution.
Solved by Dixter. Go to Solution.
Solved by Civil3DReminders. Go to Solution.
Getting the absolute value for the slope this way seems to work correctly:
IF(0.00<ABS({Surface Slope})<=0.01,0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8), IF(ABS({Surface Slope})<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(ABS({Surface Slope})<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(ABS({Surface Slope})<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(IF(ABS({Surface Slope})>0,1*ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(1.0>ABS({Surface Slope})>0.09, ((({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(IF(ABS({Surface Slope})>0,1*ABS({Surface Slope}),-1*ABS({Surface Slope}))))/0.0896)^0.6),0)))))
Thanks for getting back to me so quickly. I am now using the ABS function, and everything is working fine.
It turns out that I didn’t need to use the ABS function in an IF statement. For example in:
SIN(ATAN((IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope})))
The ABS({Surface Slope}) will always return a value greater than zero, so the statement isn’t really needed. I found that I just needed to use SIN(ATAN(ABS({Surface Slope})) to get the same result.
I think that the error in my original code was in the beginning of each of my statements in not taking the ABS value of the Surface Slope when testing it against the 5 different ranges of potential slope values for the formula(s). i.e. IF(0.00<ABS({Surface Slope})<=0.01, ….. instead of IF(0.00<{Surface Slope}<=1.00,….
Thanks again for pointing out the ABS function and for your insight with this. I didn’t know the ABS function could be used in the Expressions tool as it wasn’t one of the functions listed on the drop-down menu along with IF, SIN, ATAN, etc.
I’ve posted the working code below that I am now using if anyone else is interested.
IF(0.00<ABS({Surface Slope})<=0.01,0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(ABS({Surface Slope})))*10.8),
IF(ABS({Surface Slope})<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(ABS({Surface Slope})))*10.8),
IF(ABS({Surface Slope})<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(ABS({Surface Slope})))*10.8),
IF(ABS({Surface Slope})<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(ABS({Surface Slope})))*10.8),
IF(1.0>ABS({Surface Slope})>0.09, (({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(ABS({Surface Slope})))/0.0896)^0.6,0)))))