Fix whitespace in orashi nonunitcapacitor

This commit is contained in:
Rob Taylor 2023-10-09 16:50:55 +01:00 committed by Rob Taylor
parent c9fe5713cf
commit 5c2203b0f3
1 changed files with 61 additions and 62 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python
import sys
import sys
from math import sqrt, ceil
from ..Hurricane import *
from ..CRL import *
@ -34,17 +34,17 @@ class NonUnitCapacitor(CapacitorUnit):
self.device = device
self.capacitorType = capacitorType
self.direction = direction
self.capacitance = capacitance
self.capacitorUnit = capacitorUnit
self.abutmentBoxPosition = abutmentBoxPosition
self.capUnitTopPlates_spacing = capUnitTopPlates_spacing
self.capacitance = capacitance
self.capacitorUnit = capacitorUnit
self.abutmentBoxPosition = abutmentBoxPosition
self.capUnitTopPlates_spacing = capUnitTopPlates_spacing
self.unitCapDim = CapacitorUnit.__computeCapDim__( self, capacitorUnit, capacitorType )
self.unitCapDim = CapacitorUnit.__computeCapDim__( self, capacitorUnit, capacitorType )
if self.__isDirectionOk__(direction):
self.nonUnitCapDim = {"width" : self.unitCapDim["width"] , "height" : 0 } if direction == "vertical" else {"width" : 0 , "height" : self.unitCapDim["width"] }
self.nonUnitCapDim = {"width" : self.unitCapDim["width"] , "height" : 0 } if direction == "vertical" else {"width" : 0 , "height" : self.unitCapDim["width"] }
self.nonUnitCapDim_sideLimit = 0
self.nonUnitCapDim_sideLimit = 0
self.dummyCapDim = {}
return
@ -62,7 +62,7 @@ class NonUnitCapacitor(CapacitorUnit):
def setRules( self ):
CapacitorUnit.setRules(self)
CapacitorUnit.setRules(self)
if self.capacitorType == 'MIMCap':
self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_metcapdum )
@ -70,45 +70,44 @@ class NonUnitCapacitor(CapacitorUnit):
elif self.capacitorType == 'PIPCap':
self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_cpoly )
return
return
def create( self, b, t ) :
UpdateSession.open()
UpdateSession.open()
self.setRules()
self.computeDimensions()
self.setRules()
self.computeDimensions()
if self.__isCapacitorOk__() :
if self.__isCapacitorOk__() :
print('drawing capacitor')
activeCapacitor = CapacitorUnit ( self.device, self.capacitorType, self.abutmentBoxPosition, capDim = self.nonUnitCapDim )
activeCapacitor.create( b, t )
print('drawing capacitor')
activeCapacitor = CapacitorUnit ( self.device, self.capacitorType, self.abutmentBoxPosition, capDim = self.nonUnitCapDim )
activeCapacitor.create( b, t )
side = "height" if self.direction == "vertical" else "width"
if self.__isNonUnitCapSideOk__( side ) :
if self.__isNonUnitCapSideOk__( side ):
print("drawing dummy too")
# activeCapacitor = CapacitorUnit ( self.device, activeCapacitance, self.capacitorType, self.abutmentBoxPosition )
print("drawing dummy too")
# activeCapacitor = CapacitorUnit ( self.device, activeCapacitance, self.capacitorType, self.abutmentBoxPosition )
dummyAbutmentBoxPosition = [ self.abutmentBoxPosition[0], self.abutmentBoxPosition[1] - CapacitorUnit.computeAbutmentBoxDimensions( self, self.dummyCapDim )["height"] ] if self.direction == "vertical" else [ self.abutmentBoxPosition[0] + CapacitorUnit.computeAbutmentBoxDimensions( self, self.nonUnitCapDim )["width"] , self.abutmentBoxPosition[1] ]
dummyAbutmentBoxPosition = [ self.abutmentBoxPosition[0], self.abutmentBoxPosition[1] - CapacitorUnit.computeAbutmentBoxDimensions( self, self.dummyCapDim )["height"] ] if self.direction == "vertical" else [ self.abutmentBoxPosition[0] + CapacitorUnit.computeAbutmentBoxDimensions( self, self.nonUnitCapDim )["width"] , self.abutmentBoxPosition[1] ]
dummyCapacitor = CapacitorUnit( self.device, self.capacitorType, dummyAbutmentBoxPosition, capDim = self.dummyCapDim )
# activeCapacitor.create( b, t )
dummyCapacitor.create ( b, t )
dummyCapacitor = CapacitorUnit( self.device, self.capacitorType, dummyAbutmentBoxPosition, capDim = self.dummyCapDim )
# activeCapacitor.create( b, t )
dummyCapacitor.create ( b, t )
else : print("not drawing dummy")
# abutmentBoxDimensions = self.computeAbutmentBoxDimensions(capDim)
# CapacitorUnit.drawAbutmentBox( self )
else : raise Error(1,'create() : Impossible to draw capacitor in the defined geometric limits.')
# abutmentBoxDimensions = self.computeAbutmentBoxDimensions(capDim)
# CapacitorUnit.drawAbutmentBox( self )
else : raise Error(1,'create() : Impossible to draw capacitor in the defined geometric limits.')
UpdateSession.close()
return
return
@ -121,30 +120,30 @@ class NonUnitCapacitor(CapacitorUnit):
def __isCapacitorOk__( self ):
capacitorMax = self.computeCapacitorMax()
capacitorMax = self.computeCapacitorMax()
print("CMax",capacitorMax)
print("self.capacitance",self.capacitance)
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))
print("CMax",capacitorMax)
print("self.capacitance",self.capacitance)
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))
return True if self.capacitance < capacitorMax else False
return True if self.capacitance < capacitorMax else False
def computeDimensions( self ):
if self.capUnitTopPlates_spacing == -1 :
CapacitorUnit.computeAbutmentBoxDimensions(self, self.unitCapDim )
self.capUnitTopPlates_spacing = 2*(self.minSpacing_botPlate + self.enclosure_botPlate_topPlate)
if self.capUnitTopPlates_spacing == -1 :
CapacitorUnit.computeAbutmentBoxDimensions(self, self.unitCapDim )
self.capUnitTopPlates_spacing = 2*(self.minSpacing_botPlate + self.enclosure_botPlate_topPlate)
self.nonUnitCapDim_sideLimit = 2*self.unitCapDim["width"] - self.minWidth_dummyTopPlate
self.nonUnitCapDim_sideLimit = 2*self.unitCapDim["width"] - self.minWidth_dummyTopPlate
if self.direction == "vertical":
self.nonUnitCapDim["height"] = self.computeNonUnitCapheight()
self.nonUnitCapDim["height"] = self.computeNonUnitCapheight()
else : self.nonUnitCapDim["width"] = self.computeNonUnitCapheight()
print("sideLimit",toPhy(self.nonUnitCapDim_sideLimit))
print("sideLimit",toPhy(self.nonUnitCapDim_sideLimit))
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))
print('self.nonUnitCapDim["width"]',toPhy(self.nonUnitCapDim["width"]))
print('self.nonUnitCapDim["height"]',toPhy(self.nonUnitCapDim["height"]))
@ -156,36 +155,36 @@ class NonUnitCapacitor(CapacitorUnit):
print("self.dummyCapDim",toPhy(self.dummyCapDim["width" ]))
print("self.dummyCapDim",toPhy(self.dummyCapDim["height" ]))
return
return
def computeCapacitorMax( self ):
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
capUnit_width = toPhy( self.unitCapDim["width"] )
topPlates_spacing = toPhy( self.capUnitTopPlates_spacing )
print("[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]",[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ])
print("width",capUnit_width)
CMax = ( 2*capUnit_width + topPlates_spacing )*capUnit_width*areaCapacitorPerUnit + ( 3*capUnit_width + topPlates_spacing )*perimeterCapacitorPerUnit
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
capUnit_width = toPhy( self.unitCapDim["width"] )
topPlates_spacing = toPhy( self.capUnitTopPlates_spacing )
print("[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]",[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ])
print("width",capUnit_width)
CMax = ( 2*capUnit_width + topPlates_spacing )*capUnit_width*areaCapacitorPerUnit + ( 3*capUnit_width + topPlates_spacing )*perimeterCapacitorPerUnit
return CMax
return CMax
def computeNonUnitCapheight( self ):
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
width = toPhy( self.unitCapDim["width"] )
height = self.capacitance/( (width*areaCapacitorPerUnit + perimeterCapacitorPerUnit) + width*perimeterCapacitorPerUnit )
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
width = toPhy( self.unitCapDim["width"] )
height = self.capacitance/( (width*areaCapacitorPerUnit + perimeterCapacitorPerUnit) + width*perimeterCapacitorPerUnit )
print("height",height)
return toDbU(height)
print("height",height)
return toDbU(height)
def __isNonUnitCapSideOk__( self, side ):
def __isNonUnitCapSideOk__( self, side ):
if side in ["width","height"]:
state = True if self.nonUnitCapDim[side] < self.nonUnitCapDim_sideLimit else False
@ -230,24 +229,24 @@ def scriptMain( **kw ):
device.setTerminal( True )
bottomPlate_net = Net.create( device, 'b' )
bottomPlate_net.setExternal( True )
bottomPlate_net.setExternal( True )
b = device.getNet("b")
doBreak( 1, 'Done building bottomPlate')
topPlate_net = Net.create( device, 't' )
topPlate_net.setExternal( True )
topPlate_net.setExternal( True )
t = device.getNet("t")
doBreak( 1, 'Done building tNet')
if editor:
UpdateSession.close( )
editor.setCell ( device )
editor.fit ( )
UpdateSession.open ( )
editor.setCell ( device )
editor.fit ( )
UpdateSession.open ( )
nonUnitCapacitor = NonUnitCapacitor ( device, 'PIPCap', 'horizontal', 65, 50, [0,0] )
nonUnitCapacitor.create(b,t)
nonUnitCapacitor.create(b,t)
AllianceFramework.get().saveCell( device, Catalog.State.Views )
return True