from fpdf import FPDF

# Create instance of FPDF class
pdf = FPDF()

# Add a page
pdf.add_page()

# Set font
pdf.set_font("Arial", size = 12)

# Create a cell
pdf.cell(200, 10, txt = "Control Inputs Calculation for Given System", ln = True, align = 'C')

# Add content
content = """
Given the system:
\dot{x}_1 = a_1 x_1 + a_2 x_3 + a_3
\dot{x}_2 = a_4 x_2 + a_5 x_3 + a_6 u
\dot{x}_3 = a_9 x_1 + a_{10} x_2 + a_{11} x_3 + a_7 + a_8 u

Assume the parameter values:
a_1 = 1
a_2 = 2
a_3 = 3
a_4 = 4
a_5 = 5
a_6 = 6
a_7 = 7
a_8 = 8
a_9 = 9
a_{10} = 10
a_{11} = 11

Defining the feedback controller K:
Assume K = [k_1, k_2, k_3] = [1, 1, 1]

1. Nominal Control u_s:
u_s = -K x = -[1, 1, 1] [x_1, x_2, x_3]^T = -(x_1 + x_2 + x_3)

2. Filter Design G_f(s):
We use a low-pass filter:
G_f(s) = 1 / (1 + τs)
Assume τ = 0.1.

3. Estimation of Uncertainty and Disturbance:
Assume hat{f}(x) = f(x) with no uncertainties and f(x) = [a_3, 0, a_7]^T = [3, 0, 7]^T.

4. Calculate u_{ude}:
Pseudo-inverse of B:
B = [0, 6, 8]^T
Pseudo-inverse of B:
B^+ = [0, 1/6, 1/8]

We then calculate:
u_{ude} = -B^+ [ 1 / (1 - G_f(s)) * (f(x) - B K x) ]

We need to calculate B K x:
B K x = [0, 6, 8]^T [1, 1, 1] [x_1, x_2, x_3]^T = [0, 6(x_1 + x_2 + x_3), 8(x_1 + x_2 + x_3)]^T

Then, f(x) - B K x:
f(x) - B K x = [3, 0, 7]^T - [0, 6(x_1 + x_2 + x_3), 8(x_1 + x_2 + x_3)]^T = [3, -6(x_1 + x_2 + x_3), 7 - 8(x_1 + x_2 + x_3)]^T

Calculate 1 / (1 - 1 / (1 + 0.1s)):
1 / (1 - 1 / (1 + 0.1s)) = (1 + 0.1s) / 0.1s = 10 + 1/s

So:
u_{ude} = -B^+ [ (10 + 1/s) [3, -6(x_1 + x_2 + x_3), 7 - 8(x_1 + x_2 + x_3)]^T ]

u_{ude} = -[0, 1/6, 1/8] [10 [3, -6(x_1 + x_2 + x_3), 7 - 8(x_1 + x_2 + x_3)]^T + 1/s [3, -6(x_1 + x_2 + x_3), 7 - 8(x_1 + x_2 + x_3)]^T ]

= -[0, 1/6, 1/8] [ [30, -60(x_1 + x_2 + x_3), 70 - 80(x_1 + x_2 + x_3)]^T + 1/s [3, -6(x_1 + x_2 + x_3), 7 - 8(x_1 + x_2 + x_3)]^T ]

= -[0, 10(x_1 + x_2 + x_3), 8.75 - 10(x_1 + x_2 + x_3)]^T - [0, -1/s (x_1 + x_2 + x_3), 1/s (7 - 8(x_1 + x_2 + x_3))]^T

5. Total Control u:
u = u_s + u_{ude}

u = -(x_1 + x_2 + x_3) - [ -10(x_1 + x_2 + x_3) + 1/s (8.75 - 10(x_1 + x_2 + x_3)) ]

Final Result:
u = -(x_1 + x_2 + x_3) + 10(x_1 + x_2 + x_3) + 1/s (10(x_1 + x_2 + x_3) - 8.75)

u = 9(x_1 + x_2 + x_3) + 1/s (10(x_1 + x_2 + x_3) - 8.75)

Thus, the control input u for the given system can be calculated using the above steps with the given parameter values.
"""

# Insert content
pdf.multi_cell(0, 10, content)

# Save the pdf with name .pdf
pdf_output_path = "Control_Inputs_Calculation.pdf"
pdf.output(pdf_output_path)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: