Models

Loading a model

After exporting a runtime model from fluxTrainer as a .fluxmdl file, it may be loaded into fluxEngine. fluxEngine supports loading the model directly from disk, as well as parsing a model in memory if the byte sequence of the model was already loaded by the user.

The following example shows how to load a model:

1 try
2 {
3     var model = fluxEngineNET.Model.LoadFromFile(handle, @"sample_model.fluxmdl");
4 }
5 catch (Exception e)
6 {
7     Console.WriteLine($"Error: {e.Message}");
8 }

Extracting information from a model

It is possible obtain information about the groups that were defined in a model and obtain both their name and their color. The following snippet will print the names of all groups and their colors:

 1 try {
 2     foreach (var group in model.Groups)
 3     {
 4         Console.WriteLine($"Group with name {group.Name} has color grb({(int)group.ColorRedComponentValue}, {(int)group.ColorGreenComponentValue}, {(int)group.ColorBlueComponentValue})");
 5     }
 6 }
 7 catch (Exception e)
 8 {
 9     Console.WriteLine($"Error: {e.Message}");
10 }