How to open a .fsl fine on C++?

How to open a .fsl fine on C++?

gguedia5QZFN
Contributor Contributor
146 Views
2 Replies
Message 1 of 3

How to open a .fsl fine on C++?

gguedia5QZFN
Contributor
Contributor

[ FlexSim 23.2.0 ]

Hello,

I have am building a C++ code. in that code, I need some outputs from a flexsim model. the C++ model needs to pass some parameters to flexsim model and flexsim model needs to provide some outputs back to the c++ code. this process will repeat multiple time in on run of the C++ code. this the approach I am taking:

1. from C++ code, create csv file containing parameter value

2. open the model from C++ code

3. once the model is opened, it should should read the csv file and trigger the run

4. at the end of the simulation, flexsim create and output file for c++

5. c++ read the outfile and run some additional code and create new parameter for flexsim

6. go back to step 1


here is my concern:

how to do step 2? how can I open a flexsim model in c++?

in addition, how to make sure that C++ wait results of simulation before continuing to the next execution?

0 Likes
Accepted solutions (1)
147 Views
2 Replies
Replies (2)
Message 2 of 3

logan_gold
Community Manager
Community Manager
Accepted solution

Hi @Gilles, you should be able to use C++ to run Windows Command Prompt commands. Here is a post that goes over what Command Prompt commands you can use to open FlexSim and run a model:

https://answers.flexsim.com/questions/21116/automatically-configure-and-run-a-flexsim-model.html

You'll need to figure out how to run Command Prompt commands with however you're implementing your C++ code. Since that is a C++ question, we won't be able to help you with those specifics.

There may be a way to determine from within your C++ application when an application closes when it's opened with Command Prompt commands, but again, that is a C++ question that we won't be able to help you with.

You can create a file from within FlexSim by using the fileopen() and fileclose() commands. From within FlexSim, if you go through the Help menu and choose Command Help, you can search for those commands to see how they can be used. You could also try something like exporttable() to export data from a table to a CSV file. Once you have the file created/modified, you should be able to detect when those files are changed with your C++ code.

0 Likes
Message 3 of 3

Jeanette_Fullmer
Community Manager
Community Manager

Hi @Gilles , was Logan Gold's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes