Power Line Cable Sag

Power Line Cable Sag

goswami5chirag
Participant Participant
5,952 Views
40 Replies
Message 1 of 41

Power Line Cable Sag

goswami5chirag
Participant
Participant

Does anyone know about any function that can draw profile sag of Power Line Cable sag (Catenary) ?

Here is Picture for your reference for the kind of thing i wanted

Screenshot (28).png

0 Likes
Accepted solutions (1)
5,953 Views
40 Replies
Replies (40)
Message 2 of 41

_gile
Consultant
Consultant

What's wrong with the _CATENARY command from CustomCurves plugin?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 41

goswami5chirag
Participant
Participant

I want a programme that can draw a catenary curve excatly to the parameter of a cable with particular unit weight and tension to it

0 Likes
Message 4 of 41

goswami5chirag
Participant
Participant

On which unit does that tension and Unit weight of conductor works

0 Likes
Message 5 of 41

goswami5chirag
Participant
Participant

I want tension in N, and unit weight in KG

0 Likes
Message 6 of 41

_gile
Consultant
Consultant

OK.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 7 of 41

_gile
Consultant
Consultant

You can try this:

 

 

;; Draws a spline figuring a catenary
;;
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; n   : number of fit points
;; th  : horizontal tension (N)
;; w   : unit weight (kg)
(defun drawCatenary (pt1 pt2 n th w / cosh sinh asinh fitPoints)

  ;; Returns the hyperbolic cosine
  (defun cosh (x)
    (/ (+ (exp x) (exp (- x))) 2.)
  )

  ;; Returns the hyperbolic sine
  (defun sinh (x)
    (/ (- (exp x) (exp (- x))) 2.)
  )

  ;; Returns the inverse hyperbolic sine
  (defun asinh (x)
    (log (+ x (sqrt (+ (* x x) 1.))))
  )

  ;; Computes the n fit points of the spline figuring the catenary between pt1 and pt2
  ;; with a = Th / (µ * 9.81)
  (defun fitPoints (pt1 pt2 n a / lg ht stp alpha beta gamma d1 d2 x)
    (setq x	(car pt1)
	  lg	(- (car pt2) x)
	  ht	(- (cadr pt1) (cadr pt2))
	  stp	(/ lg (- n 1))
	  alpha	(/ ht (* 2. a (sinh (/ lg (* 2. a)))))
	  beta	(+ (/ lg 2.) (* a (asinh alpha)))
	  gamma	(* a (- (cosh (/ beta a)) 1.))
	  d1	(+ x beta)
	  d2	(- (cadr pt1) gamma)
	  pts	(list pt1)
    )
    (repeat (- n 2)
      (setq pts	(cons
		  (list	(setq x (+ x stp))
			(+ (* a (- (cosh (/ (- x d1) a)) 1.)) d2)
			0.
		  )
		  pts
		)
      )
    )
    (reverse (cons pt2 pts))
  )

  (entmakex
    (append
      (list '(0 . "SPLINE")
	    '(100 . "AcDbEntity")
	    '(100 . "AcDbSpline")
	    (cons 70 8)
	    (cons 71 3)
	    (cons 74 (length lst-pts))
      )
      (mapcar '(lambda (x) (cons 11 x))
	      (fitPoints pt1 pt2 n (/ th (* w 9.81)))
      )
    )
  )
)

(defun c:CATENARY (/ pt1 pt2 th w n)
  (and
    (setq pt1 (getpoint "\nStart point: "))
    (setq pt2 (getpoint pt1 "\nEnd point: "))
    (setq th (getreal "\nHorizontal tension (Newtons): "))
    (setq w (getreal "\nUnit weight (Kilograms): "))
    (setq n 9) ;_ number of fit points
    (drawCatenary pt1 pt2 n th w)
  )
  (princ)
)

 

 

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 8 of 41

goswami5chirag
Participant
Participant

Command for activating this ?

0 Likes
Message 9 of 41

goswami5chirag
Participant
Participant

it does not seems to  matching at my defult values, maybe the scale is different. i want function in 1:2000 horizontal scale and 1:200 vertical scale

0 Likes
Message 10 of 41

goswami5chirag
Participant
Participant

 what is the difference between Horizontal Tension and Tension of Conductor on particular Temperature ?

My default values are as follows :

Unit Weight of Conductor : 2.004 Kg/m
Tension: 3024 Kgs (At 85d , No wind )

Scale: Horizontal - 1:2000

            Vertical - 1:200

 

 

0 Likes
Message 11 of 41

goswami5chirag
Participant
Participant

The green one is my defult curve for 

Unit Weight - 2.004 kg/m

Tension  - 3024 Kgs 

Scale -  1:2000(Horizontal)

              1:200 (Vertical)

your function does not seem to match ( dont know the reason) .

 

Screenshot (29).png

0 Likes
Message 12 of 41

_gile
Consultant
Consultant

I'm sorry but it's very difficult for me to understand what you want.

You were talking about Tension in Newtons in  a previous reply, now you give: "Tension - 3024 Kgs".
The formula the LISP uses is based on Horizontal tension, are we talking about the same thing ?

In the upper picture, the dimensions are unreadable, so this it is useless.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 13 of 41

goswami5chirag
Participant
Participant

Sorry for that,

The below mentioned data is my default data, and by using same data in your "Catenary" function the difference in result is shown in below Picture.Screenshot (31).png

Unit Weight - 2.004 kg/m

Tension  - 3024 Kgs 

Scale -  1:2000(Horizontal)

              1:200 (Vertical)

For your reference the Red Curve is the actual Template i am having.

and the yellow line is the one i get after using "Catenary " Lisp that you provide

0 Likes
Message 14 of 41

_gile
Consultant
Consultant

Sorry, it's still not clear, the code I provided needs a value in Newtons for the horizontal tension.

And please attach a relevant sample drawing instead of pictures.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 15 of 41

goswami5chirag
Participant
Participant

Here is a sample file for your reference, and template for matching the curve

0 Likes
Message 16 of 41

_gile
Consultant
Consultant

The following code should reply to your request.

The generated curve is slightly different from the template one because the template one seems to be a parabola instead of a catenary curve.

The user is prompted to specify the start and end points, the tension, the unit weight and the vertical exaggeration (Y scale / X scale). The previously entered values are purposed as default values (just click Enter to accept).

 

;; Draws a spline figuring a catenary
;;
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; n   : number of fit points
;; th  : horizontal tension
;; w   : unit weight
;; k   : vertical exaggeration (Y scale / X scale)
(defun drawCatenary (pt1 pt2 n th w k / cosh sinh asinh fitPoints)

  ;; Returns the hyperbolic cosine
  (defun cosh (x)
    (/ (+ (exp x) (exp (- x))) 2.)
  )

  ;; Returns the hyperbolic sine
  (defun sinh (x)
    (/ (- (exp x) (exp (- x))) 2.)
  )

  ;; Returns the inverse hyperbolic sine
  (defun asinh (x)
    (log (+ x (sqrt (+ (* x x) 1.))))
  )

  ;; Computes the n fit points of the spline figuring the catenary between pt1 and pt2
  ;; with a = Th / w
  (defun fitPoints (pt1 pt2 n a k / lg ht stp alpha beta gamma d1 d2 x)
    (setq x	(car pt1)
	  lg	(- (car pt2) x)
	  ht	(/ (- (cadr pt1) (cadr pt2)) k)
	  stp	(/ lg (- n 1))
	  alpha	(/ ht (* 2. a (sinh (/ lg (* 2. a)))))
	  beta	(+ (/ lg 2.) (* a (asinh alpha)))
	  gamma	(* a (- (cosh (/ beta a)) 1.))
	  d1	(+ x beta)
	  d2	(- (cadr pt1) (* k gamma))
	  pts	(list pt1)
    )
    (repeat (- n 2)
      (setq pts	(cons
		  (list	(setq x (+ x stp))
			(+ (* k a (- (cosh (/ (- x d1) a)) 1.)) d2)
			0.
		  )
		  pts
		)
      )
    )
    (reverse (cons pt2 pts))
  )

  (entmakex
    (append
      (list '(0 . "SPLINE")
	    '(100 . "AcDbEntity")
	    '(100 . "AcDbSpline")
	    (cons 70 8)
	    (cons 71 3)
	    (cons 74 (length lst-pts))
      )
      (mapcar '(lambda (x) (cons 11 x))
	      (fitPoints pt1 pt2 n (/ th w) k)
      )
    )
  )
)

;; default values
(setq *tension* 3024.)
(setq *unitWeight* 2.004)
(setq *exaggeration* 10.)
(setq *numFitPoints* 17)

;; Command CATENARY
(defun c:CATENARY (/ pt1 pt2 th w n k)
  (if
    (and
      (setq pt1 (getpoint "\nStart point: "))
      (setq pt2 (getpoint pt1 "\nEnd point: "))
    )
     (progn
       (if (setq th (getreal
		      (strcat
			"\nHorizontal tension <"
			(rtos *tension*)
			">: "
		      )
		    )
	   )
	 (setq *tension* th)
	 (setq th *tension*)
       )
       (if (setq w (getreal
		     (strcat
		       "\nUnit weight <"
		       (rtos *unitWeight*)
		       ">: "
		     )
		   )
	   )
	 (setq *unitWeight* w)
	 (setq w *unitWeight*)
       )
       (if (setq k (getreal
		     (strcat "\nVertical exaggeration <"
			     (rtos *exaggeration*)
			     ">: "
		     )
		   )
	   )
	 (setq *exaggeration* k)
	 (setq k *exaggeration*)
       )
       (drawCatenary (trans pt1 1 0) (trans pt2 1 0) *numFitPoints* th w k)
     )
  )
  (princ)
)

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 17 of 41

goswami5chirag
Participant
Participant

The results were very good , just want one more thing to this function which is if i can do this with multiple points at the same time ,it would be really appreciated.

0 Likes
Message 18 of 41

_gile
Consultant
Consultant
Accepted solution
;; Draws a spline figuring a catenary
;;
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; n   : number of fit points
;; th  : horizontal tension
;; w   : unit weight
;; k   : vertical exaggeration (Y scale / X scale)
(defun drawCatenary (pt1 pt2 n th w k / cosh sinh asinh fitPoints)

  ;; Returns the hyperbolic cosine
  (defun cosh (x)
    (/ (+ (exp x) (exp (- x))) 2.)
  )

  ;; Returns the hyperbolic sine
  (defun sinh (x)
    (/ (- (exp x) (exp (- x))) 2.)
  )

  ;; Returns the inverse hyperbolic sine
  (defun asinh (x)
    (log (+ x (sqrt (+ (* x x) 1.))))
  )

  ;; Computes the n fit points of the spline figuring the catenary between pt1 and pt2
  ;; with a = Th / w
  (defun fitPoints (pt1 pt2 n a k / lg ht stp alpha beta gamma d1 d2 x)
    (setq x	(car pt1)
	  lg	(- (car pt2) x)
	  ht	(/ (- (cadr pt1) (cadr pt2)) k)
	  stp	(/ lg (- n 1))
	  alpha	(/ ht (* 2. a (sinh (/ lg (* 2. a)))))
	  beta	(+ (/ lg 2.) (* a (asinh alpha)))
	  gamma	(* a (- (cosh (/ beta a)) 1.))
	  d1	(+ x beta)
	  d2	(- (cadr pt1) (* k gamma))
	  pts	(list pt1)
    )
    (repeat (- n 2)
      (setq pts	(cons
		  (list	(setq x (+ x stp))
			(+ (* k a (- (cosh (/ (- x d1) a)) 1.)) d2)
			0.
		  )
		  pts
		)
      )
    )
    (reverse (cons pt2 pts))
  )

  (entmakex
    (append
      (list '(0 . "SPLINE")
	    '(100 . "AcDbEntity")
	    '(100 . "AcDbSpline")
	    (cons 70 8)
	    (cons 71 3)
	    (cons 74 (length lst-pts))
      )
      (mapcar '(lambda (x) (cons 11 x))
	      (fitPoints pt1 pt2 n (/ th w) k)
      )
    )
  )
)

;; default values
(setq *tension* 3024.)
(setq *unitWeight* 2.004)
(setq *exaggeration* 10.)
(setq *numFitPoints* 17)

;; Command CATENARY
(defun c:CATENARY (/ pt1 pt2 th w n k)
  
       (if (setq th (getreal
		      (strcat
			"\nHorizontal tension <"
			(rtos *tension*)
			">: "
		      )
		    )
	   )
	 (setq *tension* th)
	 (setq th *tension*)
       )
       (if (setq w (getreal
		     (strcat
		       "\nUnit weight <"
		       (rtos *unitWeight*)
		       ">: "
		     )
		   )
	   )
	 (setq *unitWeight* w)
	 (setq w *unitWeight*)
       )
       (if (setq k (getreal
		     (strcat "\nVertical exaggeration <"
			     (rtos *exaggeration*)
			     ">: "
		     )
		   )
	   )
	 (setq *exaggeration* k)
	 (setq k *exaggeration*)
       )
  (if (setq pt1 (getpoint "\nStart point: "))
    (while (setq pt2 (getpoint pt1 "\nNext point (or Enter to quit): "))
      (drawCatenary
	(trans pt1 1 0)
	(trans pt2 1 0)
	*numFitPoints*
	th
	w
	k
      )
      (setq pt1 pt2)
    )
  )
  (princ)
)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 19 of 41

goswami5chirag
Participant
Participant

this is exactly what i want, thank you so much ,really appreciated your work.

0 Likes
Message 20 of 41

_gile
Consultant
Consultant

With a more friendly user interface.

;; Draws a spline figuring a catenary curve
;;
;; Arguments
;; pt1 : start point
;; pt2 : end point
;; H   : horizontal tension
;; w   : unit weight
;; k   : vertical exaggeration (Y scale / X scale)
;; n   : number of fit points
(defun drawCatenary (pt1 pt2 H w k n / cosh sinh asinh fitPoints)

  ;; Returns the hyperbolic cosine
  (defun cosh (x)
    (/ (+ (exp x) (exp (- x))) 2.)
  )

  ;; Returns the hyperbolic sine
  (defun sinh (x)
    (/ (- (exp x) (exp (- x))) 2.)
  )

  ;; Returns the inverse hyperbolic sine
  (defun asinh (x)
    (log (+ x (sqrt (+ (* x x) 1.))))
  )

  ;; Computes the n fit points of the spline figuring the catenary between pt1 and pt2
  ;; with a = H / w
  (defun fitPoints (pt1 pt2 n a k / lg ht stp alpha beta gamma d1 d2 x)
    (setq x	(car pt1)
	  lg	(- (car pt2) x)
	  ht	(/ (- (cadr pt1) (cadr pt2)) k)
	  stp	(/ lg (- n 1))
	  alpha	(/ ht (* 2. a (sinh (/ lg (* 2. a)))))
	  beta	(+ (/ lg 2.) (* a (asinh alpha)))
	  gamma	(* a (- (cosh (/ beta a)) 1.))
	  d1	(+ x beta)
	  d2	(- (cadr pt1) (* k gamma))
	  pts	(list pt1)
    )
    (repeat (- n 2)
      (setq pts	(cons
		  (list	(setq x (+ x stp))
			(+ (* k a (- (cosh (/ (- x d1) a)) 1.)) d2)
			0.
		  )
		  pts
		)
      )
    )
    (reverse (cons pt2 pts))
  )

  (entmakex
    (append
      (list '(0 . "SPLINE")
	    '(100 . "AcDbEntity")
	    '(100 . "AcDbSpline")
	    (cons 70 8)
	    (cons 71 3)
	    (cons 74 (length lst-pts))
      )
      (mapcar '(lambda (x) (cons 11 x))
	      (fitPoints pt1 pt2 n (/ H w) k)
      )
    )
  )
)

;; Catenary settings dialog box
(defun catenarySettings (H w k n / temp file dcl_id status lst)
  (setq	temp (vl-filename-mktemp "Tmp.dcl")
	file (open temp "w")
  )
  (write-line
    "Catenary: dialog {
      label = \"Catenary Settings\";
      : edit_box {
        key = \"tension\";
        edit_width=12;
        label = \"Horizontal Tension: \";
        allow_accept = true;
      }
      : edit_box {
        key = \"weight\";
        edit_width=12;
        label = \"Unit Weight: \";
        allow_accept = true;
      }
      : edit_box {
        key = \"exaggeration\";
        edit_width=12;
        label = \"Vertical Exaggeration: \";
        allow_accept = true;
      }
      : edit_box {
        key = \"points\";
        edit_width=12;
        label = \"Number of Fit Points: \";
        allow_accept = true;
      }
      spacer;
      ok_cancel;
    }"
    file
  )
  (close file)
  (setq dcl_id (load_dialog temp))
  (if (not (new_dialog "Catenary" dcl_id))
    (exit)
  )
  (set_tile "tension" (rtos H))
  (set_tile "weight" (rtos w))
  (set_tile "exaggeration" (rtos k))
  (set_tile "points" (itoa n))
  (action_tile
    "accept"
    (vl-prin1-to-string
      (quote
	(if (<= (distof (get_tile "tension")) 0.)
	  (progn
	    (alert "Needs a strictly positive real number.")
	    (mode_tile "tension" 2)
	  )
	  (if (<= (distof (get_tile "weight")) 0.)
	    (progn
	      (alert "Needs a strictly positive real number.")
	      (mode_tile "weight" 2)
	    )
	    (if	(<= (distof (get_tile "exaggeration")) 0.)
	      (progn
		(alert "Needs a strictly positive real number.")
		(mode_tile "exaggeration" 2)
	      )
	      (if (<= (atoi (get_tile "points")) 6)
		(progn
		  (alert "Needs an integer greater than or equal to 7.")
		  (mode_tile "points" 2)
		)
		(progn
		  (setq	lst (list
			      (distof (get_tile "tension"))
			      (distof (get_tile "weight"))
			      (distof (get_tile "exaggeration"))
			      (atoi (get_tile "points"))
			    )
		  )
		  (done_dialog)
		)
	      )
	    )
	  )
	)
      )
    )
  )
  (setq status (start_dialog))
  (unload_dialog dcl_id)
  (vl-file-delete temp)
  lst
)

;; Command
(defun c:CATENARY (/ pt1 pt2 H w k n)
  (mapcar '(lambda (sym key val)
	     (set sym
		  (cond
		    ((vlax-ldata-get "catenary" key))
		    ((vlax-ldata-put "catenary" key val))
		  )
	     )
	   )
	  '(H w k n)
	  '("tension" "weight" "exaggeration" "numPts")
	  '(3000.0 2.0 1.0 17)
  )
  (while
    (not
      (or
	(initget "Settings")
	(vl-consp (setq	pt1
			 (getpoint
			   (strcat
			     "\nCurrent settings: Horizontal Tension = "
			     (rtos H)
			     " - Unit Weight = "
			     (rtos w)
			     " - Vertical Exaggeration = "
			     (rtos k)
			     " - Number of Fit Points = "
			     (itoa n)
			     "\nStart point or [Settings] <S>: "
			   )
			 )
		  )
	)
      )
    )
     (if (setq lst (catenarySettings H w k n))
       (mapcar '(lambda	(sym key val)
		  (set sym (vlax-ldata-put "catenary" key val))
		)
	       '(H w k n)
	       '("tension" "weight" "exaggeration" "numPts")
	       lst
       )
     )
  )
  (while
    (setq pt2 (getpoint pt1 "\nNext point (or Enter to quit): "))
     (drawCatenary (trans pt1 1 0) (trans (setq pt1 pt2) 1 0) H w k n)
  )
  (princ)
)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub