# Control: Plant Output

Model ElementThe Control_PlantOutput element defines the outputs from a mechanical system or plant.

## Description

This is part of the information necessary to create a linearized model of the plant or for co-simulation. You also need to specify the inputs to the plant using the Control_PlantInput element. Given the inputs and outputs, you may use the Simulate command of type Linear to compute the matrices in the following linearized, state space form:

x is the state vector, u is the input variable, and y is the output variable. A, B, C, and D denote the state matrix, the input matrix, the output matrix, and the direct feed-through matrix, respectively. These matrices are often useful as a starting point in control systems design.

## Format

<Control_PlantOutput
id                    = "integer"
num_element           = "integer"
variable_id_list      = "integer, integer, ..., integer"
[
type                = "USERSUB"
usrsub_dll_name     = "valid_path_name"
usrsub_fnc_name     = "custom_fnc_name"
usrsub_param_string = "USER(par_1, ..., par_n)"
]

[[
label            = "string"
hold_order       = "integer"
sampling_period  = "real"
offset_time      = "real"
]]
/>

## Attributes

id
Element identification number (integer>0). This number is unique among all Control_PlantOutput elements.
label
An optional label for the element. This could be the name for the Control_PlantOutput element.
num_element
Number of outputs from the plant that are to be specified using this Control_PlantOutput element.

num_element > 0

hold_order
Specifies the order of extrapolation applied to the control signal(s) propagating out from Control_PlantOutput. Note that for the first time step, the value is held constant (order zero), since there is no past history to extrapolate.

The default value is 1.0.

variable_id_list
Specifies the list of IDs of the variables that define the outputs from the plant. The length of this list is equal to num_element.
sampling_period
Specifies the sample time of an output port. A value of 0.0 specifies continuous sampling while any other non-zero value specifies discrete sampling. This value cannot be negative. The default value is 0.0. In most cases, this value need not be changed from its default, except in models where a discrete sampling is required. This parameter is to be used only in case of co-simulation with MATLAB/Simulink. 3
offset_time
Specifies the sample time offset for each output port. The sample time offset must be strictly less than the sampling_period if the latter is non-zero. If the sampling_period is 0.0 (continuous), then offset_time defaults to 0.0 as well In most cases, this value need not be changed from its default, except in models where a discrete sampling is required. This parameter is to be used only in case of co-simulation with MATLAB/Simulink.
usrsub_dll_name
Specifies the path and name of the DLL or shared library containing the user subroutine. MotionSolve uses this information to load the user subroutine in the DLL at run time. Use this keyword only when type = USERSUB.
usrsub_fnc_name
This parameter allows you to specify the name for the user subroutine. The default name, POUTSUB, is used when the attribute is not specified. Use this keyword only when type = USERSUB.
usrsub_param_string
The list of parameters that are passed from the data file to the user-defined POUTSUB. Use this keyword only when type = USERSUB. Set this parameter equal to "USER(parameter 1, par 2,…, par n)", where the parameters are chosen by you.

## Example

Consider the control problem of stabilizing an inverted pendulum mounted on a slider. The image below shows one such setup. The slider, the green block, is constrained to move along the global x-axis by a translational joint with ground, depicted as the red strip. The pendulum is hinged to the slider with the axis of rotation parallel to the global y-axis. The slider motion is opposed by a linear spring-damper.
Assume that the task is to design a controller to stabilize the unstable configuration shown in the image above. Start by computing the state space form of equations of motion with the intent to use MATLAB to design a controller. We are given:
• Plant input: Control force Fc acting on slider along global X.
• Plant output: Pendulum angle θ.

The plant output may be defined as follows:

<Control_PlantOutput
id               = "303001"
num_element      = "1"
variable_id_list = "12"
hold_order       = "1"
/>

Reference_Variable 12 defines the pendulum angle θ.