-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfbuilder_bus_wrapper.c
84 lines (76 loc) · 2.43 KB
/
sfbuilder_bus_wrapper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
*
* --- THIS FILE GENERATED BY S-FUNCTION BUILDER: 3.0 ---
*
* This file is a wrapper S-function produced by the S-Function
* Builder which only recognizes certain fields. Changes made
* outside these fields will be lost the next time the block is
* used to load, edit, and resave this file. This file will be overwritten
* by the S-function Builder block. If you want to edit this file by hand,
* you must change it only in the area defined as:
*
* %%%-SFUNWIZ_wrapper_XXXXX_Changes_BEGIN
* Your Changes go here
* %%%-SFUNWIZ_wrapper_XXXXXX_Changes_END
*
* For better compatibility with the Simulink Coder, the
* "wrapper" S-function technique is used. This is discussed
* in the Simulink Coder User's Manual in the Chapter titled,
* "Wrapper S-functions".
*
* Created: Fri Aug 16 18:25:11 2013
*/
/*
* Include Files
*
*/
#if defined(MATLAB_MEX_FILE)
#include "tmwtypes.h"
#include "simstruc_types.h"
#else
#include "rtwtypes.h"
#endif
#include "sfbuilder_bus_bus.h"
/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
#include <math.h>
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
#define u_width 1
#define y_width 1
/*
* Create external references here.
*
*/
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
/* extern double func(double a); */
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Output functions
*
*/
void sfbuilder_bus_Outputs_wrapper(const SFB_COUNTERBUS *u0,
const int32_T *u1,
SFB_COUNTERBUS *y0,
int32_T *y1)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
int32_T limit;
boolean_T inputGElower;
/* limit is sum of SFB_SIGNALBUS.input and the second input(u1) */
limit = u0->inputsignal.input + *u1;
/* check if SFB_SIGNALBUS.limit is >= LIMITBUS.lower_saturation_limit */
inputGElower = (limit >= u0->limits.lower_saturation_limit);
if((u0->limits.upper_saturation_limit >= limit) && inputGElower) {
*y1 = limit;
}
else {
if(inputGElower) {
limit = u0->limits.upper_saturation_limit;
} else {
limit = u0->limits.lower_saturation_limit;
}
*y1 = limit;
}
y0->inputsignal.input = *y1;
y0->limits = u0->limits;
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}