White is short of queen and is making a brutal come back which results in black forfeiting.
Monday, March 7, 2022
Wednesday, October 20, 2021
Coupled inductors MAXIMA code
/* ------------------------------- CUT HERE -------------------------------- */
/* Current in Primary at time t
and coupling coefficient k */
m:float(1/1000);
i1_2nd_order(R1,R2,L1,L2,E,k,t):=block(
[
PrimCurrent:float(0.0),
A:float(0.0),
B:float(0.0),
C:float(0.0),
C1:float(0.0),C2:float(0.0),
Lamda1:float(0.0),Lamda2:float(0.0)],
A:L1*L2-k^2*L1*L2,
B:L1*R2+L2*R1,
C:R1*R2,
Lambda1:(-B+sqrt(B^2-4*A*C))/(2*A),
Lambda2:(-B-sqrt(B^2-4*A*C))/(2*A),
C2: -E*A*L2/((L2*L1-k^2*L1*L2)*sqrt(B^2-4*A*C))-Lambda1*E*A/(R1*sqrt(B^2-4*A*C)),
C1: -C2-E/R1,
PrimCurrent:C1*exp(t*Lambda1)+ C2*exp(t*Lambda2)+E/R1,
return (PrimCurrent)
);
/* example */
i1_2nd_order(0.3,12.5,1.5*m,0.8,12,0.95,1.2*m);
/* ------------------------------- CUT HERE -------------------------------- */
Tuesday, June 8, 2021
Ways to write quality software (to be updated)
- Comments should say what the code does, not how it does it.
- Name your routines so that they are self-evident. The same goes for parameters.
That way, comments' necessity is reduced.
- Keep the number of parameters small. Try not to go over four. Tree to four is optimal.
- Try not to repeat the code.
- Avoid long routines of code.
- Avoid complex conditional statements with large blocks of code. Reduce the complexity.
** Refactoring (https://youtu.be/1KeJc6V4Jjk?t=127)
- Extract methods.
Change long routines to few/many small ones (ca. 20 lines of code).
- Extract conditional and loop blocks of code as separate routines.
- Move related concepts closer together.
Physically put similar parts/ideas (code that represent those) closer together.
- Reuse same parts of the code extracted earlier.
- Separate concerns/Modularity.
Make each module (class/routine/...) do only one thing.
Don't bloat/clog the code. Goal is to achieve that one goal:)
- Work in small steps.
Small changes are less prone to errors.
- When you code,try to refactor your code after every small change. Try to clean it up a bit if you can.
Remember: "Our job as programmers is to solve problems, not to write code":)
(source: https://youtu.be/1KeJc6V4Jjk?t=716)
##References:
5 Ways to Improve Your Code, https://www.youtube.com/watch?v=1KeJc6V4Jjk,
Refactoring Legacy Code: STEP BY STEP
Bertrand Meyer:Object-Oriented Software Construction:
Thursday, February 18, 2021
Parametric variables in PSPice
To add parametric variable,use PARAM part from special.olb library.
Place PARAM part. Double click it.
Below first tab is command button "New Property...". Click it.
Add parametric variable name and default value, click ok.
Close "Add New Property" window. Click "Apply", which is
next to "New Property...".
Next, in schematic, double click part value you want to make parametric.
I.E. for caps you can double click cap value, and type property name
inside curly brackets, like {CapVal}.
Now, cap(s) with value {CapVal} will have capacitance you
put under (default) value in "Add New Property" window.
Sweeping is done under menu "Pspice"->New/Edit Simulation profile"->"Analysis",
under options check "Parametric Sweep". Select "Global Parameter". Under "Parameter name:" type variable name without brackets. Under "Sweep type" select type:linear,logarithmic or value list.
Friday, September 18, 2020
Thursday, September 17, 2020
Wednesday, August 26, 2020
Single pole dual throw switch PSpice model
Orcad Capture symbol plus Orcad PSpice model for
SPDT switch.
Thanks goes to HappySeeker from orcad.pe.kr
Tuesday, August 25, 2020
Harmonic Identities
Asin(x) + Bcos(x) ≡ Rsin(x + α)
Asin(x) – Bcos(x) ≡ Rsin(x – α)
Acos(x) + Bsin(x) ≡ Rcos(x – α)
Acos(x) – Bsin(x) ≡ Rcos(x + α)
R=√(A^2+B^2) ; α=arctan(B/A)
Sunday, August 2, 2020
Tuesday, March 3, 2020
Thursday, January 30, 2020
Wallpaper fix for kb4534310
This might work for all of you, with missing wallpaper.
Should work with stretched option as well.
Browse for image in question that you want to use as wallpaper.
Open it using Windows Photo Viewer.
Right click on the opened image and click on "Set as desktop background".
That's all.
Microsoft released a fix for it, KB4539602 .
Subscribe to:
Posts (Atom)








