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

@ -34,17 +34,17 @@ class NonUnitCapacitor(CapacitorUnit):
self.device = device self.device = device
self.capacitorType = capacitorType self.capacitorType = capacitorType
self.direction = direction self.direction = direction
self.capacitance = capacitance self.capacitance = capacitance
self.capacitorUnit = capacitorUnit self.capacitorUnit = capacitorUnit
self.abutmentBoxPosition = abutmentBoxPosition self.abutmentBoxPosition = abutmentBoxPosition
self.capUnitTopPlates_spacing = capUnitTopPlates_spacing self.capUnitTopPlates_spacing = capUnitTopPlates_spacing
self.unitCapDim = CapacitorUnit.__computeCapDim__( self, capacitorUnit, capacitorType ) self.unitCapDim = CapacitorUnit.__computeCapDim__( self, capacitorUnit, capacitorType )
if self.__isDirectionOk__(direction): 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 = {} self.dummyCapDim = {}
return return
@ -62,7 +62,7 @@ class NonUnitCapacitor(CapacitorUnit):
def setRules( self ): def setRules( self ):
CapacitorUnit.setRules(self) CapacitorUnit.setRules(self)
if self.capacitorType == 'MIMCap': if self.capacitorType == 'MIMCap':
self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_metcapdum ) self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_metcapdum )
@ -70,7 +70,7 @@ class NonUnitCapacitor(CapacitorUnit):
elif self.capacitorType == 'PIPCap': elif self.capacitorType == 'PIPCap':
self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_cpoly ) self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_cpoly )
return return
@ -78,37 +78,36 @@ class NonUnitCapacitor(CapacitorUnit):
UpdateSession.open() UpdateSession.open()
self.setRules() self.setRules()
self.computeDimensions() self.computeDimensions()
if self.__isCapacitorOk__() : if self.__isCapacitorOk__() :
print('drawing capacitor') print('drawing capacitor')
activeCapacitor = CapacitorUnit ( self.device, self.capacitorType, self.abutmentBoxPosition, capDim = self.nonUnitCapDim ) activeCapacitor = CapacitorUnit ( self.device, self.capacitorType, self.abutmentBoxPosition, capDim = self.nonUnitCapDim )
activeCapacitor.create( b, t ) activeCapacitor.create( b, t )
side = "height" if self.direction == "vertical" else "width" 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") 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] ]
# 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] ]
dummyCapacitor = CapacitorUnit( self.device, self.capacitorType, dummyAbutmentBoxPosition, capDim = self.dummyCapDim ) dummyCapacitor = CapacitorUnit( self.device, self.capacitorType, dummyAbutmentBoxPosition, capDim = self.dummyCapDim )
# activeCapacitor.create( b, t ) # activeCapacitor.create( b, t )
dummyCapacitor.create ( b, t ) dummyCapacitor.create ( b, t )
else : print("not drawing dummy") else : print("not drawing dummy")
# abutmentBoxDimensions = self.computeAbutmentBoxDimensions(capDim) # abutmentBoxDimensions = self.computeAbutmentBoxDimensions(capDim)
# CapacitorUnit.drawAbutmentBox( self ) # CapacitorUnit.drawAbutmentBox( self )
else : raise Error(1,'create() : Impossible to draw capacitor in the defined geometric limits.') else : raise Error(1,'create() : Impossible to draw capacitor in the defined geometric limits.')
UpdateSession.close() UpdateSession.close()
return return
@ -121,30 +120,30 @@ class NonUnitCapacitor(CapacitorUnit):
def __isCapacitorOk__( self ): def __isCapacitorOk__( self ):
capacitorMax = self.computeCapacitorMax() capacitorMax = self.computeCapacitorMax()
print("CMax",capacitorMax) print("CMax",capacitorMax)
print("self.capacitance",self.capacitance) print("self.capacitance",self.capacitance)
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing)) 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 ): def computeDimensions( self ):
if self.capUnitTopPlates_spacing == -1 : if self.capUnitTopPlates_spacing == -1 :
CapacitorUnit.computeAbutmentBoxDimensions(self, self.unitCapDim ) CapacitorUnit.computeAbutmentBoxDimensions(self, self.unitCapDim )
self.capUnitTopPlates_spacing = 2*(self.minSpacing_botPlate + self.enclosure_botPlate_topPlate) 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": if self.direction == "vertical":
self.nonUnitCapDim["height"] = self.computeNonUnitCapheight() self.nonUnitCapDim["height"] = self.computeNonUnitCapheight()
else : self.nonUnitCapDim["width"] = 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.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))
print('self.nonUnitCapDim["width"]',toPhy(self.nonUnitCapDim["width"])) print('self.nonUnitCapDim["width"]',toPhy(self.nonUnitCapDim["width"]))
print('self.nonUnitCapDim["height"]',toPhy(self.nonUnitCapDim["height"])) print('self.nonUnitCapDim["height"]',toPhy(self.nonUnitCapDim["height"]))
@ -156,32 +155,32 @@ class NonUnitCapacitor(CapacitorUnit):
print("self.dummyCapDim",toPhy(self.dummyCapDim["width" ])) print("self.dummyCapDim",toPhy(self.dummyCapDim["width" ]))
print("self.dummyCapDim",toPhy(self.dummyCapDim["height" ])) print("self.dummyCapDim",toPhy(self.dummyCapDim["height" ]))
return return
def computeCapacitorMax( self ): def computeCapacitorMax( self ):
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType) [ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
capUnit_width = toPhy( self.unitCapDim["width"] ) capUnit_width = toPhy( self.unitCapDim["width"] )
topPlates_spacing = toPhy( self.capUnitTopPlates_spacing ) topPlates_spacing = toPhy( self.capUnitTopPlates_spacing )
print("[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]",[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]) print("[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]",[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ])
print("width",capUnit_width) print("width",capUnit_width)
CMax = ( 2*capUnit_width + topPlates_spacing )*capUnit_width*areaCapacitorPerUnit + ( 3*capUnit_width + topPlates_spacing )*perimeterCapacitorPerUnit CMax = ( 2*capUnit_width + topPlates_spacing )*capUnit_width*areaCapacitorPerUnit + ( 3*capUnit_width + topPlates_spacing )*perimeterCapacitorPerUnit
return CMax return CMax
def computeNonUnitCapheight( self ): def computeNonUnitCapheight( self ):
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType) [ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
width = toPhy( self.unitCapDim["width"] ) width = toPhy( self.unitCapDim["width"] )
height = self.capacitance/( (width*areaCapacitorPerUnit + perimeterCapacitorPerUnit) + width*perimeterCapacitorPerUnit ) height = self.capacitance/( (width*areaCapacitorPerUnit + perimeterCapacitorPerUnit) + width*perimeterCapacitorPerUnit )
print("height",height) print("height",height)
return toDbU(height) return toDbU(height)