Export .h FileMany of the Spark! API functions require the index of the fuzzy variable to be passed in (see functions like set_value() and get_value()). This index does not correspond to the position of the variable in the Spark! UI. The get_mom_output() function returns the index of the "winning" output set. Again, this index does not correspond to the position of the set in the output variable so we must know which index belongs to which set. The index values should be obtained from the .h file that is exported by Spark!
Naming ConventionsVariable names are converted to all capital letters and any spaces in the name are converted to underscores. For output sets, the names are converted just like variable names and are pre-pended with "<OUT VAR ID>_", where "<OUT VAR ID>" is the name of the output variable. How do I export the .h file?Select "File | Export .h File" or click on the toolbar icon: Where do I put the .h file?It is recommended that the .h file resides with the .cpp file that is using it. What do I name the .h file?You can name it anything you want. It is recommended that you name it the same as the model name it was exported from. What is the USE_SPARK_NAMESPACE used for?This is used in case you have more than one Spark! model in a single application. With more than one Spark! model, it is possible that you have duplicate variable names. If they do not have the same index value you will get strange results indeed. Spark! uses namespaces to resolve these conflicts. If you define USE_SPARK_NAMESPACE you have to qualify the variable's index identifier with the namespace. The namespace is the same as the .h file's name. For example if we have an application with two Spark! models: model_1.spk and model_2.spk the .h's exported may look like:
If we did not define USE_SPARK_NAMESPACE there would be a conflict between FUZZY_VAR_1's value of 1 for model_1 and it's value of 0 for model_2. With the namespaces we don't have that conflict because we access them with the namespace:
|
|