EMI_CB_CalculateIndirectOutputs (EMI Function)
- Updated2023-03-14
- 1 minute(s) read
EMI_CB_CalculateIndirectOutputs (EMI Function)
Owning Class: Callbacks
Requires: Control Design and Simulation Module
Prototype
void EMI_CB_CalculateIndirectOutputs(emiRef model);
Description
Calculates the outputs of an external model that have indirect feedthrough. You must define and export this function if the model has outputs with indirect feedthrough.
Inputs
| Name | Description |
|---|---|
| model | Specifies a reference to the external model. Use this reference as an input to other EMI functions. Do not modify model directly. |
Examples
void EMI_CB_ModelInterface(emiRef model) {
EMI_AddScalarInput(model, "First Input");
EMI_AddScalarOutput(model, "First Output", EMI_Feedthrough_Indirect);
EMI_AddScalarOutput(model, "Second Output", EMI_Feedthrough_Direct);
}
void EMI_CB_SizeInformation(emiRef model) {
EMI_SetNumberOfContinuousStates(model, 1);
}
void EMI_CB_CalculateIndirectOutputs(emiRef model) {
double* y = EMI_GetOutput(model, 0);
const double* xc = EMI_GetContinuousStates(model);
/* calculate first output, which has indirect feedthrough behavior */
y[0] = xc[0];
}
void EMI_CB_CalculateDirectOutputs(emiRef model) {
double* y = EMI_GetOutput(model, 1);
const double* u = EMI_GetInput(model, 0);
/* calculate second output, which has direct feedthrough behavior */
y[0] = u[0];
}