For the reference, these are the simplified, compactified equations of Modelica Standard Libary’s 4.0 IdealDiode:
parameter Real Ron = 1e-5
"Forward state-on differential resistance (closed resistance)";
parameter Real Goff = 1e-5
"Backward state-off conductance (opened conductance)";
Real v "voltage drop";
Real i "current";
Boolean off(start=true) "Switching state";
Real s "Auxiliary variable for actual position on the ideal diode characteristic";
/* s = 0: knee point
s < 0: below knee point, blocking
s > 0: above knee point, conducting */
equation
v = s * (if off then 1 else Ron);
i = s * (if off then Goff else 1) ;
off = s < 0;
Would this approach be implementable in MTK?
References: