Documentation Center

  • Trial Software
  • Product Updates

Temperature Control in a Shower

This example shows how to use a fuzzy-logic inference system in a Simulink® model.

Required Product

To run this example, Simulink® is required.

if ~fuzzychecktoolboxinstalled('simulink')
    disp('Simulink(R) is required to run this example.')
    return
end

Simulink Model

There are two inputs to the fuzzy controller: the water temperature and the flow rate. The controller uses these inputs to manipulate the hot and cold valves.

open_system('shower');

Simulation

Simulate controller response with periodic changes in the setpoints of the water temperature and flow rate.

set_param('shower/flow scope','Open','on','Ymin','0','Ymax','1');
set_param('shower/temp scope','Open','on','Ymin','15','Ymax','30');
sim('shower',50);

bdclose('shower');
Was this topic helpful?