0

I know this has been posted before but none of the answers work for me.

I'm using VISSIM v10 and made a DLL File to make an external driver model. This is working well. But what I want is to implement the algorithms in MATLAB instead and make the DLL File send data to Matlab, then Matlab computes the updates the values and sends them back to DLL. The DLL then sends the value back to VISSIM.

So along with .vcproj, .h and .cpp files provided by VISSIM to create the DLL File (im using Microsoft Visual Studio 19), I've added engine.h file in the same project file to be able to use engine routines but it gives 'unresolved external symbol' error for engOpen and engEvalString. I try the same thing in a new .cpp file and it works but how can I link that to VISSIM..

I've added all the libraries and include directories in the properties and configuration type as .dll.

Tettamanti and Varga (2012) mentions that this is the way to be able to do it. But it isn't working for me for now. Help ?

  • 1
    If you "_know this has been posted before but none of the answers work_" please be specific and show what duplicates you've seen and tell us how they didn't help you. – Andras Deak -- Слава Україні Jun 27 '19 at 21:23
  • "I've added all the libraries" ... but you get an "unresolved external symbol error" which says that you didn't include all the libraries. Also, don't copy the `engine.h` file to your project, `#include` it in your source file, and have the compiler find it in the MATLAB directory where it belongs. Copying files like that will certainly lead to headaches later on. – Cris Luengo Jun 27 '19 at 22:36
  • @AndrasDeak https://stackoverflow.com/q/37797403/6579908 This is the link to what I've seen on the topic. The answer gives an alternative which I'm not yet willing to try. I want to be able to send and receive data between dll and Matlab directly. – user6579908 Jun 27 '19 at 23:03
  • @CrisLuengo okay. Will keep that in mind. Did that. No effect on the error though. – user6579908 Jun 27 '19 at 23:10
  • 1
    Please [edit] your question to clearly show *which libraries* and *which include directories* you added to your project. We cannot tell you what you did wrong if you don't show what you did. This is why Andras wrote that comment earlier. You need to **show** what you did. See [mre]. – Cris Luengo Jun 27 '19 at 23:15
  • @CrisLuengo got it. Thanks. I'll do that ASAP. Possibly tomorrow morning. It's evening right now. – user6579908 Jun 27 '19 at 23:40

1 Answers1

0

To call MATLAB algorithms from INSIDE your Vissim External Driver Module Dll, you have the following options:

  1. Use MATLAB Compiler SDK for C/C++ - this SDK can help wrapping the MATLAB algorithms into a separate royalty-free DLL, which you can LINK with your Vissim External Driver Module DLL.
    • This would provide your the most computationally efficient and minimal overhead interoperability with MATLAB runtime.
    • A good command of C/C++ is a must because you will have to figure out a lot of things yourself;
    • You would need a MATLAB add-on license for this feature;
    • You can distribute your MATLAB DLL royalty free (together with MATLAB runtime libs) to a third-party who does not have an MATLAB license;
  2. Use MATLAB directly as a COM automation server inside your Vissim External Driver Module DLL - you would just have to manage MATLAB as out-of-process COM automation server yourself, and do the house-keeping carefully;
    • This does not require a MATLAB add-on license;
    • It requires a local, licensed MATLAB installed on the same computer as Vissim;
    • You need to figure out a lot of things yourself, too.
  3. Use MATLAB External Engine API in C/C++, which is essentially a convoluted wrapper of MATLAB out-process COM object, but in a modern C++ flavor;
    • This saves you the hassle managing MATLAB COM object yourself, but it demands you, again, to have a mastery of MODERN C++ (i.e., C++11/C++14/C++17) features.
    • No additional MATLAB add-on license is required;
    • It requires a local, licensed MATLAB installed in the same computer as Vissim.

I don't see there existing an easy, and straightforward way of integrating Vissim External Driver Module DLL DIRECTLY with MATLAB. All requires non-trivia C++ and COM knowledge and skills.

If you are good with modern C++, I would suggest you go with Option 1 - it provides the best performance.

Wuping Xin
  • 120
  • 5