Hello,
More than one triode does not work in this module. This is due to a bug in the Model.cpp file.
Line 104:
for (int nl = 0; nl < nonlinear.size();)
{
auto& comp = nonlinear.getReference (nl);
auto ports = comp.numOfPorts;
if (ports == 1)
{
comp.model (v.row (nl), iComp1, jComp1);
i.submat (nl, 0, nl, 0) = iComp1;
j.submat (nl, nl, nl, nl) = jComp1;
}
if (ports == 2)
{
comp.model (v.rows (nl, nl + 1), iComp2, jComp2);
i.submat (nl, 0, nl + 1, 0) = iComp2;
j.submat (nl, nl, nl + 1, nl + 1) = jComp2;
}
nl += ports;
}
Need to be replaced with:
int pi = 0;
for (int nl = 0; nl < nonlinear.size(); nl++)
{
auto& comp = nonlinear.getReference (nl);
auto ports = comp.numOfPorts;
if (ports == 1)
{
comp.model (v.row (pi), iComp1, jComp1);
i.submat (pi, 0, pi, 0) = iComp1;
j.submat (pi, pi, pi, pi) = jComp1;
}
if (ports == 2)
{
comp.model (v.rows (pi, pi + 1), iComp2, jComp2);
i.submat (pi, 0, pi + 1, 0) = iComp2;
j.submat (pi, pi, pi + 1, pi + 1) = jComp2;
}
pi += ports;
}
Line 215:
for (int i = 0; i < nonlinear.size(); ++i)
{
Nn (i, nonlinear.getReference(i).nodes[0]) = 1.0;
Nn (i, nonlinear.getReference(i).nodes[1]) = -1.0;
if (nonlinear.getReference(i).numOfPorts == 2)
{
Nn (i + 1, nonlinear.getReference(i).nodes[2]) = 1.0;
Nn (i + 1, nonlinear.getReference(i).nodes[3]) = -1.0;
}
}
Need to be replaced with:
int pi = 0;
for (int i = 0; i < nonlinear.size(); ++i)
{
Nn (pi, nonlinear.getReference(i).nodes[0]) = 1.0;
Nn (pi, nonlinear.getReference(i).nodes[1]) = -1.0;
if (nonlinear.getReference(i).numOfPorts == 2)
{
pi++;
Nn (pi, nonlinear.getReference(i).nodes[2]) = 1.0;
Nn (pi, nonlinear.getReference(i).nodes[3]) = -1.0;
}
pi++;
}
Corrected version in the archive.
juce_dkmethod bug fixed by NaLex.zip (7.5 KB)