JUCE module for analogue modelling!

Nice stuff @Lex248!
Unfortunately, I haven’t been able maintain the repo due to my employment.
But feel free to make a PR on the repo if you’re up to, I’d be happy to approve!
Cheers!

@jrrossi
I tried your code with Eigen library. The load has been halved. But the load is still too high for the practical use of this method.

By the way, I build it on Windows. To build with Armadillo you need to use lib_win64\libopenblas.lib

1 Like

Hi, I’m trying to model a fuzz face pedal using your module but I keep getting errors using transistors;

I can’t find the problem, I’m guessing that either I’m not using makeTransistor correctly or the function has some bugs. Is what I did here correct?

//    Resistors
    model.addComponent(dkm::ComponentFactory::makeResistor(33000.0, "R1", 4, 3));
    model.addComponent(dkm::ComponentFactory::makeResistor(470.0, "R2", 4, 5));
    model.addComponent(dkm::ComponentFactory::makeResistor(8000.0, "R3", 5, 6));
    model.addComponent(dkm::ComponentFactory::makeResistor(100000.0, "R4", 2, 7));
    
//   Capacitors
    model.addComponent(dkm::ComponentFactory::makeCapacitor(0.0000022, "C1", 1, 2));
    model.addComponent(dkm::ComponentFactory::makeCapacitor(0.000020, "C2", 0, 9));
    model.addComponent(dkm::ComponentFactory::makeCapacitor(0.00000001, "C3", 5, 10));
//    Transistors
    model.addComponent(dkm::ComponentFactory::makeTransistor("Q1", 2, 3, 0));
    model.addComponent(dkm::ComponentFactory::makeTransistor("Q2", 3, 2, 7));
//   Potentiometers
    model.addComponent(dkm::ComponentFactory::makePotentiometer(1000.0, "Fuzz", 7, 0, 9));
    model.addComponent(dkm::ComponentFactory::makePotentiometer(500000.0, "Volume", 10, 0, 11));
//   Input and Output
    model.addComponent(dkm::ComponentFactory::makeInput("In", 1, 0));
    model.addComponent(dkm::ComponentFactory::makeInput("Vps", 4, 0));
    model.addComponent(dkm::ComponentFactory::makeOutput("Out", 11, 0));

Maybe this?

model.addComponent(dkm::ComponentFactory::makeTransistor("Q2", 3, 6, 7));

Yep, you are totally right, thanks. Still it doesn’t work.

Just gave this a quick glance, R3 should be 8200, but I doubt this would stop it from working.

The only thing that jumps out to me, is to check the polarity of the power supply, as it is not normal to draw the negative rail at the top of a schematic.

Really cool stuff! How does the Nodal DK method compare to other methods, such as Modified Nodal Analysis in terms of performance and accuracy?

I wrote a pure-data external for doing circuit simulation, which is now a part of the ELSE externals library (source). This uses an MNA approach with a pretty fast matrix solver. I might switch over Nodal DK though, your source code is a lot simpler in comparison. It might be possible to convert some of my components (JFET, MOSFET, Transformer, Pentode, Gyrator) over to your system?

What might also be of interest to you, is my collection of component models (source). This contains parameters you can use to simulate specific models of diodes, transistors and vacuum tubes.

edit: I should have read the paper first! So Nodal DK is similar to MNA, but it should be faster, and doesn’t require iterating. Nice!