Seeking Insights on Modeling a Nonlinear Dynamic System in Xcos*

I am working on a project that involves modeling a specific nonlinear dynamic system in Xcos. The core of the system is defined by the step response function:

y(t) = y(0) + \frac{Po}{f} \cdot A \cdot (1-\exp(-\frac{t}{\tau}))^\beta

In this equation, \beta, A, and \tau are constants, while Po and f are inputs to the system, and y(t) is the output. My goal is to simulate the dynamic behavior of this system for any step input, particularly focusing on accurately capturing the nonlinear characteristics defined by the power \beta and the interaction between Po and f.

Current Solution in Xcos:

To tackle this challenge, I’ve constructed an Xcos model that attempts to faithfully represent the dynamics of the described system. Here’s an overview of my model’s construction:

  1. Input Scaling: I’ve employed TK Scale blocks to adjust the values of Po and f dynamically, providing a way to simulate different input conditions.

  2. Step Input and Conditional Logic: To generate a step input that only activates when Po is positive, I’ve used an EXPRESSION block with the logic ((u1>0)*u2), where u1 represents Po and u2 is a constant 1, simulating the step signal.

  3. Transfer Function Modeling: The linear part of the system, (1-\exp(-\frac{t}{\tau})), is modeled using a CLR block configured as \frac{1}{\tau s + 1}, representing the transfer function H(s).

  4. Nonlinear Exponentiation: The output from the CLR block is fed into a POWBLK_f, which raises the signal to the power of \beta, adding the necessary nonlinearity to the model.

  5. Multiplication and Inversion: This signal is then multiplied by Po and an inverted f, followed by multiplication by A, to simulate the \frac{Po}{f} \cdot A part of the step response function.

  6. Summation with Initial Condition: Finally, the resulting signal is summed with y(0) to complete the model, aligning with the specified step response function.

Challenges and Considerations:

  • The use of an EXPRESSION block for conditional step input generation, while effective, raises concerns about model complexity and readability. I am looking for alternative approaches that might simplify the implementation without compromising the dynamic response accuracy.

  • Ensuring the model’s behavior aligns with the theoretical step response function, especially under varying input conditions and the nonlinear dynamics introduced by the power \beta.

Seeking Insights:

I am reaching out to the Scilab community for insights, suggestions, or validation of the approach I’ve taken. My experience with modeling such systems in Xcos is limited, and I would greatly appreciate any advice, especially on simplifying the model or alternative methods to accurately capture the system’s nonlinear dynamics. Are there more efficient ways to simulate the conditional step input and the interaction between Po and f while maintaining the system’s nonlinear characteristics?

Thank you in advance for your time and expertise!

Set Context

Te = 18
Pmax = 27000
Pomax = 135
rho = 998
c = 4187
tau=0.24
beta=60
f = 8
Po = 135
A = 60000*Pmax/(Pomax*rho*c)

Set Parameters
Final integration time 3.0E2
Solver kind Sundials/CVODE - ADAMS - FUNCTIONAL

XCOS Model

  • Superblock

  • ZCOS File

Stepresponse_Model.zcos (7.8 KB)

  • ** Scope Output **

Hello,

Thanks for this precise description of your problem. However, considering your Xcos diagram, your formula for y(t) as a closed form of t is not general because you are hiding the input of the linear system. Moreover, using a step source in the diagram is useless as you are starting the simulation with P_0=0. A better mathematical representation would be the following ode with P_0 as input

\begin{align*} z'&=-\frac{1}{\tau}z+\frac{1}{\tau}\operatorname{sign}(P_0),\\ z(0) &=0,\\ \end{align*}

with the output equation

y=A\frac{P_0}{f}z^\beta.

What creates the actual positive step inputs is your action on the TK scale when P_0 switches from 0 to a positive value. You don’t see the continuous decrease of the internal state when switching P_0 back to 0 because as a factor in y it zeroes the output.

S.

I will look in to it! Thank you for your support and insightful feedback on this forum. It fuels my enthusiasm and dedication to continue contributing and working with Scilab!

image

Hello @mottelet, thanks to your support, I’ve developed a solution, but it seems I might be missing something. The output of the superblock (y(t)) (represented by the red line) does not seem to respond to the input (P_o) (from the signal builder, shown as the dark blue line) and the TK Scale Input (f) (the green line). I’ve attached some screenshots for clarification. This issue led me to use the Expression Block initially. Does that make sense to you?
The in- and decreasing of the exponential function is missing.

Model the step response function y(t) = y_0 +\frac{P_o}{f} \cdot A \cdot z(t)^\beta
\frac{d z}{d t} = -\frac{1}{\tau} z(t) + \frac{1}{\tau}\text{sign}(P_0)
z(0) = 0
z(t) = 1- e^{-t/\tau}

Hello,

You are making things very complicated. The following ode (I simpified the output for clarity here) with P_0 as input

\begin{align*} z'&=-\frac{1}{\tau}z+\frac{1}{\tau}\operatorname{sign}(P_0),\\ z(0) &=0,\\ \end{align*}

and the output equation

y=P_0z^\beta.

can be still be built into Xcos by using the transfer function block \frac{1}{1+\tau s} you already used:

tmp.zcos (4.3 KB)

Dear @mottelet and @davidcl ,

Thank you very much for your input.

I’m looking to simulate the behavior of my system with various input signals, ideally over an indefinite simulation time period. Stephane has already assisted me by using a Pulse Block. However, when I switch this block out for a signal generator or create a Workspace Variable, the output signal doesn’t exhibit the expected exponential increase, even if the Pulse Block is simulated with the external variable or the Signal Generator Block. The signal from the sign Block appears to be correct.

Could you assist me? I find myself somewhat stuck.

Best regards,

Output of SIGN

transfer_signum.zcos (4.5 KB)