MATLAB: Accelerator/Rapid Accelerator use with Fuzzy Logic Controller

acceleratorbuildfuzzy logicinitialisationMATLABrapid acceleratorsimulinktunable parameters

I'm trying to use a genetic algorithm to iterate over my model, tuning the FIS parameters that i'm passing into the FLC in my Simulink model. Currently, the MATLAB code looks similar to the following:
global generic_fis;
% generic_fis = object.convertChromosome2FIS(chromosome); (edited out as not strictly accurate - replaced with following)
generic_fis = newfis('testfis');
sim(mdl);
Where generic_fis is specified as the input parameter to the Fuzzy Logic Controller block. I've also tried saving this FIS to a file, i.e. 'tunableFIS.fis', and specifying this as the input parameter to the Fuzzy Logic Controller block, but this has yielded the same result. Essentially, in Accelerator mode the model builds every time the sim() command is called. I've read through previous questions about this, which seem to indicate that any tunable parameters need to be contained within an inport to the model, but I'm not sure how to apply this to a Fuzzy Logic Controller since what i'm altering is the parameter of this block, and I'm not sure how to use a model variable to change this value as the only input available for this block is the input signal.
So to summarise, my question is: How do I stop the model re-building/initialising every time the sim() command is called in accelerator/rapid accelerator mode given that what i'm trying to update is the FIS parameter of the Fuzzy Logic Controller block?
Cheers,
Sam

Best Answer

After a lengthy discussion with MathWorks Customer Support, I've found out that this isn't possible. The Fuzzy Logic Controller block rebuilds the logic when it reads the fis parameter, and so if the contents of the parameter are changed, it forces a rebuild of the simulink logic.
I haven't got a working solution yet, but from our discussions it seems like there are a number of solutions:
1) Compartmentalise the simulations, i.e. use two simulation files. This solves the issue partially in that it allows the simulation file with all the static logic to be built only once, whilst the simulation file with the FLC block still gets rebuilt everytime the fis parameter is changed. Reasonable solution in that it's easy to implement and saves a lot of time rebuilding the code.
2) Use a MATLAB Function to call a C/C++ function which handles the logic of the fuzzy logic controller. This is a bit more effort because it involves writing the functionality myself, but this shouldn't trigger a rebuild.
3) Use of an S-Function. Still exploring this but it seems like it would have similar functionality to above.