57 const std::vector<NET_HANDLE> startNets =
CurrentNets();
59 if( startNets.empty() )
63 NET_HANDLE second = startNets.size() >= 2 ? startNets[1] : startNets[0];
65 long long extraLen = 0;
66 long long extraDelay = 0;
68 if(
Router()->GetInterface()->GetSignalAggregate( first, second, extraLen, extraDelay ) )
85 long long tunedNetBoardLen = 0;
139 if( minAmp == maxAmp )
148 if( minLen > targetLength )
151 if( maxLen < targetLength )
154 int minError = minLen - targetLength;
155 int maxError = maxLen - targetLength;
190 if( initialGuess >= minAmp && initialGuess <= maxAmp )
192 copy.Resize( minAmp );
205 long long int maxElongation = 0;
206 long long int minElongation = 0;
207 bool finished =
false;
221 end.SetType( endType );
224 long long int maxEndElongation =
end.CurrentLength() -
end.BaselineLength();
226 if( maxElongation + maxEndElongation > aElongation )
230 m->SetType( endType );
236 long long int endMinElongation =
237 ( m->MinTunableLength() - m->BaselineLength() );
239 if( minElongation + endMinElongation >= aElongation )
251 maxElongation += m->CurrentLength() - m->BaselineLength();
252 minElongation += m->MinTunableLength() - m->BaselineLength();
256 long long int remainingElongation = aElongation;
257 int meanderCount = 0;
263 remainingElongation -= m->CurrentLength() - m->BaselineLength();
268 long long int lenReductionLeft = -remainingElongation;
269 int meandersLeft = meanderCount;
271 if( lenReductionLeft < 0 || !meandersLeft )
278 long long int lenReductionHere = lenReductionLeft / meandersLeft;
279 long long int initialLen = m->CurrentLength();
280 int minAmpl = m->MinAmplitude();
288 m->SetTargetBaselineLength( m->BaselineLength() );
291 lenReductionLeft -= initialLen - m->CurrentLength();
311 return static_cast<SEGMENT*
>( aStartItem )->Seg().NearestPoint( aStartPoint );
316 ARC* arc =
static_cast<ARC*
>( aStartItem );
318 if( (
VECTOR2I( arc->
Anchor( 0 ) - aStartPoint ) ).SquaredEuclideanNorm() <=
319 (
VECTOR2I( arc->
Anchor( 1 ) - aStartPoint ) ).SquaredEuclideanNorm() )
ROUTER * Router() const
Return current router settings.
virtual VECTOR2I Anchor(int n) const override
const std::vector< ITEM * > & CItems() const
Base class for PNS router board items.
PnsKind Kind() const
Return the type (kind) of the item.
Represent a set of meanders fitted over a single or two lines.
std::vector< MEANDER_SHAPE * > & Meanders()
long long int chainNarrowingOffset() const
Return the length offset to subtract when converting a user-facing total signal length target into a ...
virtual void UpdateSettings(const MEANDER_SETTINGS &aSettings)
void tuneLineLength(MEANDERED_LINE &aTuned, long long int aElongation)
Take a set of meanders in aTuned and tunes their length to extend the original line length by aElonga...
virtual void SpacingStep(int aSign)
Increase/decrease the current meandering spacing by one step.
int m_currentWidth
Meander settings.
bool m_chainExtrasValid
Pointer to world to search colliding items.
MEANDER_PLACER_BASE(ROUTER *aRouter)
long long int m_chainExtrasDelay
void initChainExtras()
Cache the per-session chain-extras length/delay (other nets in the same chain) so per-Move use does n...
virtual ~MEANDER_PLACER_BASE()
MEANDER_SETTINGS m_settings
The current end point.
int64_t lineDelay(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad) const
Calculate the total delay of the line represented by an item set (tracks and vias)
virtual int Clearance()
Return the clearance of the track(s) being length tuned.
virtual const MEANDER_SETTINGS & MeanderSettings() const
Return the current meandering configuration.
long long int m_chainExtrasLength
NODE * m_world
Width of the meandered trace(s).
VECTOR2I getSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
long long int lineLength(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad) const
Calculate the total length of the line represented by an item set (tracks and vias)
virtual void AmplitudeStep(int aSign)
Increase/decreases the current meandering amplitude by one step.
long long int m_baselineLength
Dimensions for the meandering algorithm.
The geometry of a single meander.
long long int CurrentLength() const
void Resize(int aAmpl)
Change the amplitude of the meander shape to aAmpl and recalculates the resulting line chain.
int BaselineLength() const
virtual const ITEM_SET Traces()=0
Function Traces()
PLACEMENT_ALGO(ROUTER *aRouter)
virtual int CurrentLayer() const =0
Function CurrentLayer()
virtual const std::vector< NET_HANDLE > CurrentNets() const =0
Function CurrentNets()
virtual long long GetNetBoardLength(NET_HANDLE aNet) const
virtual long long int CalculateRoutedPathLength(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad, const NETCLASS *aNetClass)=0
virtual int64_t CalculateRoutedPathDelay(const ITEM_SET &aLine, const SOLID *aStartPad, const SOLID *aEndPad, const NETCLASS *aNetClass)=0
ROUTER_IFACE * GetInterface() const
RULE_RESOLVER * GetRuleResolver() const
virtual bool QueryConstraint(CONSTRAINT_TYPE aType, const ITEM *aItemA, const ITEM *aItemB, int aLayer, CONSTRAINT *aConstraint)=0
Push and Shove diff pair dimensions (gap) settings dialog.
MEANDER_TYPE
Shapes of available meanders.
int findAmplitudeForLength(MEANDER_SHAPE *m, int targetLength, int minAmp, int maxAmp)
const int LENGTH_TARGET_TOLERANCE
int findAmplitudeBinarySearch(MEANDER_SHAPE &aCopy, int targetLength, int minAmp, int maxAmp)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
VECTOR2< int32_t > VECTOR2I