Fatal error: No evaluation function found in controller20.dll

Dear Sir,

We created a X3 controller for the schematic and it shows some error with
“Fatal error: No evaluation function found in controller20.dll”
Could you please provide your suggestions? Thank you.

Code:

// Automatically generated C++ file on Tue Jan 13 22:31:53 2026
//
// To build with Digital Mars C++ Compiler:
//
// dmc -mn -WD -o controller20.cpp kernel32.lib

#include

double Ts = 10e-6; // Switching period (100kHz, 10us)
double Dk = 0.1, Dk_1; // Previous Duty Cycle
double Sawtooth; // Sawtooth waveform
double vsmk = 0.1, vsmk_1; // Voltage samples
double ismk = 0.1, ismk_1; // Current samples
double psmk = 0.1, psmk_1; // Power samples
//double last_clk = 0;

union uData
{
bool b;
char c;
unsigned char uc;
short s;
unsigned short us;
int i;
unsigned int ui;
float f;
double d;
long long int i64;
unsigned long long int ui64;
char *str;
unsigned char *bytes;
};

// — DLL Entry Point (Do not modify) —
int __stdcall DllMain(void *module, unsigned int reason, void *reserved) { return 1; }

#undef in0
#undef in1
#undef in2
#undef in3
#undef in4
#undef out0
#undef out1
#undef out2
#undef out3
#undef out4
#undef out5

extern “C” __declspec(dllexport) void Evaluation(void **opaque, double t, union uData *data)
{

double in0 = data[0].d; // clk (Sampling Clock)
double in1 = data[1].d; // vsm (Voltage Sensor)
double in2 = data[2].d; // ism (Current Sensor)
double in3 = data[3].d; // vsm (Voltage Sensor)
double in4 = data[4].d; // ism (Current Sensor)
double &out0 = data[5].d; // pwm (PWM Output)
double &out1 = data[6].d; // vsmk (Monitor V)
double &out2 = data[7].d; // ismk (Monitor I)
double &out3 = data[8].d; // psmk (Monitor P)
double &out4 = data[9].d; // Dk (Monitor Duty)
double &out5 = data[10].d; // psmk_1 (Monitor Prev P)

Sawtooth = t/Ts - floor(t/Ts);

if (Dk > Sawtooth)
out0 = 5.0; // Turn ON (Gate Drive Voltage, e.g., 5V)
else
out0 = 0.0; // Turn OFF

if ((in0 > 0.999) && (in0 <= 1.001))
{
// 1. Shift Registers (Save history)
vsmk_1 = vsmk; vsmk = in1; // Update Voltage
ismk_1 = ismk; ismk = in2; // Update Current
psmk_1 = psmk; psmk = vsmk * ismk; // Calculate Power = V * I
Dk_1 = Dk; // Save Duty Cycle

   // 2. MPPT Core Logic
   // Compare current power with previous power
   if (psmk > psmk_1)
   {
       // Power increased: keep moving in the same direction
       if (vsmk > vsmk_1)
           Dk = Dk_1 - 0.02;
       else
           Dk = Dk_1 + 0.02;
   }
   else
   {
       // Power decreased: reverse direction
       if (vsmk > vsmk_1)
           Dk = Dk_1 + 0.02;
       else
           Dk = Dk_1 - 0.02;
   }

   // 3. Saturation (Safety limits for Duty Cycle)
   //if (Dk > 0.9) Dk = 0.9;
   //if (Dk < 0.1) Dk = 0.1;

}

// ==========================================
// 4. Update Monitor Outputs
// ==========================================
out1 = vsmk;
out2 = ismk;
out3 = psmk;
out4 = Dk;
out5 = psmk_1;
}

Best Regards
Shawn

You need to upload your .qsch and .c files. Please refer to this post.
Qspice Forum - New User to Basic User (File Upload) - QSPICE - Qorvo Tech Forum

In your DLL, the evaluation function is named “Evaluation.” In the schematic component, the X3 specifies the DLL name as Controller20 (1st string attribute). QSpice is looking for a DLL named controller20.dll (which it finds) and an evaluation function named “controller20” (lower case) which it doesn’t find.

Change the evaluation function name to “controller20” (lower case) and this error should be resolved.

–robert

3 Likes