[Error]Help With DLL

Support Communities Code Generation and Implementation [Error]Help With DLL

This topic contains 3 replies, has 4 voices, and was last updated by  Rhonda Liang 1 year, 2 months ago.

  • Author
    Posts
  • #20562

    Thiago Silva
    Participant

    Hello Guys,

    I made a DLL file with C code (I’m implementing a PLL) but when I try to load the DLL on PSIM “General DLL” Block I receive the error: “Unable to Access the function “RUNSIMUSER” in DLL file: C://…”. If someone could please help me i’ve tried to change the name of my C function to RUNSIMUSER but it didn’t work.

    Thanks!

  • #21385

    Albert Dunford
    Participant

    Hi Thiago,

    I apologize for the delayed response, please check that the dll you have compiled has the same bits as the PSIM version you are using. You can check the bits of you PSIM by looking in Help->about PSIM, if you see no bits defined you are using 32-bit. The 64 bit version will be clearly labelled. You dll needs to be 32-bit if you have 32 bit PSIM. If you have 64-bit PSIM you need to have a 64-bit dll. If you did not compile the dll, we provide access to both the 32-bit and 64-bit versions please contact our support email and they can provide you the proper links if you need a different version of PSIM.

  • #27449

    Jaime Mora
    Participant

    Hello, Sorry for open again this topic.

    I was trying to simulate using a 3 input dll block, but when I try to run it says the same the Unable to Access the function but actually show some chinesse character. I am using a 64 bit version and the compilation is with visual studio 2017.

    My code is:

    #include <math.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <assert.h>

    _declspec(dllexport)
    void RUNSIMUSER(
    double t, double delt, double *in, double *out)
    {

    // Place your code here…………begin
    //Assuming DLL has 1 input and 1 output ( in[0] and out[0] )

    static double error = 0;
    error = in[0] – 1000;
    if (error < 0) {
    out[0] = 1;
    out[1] = 0;
    }
    if (error > 0) {
    out[0] = 0;
    out[1] = 1;
    }
    if (error == 0) {
    out[0] = 0;
    out[1] = 0;
    }

    // Place your code here…………end

    }

    best

  • #27461

    Rhonda Liang
    Participant

    Please email your question to support@powersimtech.com, along with your PSIM license number and university/company affiliation for prompt and in depth technical support.

You must be logged in to reply to this topic.