Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. CAD Modeling
  4. how to draw exponential line

how to draw exponential line

Scheduled Pinned Locked Moved CAD Modeling
2 Posts 2 Posters 367 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Farhana
    wrote on last edited by
    #1

    I have to draw a Vivaldi antenna, with a surface with exponentially tapered edge. If I have an exponential curve then I can draw a line along that curve to make the exponential edge. Can anyone suggest how to enter the equation of an exponential curve in sim4Life?

    SylvainS 1 Reply Last reply
    1
    • F Farhana

      I have to draw a Vivaldi antenna, with a surface with exponentially tapered edge. If I have an exponential curve then I can draw a line along that curve to make the exponential edge. Can anyone suggest how to enter the equation of an exponential curve in sim4Life?

      SylvainS Offline
      SylvainS Offline
      Sylvain
      ZMT
      wrote on last edited by
      #2

      Here is a piece of code that creates a coil wrapped onto a torus, using lines defined from 3D parametric equations.

      It makes use of Law(), Curve(), CreateWireBody() and SweepAlongPath() from the XCoreModeling package.

      import numpy as np
      import s4l_v1.document as document
      import s4l_v1.model as model
      import XCoreModeling 
      
      def create_toroidal_coil(R, r, m, n=1, i=1, name="Toroid"):
      	"""
      	Create a spline model object with a spiral shape.
      	The shape is defined from a 3D parametric equation.
      	"""
      
      	# equation
      	b = 2. * np.pi * float(i) / float(m)
      	
      	x_component = "({R}-{r}*cos({b} + {n}*t)) * cos(t)".format(R=str(R), r=str(r), b=str(b), n=str(n))
      	y_component = "({R}-{r}*cos({b} + {n}*t)) * sin(t)".format(R=str(R), r=str(r), b=str(b), n=str(n))
      	z_component = "{r}*sin({b}+{n}*t)".format(r=str(r), b=str(b), n=str(n))
      
      	path = XCoreModeling.Law("vec({}, {}, {})".format(x_component, y_component, z_component))
      
      	curve = XCoreModeling.Curve(path, 0.0, 2.*np.pi)
      
      	# Create a spline wire body to visualize
      	wire = XCoreModeling.CreateWireBody( curve )
      	wire.Name = name
      
      	torus_centerline  = model.CreateCircle(model.Vec3(0,0,0), model.Vec3(0,0,1), 10)
      	torus_centerline.Name = 'Centerline'
      	torus = model.CreateSolidCylinder(model.Vec3(10,0,0),model.Vec3(10,0,0), 3)
      	torus.ApplyTransform(model.Rotation(model.Vec3(1,0,0), np.pi/2))
      	XCoreModeling.SweepAlongPath(torus, torus_centerline, make_solid=True, cut_off_end=True)
      	
      	# Theoretical self-inductance:
      	area = np.pi * (r*1e-3)**2
      	L_theoretical = 4.0e-7 * np.pi * n * n * area/ (2.0* np.pi *R * 1e-3)
      	print(L_theoretical * 40)
      
      	return wire, torus
      
      
      if __name__=="__main__":
      	wire, torus = create_toroidal_coil(10,3,1, n=100)
      1 Reply Last reply
      1
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Search