To retrieve external inputs, you can create separate tasks within the Rational Statemate model. This process is described in Adding User-Written Code.
Use the tasks to read inputs from the environment (possibly from the keyboard or an input file), and use the value setting functions to insert the changes into the Rational Statemate model. In order to simulate the passage of time, the delay function should be used between inputs.
The outputs can be captured using the event callback mechanism, or they can be polled using a separate task.