home Forums # Technical Support Pipe output of one fuzzy model into another fuzzy model using QTFuzzylite Reply To: Pipe output of one fuzzy model into another fuzzy model using QTFuzzylite

#6222

Interesting question.

I think the easiest is to create an output variable that you construct and use as input variable. For example, create output variable output_state, your rules in the form “if output_state is walking then …”.

The trick is that you are going to manipulate the fuzzy value of output_state. Every time that you get your set of three values, you are going to do something like:


output_state = engine.output_variable("output_state")

walking = output_state.terms[0]
running = output_state.terms[1]
stationary = output_state.terms[2]

output_state.clear()

implication = engine.rule_block[0].implication
output_state.fuzzy.terms.append(Activated(walking, walking_value, implication))
output_state.fuzzy.terms.append(Activated(running, running_value, implication))
output_state.fuzzy.terms.append(Activated(stationary, stationary_value, implication))

(The code above is Python, but should give you an idea to do so in C++/Java)

You will also need to process the engine manually because in engine.process() all the output variables are cleared, and you do not want this output_state cleared.