- edited description
- attached Mixer_with_in-labels.ipynb
- marked as minor
- attached Ogata.png
- marked as enhancement
Summing Points
Issue #41
resolved
In some process control textbooks, the mixer symbols is used as a Summing Point. I have put an example from K. Ogata’s Modern Control Engineering book (Ogata.png).
I have edited the Mixer class in dsp.py to make possible to create these summing points. Here is the code:
class Mixer(Circle):
''' Mixer
Args:
N: text in North sector
S: text in South sector
E: text in East sector
W: text in West sector
font: Font family/name
fontsize: Point size of label font
Anchors:
* N
* S
* E
* W
* NW
* NE
* SW
* SE
'''
def __init__(self, N: str=None, E: str=None, S: str=None, W: str=None,
font: str=None, fontsize: float=10, *d, **kwargs):
super().__init__(*d, **kwargs)
rad = .5
k = rad*math.sqrt(2)/2 # Diagonal distance
self.params['lblloc'] = 'top'
self.params['lblofst'] = 0.2
self.segments.append(Segment([(rad+k, k), (rad-k, -k)]))
self.segments.append(Segment([(rad+k, -k), (rad-k, k)]))
if N:
self.segments.append(SegmentText(
(rad, rad/2+0.065), N,
font=font, fontsize=fontsize))
if S:
self.segments.append(SegmentText(
(rad, -rad/2-0.065), S,
font=font, fontsize=fontsize))
if E:
self.segments.append(SegmentText(
(rad*1.5+0.05, 0), E,
font=font, fontsize=fontsize))
if W:
self.segments.append(SegmentText(
(rad/2-0.05, 0), W,
font=font, fontsize=fontsize))
I think it doesn’t break anything.
The attached file ‘Mixer with in-labels.ipynb’ shows my recreation of the block diagram (d) of the image Ogata.png.
I would like to add a few final comments:
- Do you think it’s a good idea to change the Mixer class or would it be better to have a new class? If you think it’s not a good idea to include this in Schemdraw, it’s OK.
- I have tweaked the coordinates of the text to make the more aesthetically pleasant. I’m not sure it’s necessary.
- To improve the readability of the summing point I would like to make the width of the lines inside the circle half of the width of the line of the circle, but I don’t know how to do it.
Comments (4)
-
reporter -
repo owner Good idea. I just checked in this code to the master branch. In response to your comments:
- Changing the Mixer class is fine.. it won’t affect existing circuits if the new arguments are not provided.
- Ok. I tweaked a bit more after changing the width of the inside “X” lines (see
#3below) - I agree. You can pass “lw” parameter into the Segment class to set the line width of individual segments. This will override any linewidth the end user specifies, so use sparingly, but I think it’s fine here.
-
reporter I forgot to say thanks!
-
repo owner - changed status to resolved
- Log in to comment