Does FlexSim support gRCP?

Does FlexSim support gRCP?

tsuji_ryusuke
Advocate Advocate
309 Views
6 Replies
Message 1 of 7

Does FlexSim support gRCP?

tsuji_ryusuke
Advocate
Advocate

[ FlexSim 21.0.8 ]

Hi,


I was asked by a customer if FlexSim supports gRCP.

Information on gRCP can be found below.

https://grpc.io/


Customers seem to be wondering if they can use gRCP to communicate with FlexSim via an external program.

Can you give me some information?


Accepted solutions (1)
310 Views
6 Replies
Replies (6)
Message 2 of 7

philboboADSK
Autodesk
Autodesk

gRCP has a C++ interface. Basics tutorial | C++ | gRPC

You can use the DLL Maker or Module SDK to execute C++ code from FlexSim. So yes, you can use gRCP to communicate with FlexSim via an external program.



Phil BoBo
Sr. Manager, Software Development
Message 3 of 7

sastanin
Collaborator
Collaborator
Accepted solution

I successfully used C++ gRPC API to create a FlexSim module for our client. While I can't disclose implementation details, here are some tips:

1. The easiest way to build and install grpc libs on Windows is to use vcpkg. I recommend pinning vcpkg version to one of their recent tags, this will help to re-create build environment without regenerating protocol files every time.

If you have already checked out vcpkg git repo, do something like this:

git checkout 2021.05.21
.\bootstrap-vcpkg.bat -disableMetrics
.\vcpkg.exe update
.\vcpkg.exe upgrade --no-dry-run

and then `vcpkg.exe integrate install`.

2. C++ side you should already know how to create FlexSim modules and follow grpc tutorials which explain how to generate C++ code from the proto files. These files will be compiled and linked to your FlexSim module.

I generated C++ code by manually calling protoc.exe with grpc_cpp_plugin.

3. I derived a class from FlexSim::SimpleDataType. A static Init() method works as Flexscript "constructor" and initializes a tree node and adds class-specific data that node. One of the instance methods can create a GRPC channel. stub_ data is a member of my class. Then there are different methods which more or less correspond to methods described in the protocol files which I have used (they are specific to your protocol files). Init and other methods are bound and can be called from Flexscript.

As long as you don't want to use grpc in async mode, implementation is relatively straightforward (provided you can figure out how to read generated C++ for gRPC and know how to create SimpleDataTypes).


Message 4 of 7

tsuji_ryusuke
Advocate
Advocate

Hi @Serge A ,


Thank you for your reply and introduction of tips.

This information will surely be useful!

0 Likes
Message 5 of 7

tsuji_ryusuke
Advocate
Advocate

Hi @Phil BoBo ,


Thank you for your reply.

It was very helpful to know that communication was possible.

0 Likes
Message 6 of 7

adamhales
Not applicable

FlexSim does not natively support gRPC (Google Remote Procedure Call) for communication with external programs. However, it is possible to integrate FlexSim with gRPC by developing custom connectors or using APIs to establish communication. While FlexSim primarily utilizes other protocols for external communication, gRPC can be implemented with additional development effort. For testing and preparation, Study4Exam offers free practice questions for gRPC, which can help you better understand the protocol and its integration. Official resources like the FlexSim API documentation and the gRPC website (https://grpc.io/) can provide further insights on how to implement such integrations.

Message 7 of 7

William487
Not applicable

Can you give me some information?
Resources mentioned by @Adam Hales are incredibly helpful for my preparation. They provide valuable insights and hands-on experience, enhancing my understanding of gRPC. By utilizing these materials, I feel confident in my ability to effectively learn and apply the concepts, increasing my chances of achieving the gRPC certification on my first attempt.

0 Likes