ABSTRACT

To see these features in more detail, we convert a simple gain block to code. Figure 26 shows all o f the pieces o f this conversion. The code that results from the .tic file is a full gain block multiplication since the gain was not equal to zero or plus or minus one. The name assigned to the output o f the block is r tB .Cont ro lGain indicating that the output variable in the code is a structure with the top level name o f r tB, and the next level set to the name used in the Simulink block (Cont ro lGain in this instance). The inputs to the gain block are always called r tU at the top level o f the structure, and are given the name o f the block output where it is connected (Input in this instance), as a substructure (the variable name for the input is rtU.Input). The general name for an output is always r tY, and this is also a structure, and the sub-structure is the name o f the block that the gain block is connected to (Output in this case). The gain itself is also a structure, wi th a name rtP and a sub-structure name also taken from the name o f the block in the Simulink diagram (r tP.ControlGain in this case).