# Model

Let’s consider a pneumatic system, which consists of a flat tire and an air compressor to inflate it. The system can be modeled as follows:

: is the compressor’s pneumatic resistance.

: models the tire’s capacitance

: models the losses due to the puncture.

To develop a hybrid model I chose the following variables:

: stands for the manometric pressure in the tire.

: stands for the state of the compressor (‘on’ or ‘off’).

The compressor turns on if the pressure falls below and it turns off when the pressure inside the tire reaches . Between this two limits the pressure flows according to the following equation:

This equation was obtained under the following assumptions:

• The variation of the tire’s volume is negligible, then tire’s capacitance is constant.

• The compressor is a constant pressure source of value

• The pressure never exceeds the limits or

The hybrid model is then defined by:

# Simulation

The Matlab code written to simulate the system using HyEQ Toolbox is presented below. The values of the parameters were chosen in order to obtain results that could be quickly visualized, but they must be changed for more appropiate values.

### C.m

function inC = C(x) %check if in C p = x(1); eps = 0.12; pmin = 8; pmax = 11; if (p>=pmin+eps && p<=pmax-eps) || p>=pmax+eps inC = 1; else inC = 0; end end

### D.m

function inD = D(x) %check if in D p = x(1); eps = 0.12; eps = 0.12; pmin = 8; pmax = 11; if (p<=pmin+eps && p>=pmin-eps ) || (p<=pmax+eps && p>=pmax-eps ) inD = 1; else inD = 0; end end

### f.m

function xdot = f(x) %flow map p = x(1); q = x(2); if q == 1 %pdot=-(Rc+Rp)/(Rc*Rp*Cc)*p+psource/(Cc*Rc) pdot = -0.2*p+0.3*7.5; else %pdot=-Cc/Rp*p pdot = -0.1*p; end qdot = 0; xdot = [pdot qdot]'; end

### g.m

function xplus = g(x) % jump map p = x(1); q = x(2); pmin = 8; pmax = 11; eps = 0.12; if p<=pmax+eps && p>=pmax-eps qplus = 0; pplus = pmax-eps; elseif p<=pmin+eps && p>=pmin-eps qplus = 1; pplus = pmin+eps; end xplus = [pplus qplus]'; end

What file did you use to run and plot the system?

You can easily adapt the file run.m that comes with the simulator distribution files (or grab it from any example).

I think the flow set, jump set, and jump map could be simplified by taking into account the state variable q.

How about, defining the flow and jump set as:

C := \{ x\in R^2 | q=1, p=p_{min}\}

D := \{ x\in R^2 | q=1, p>=p_{max}\} \cup \{ x\in R^2 | q=0, p<=p_{min}\}

and

g(x) = [p,1-q]

?

Also, the variable \epsilon could be eliminated by doing this.

Sorry to randomly ask this on an entry but I didn’t know where else to post it and I don’t know how to contact the authors of the blog, so:

If we have a process that repeats cyclically with a switching period T and the switching pattern is dependent upon that period and also the cycle index n, how do we “insert” these parameters into our model using HyEQ Toolbox? How do you model a “cycle counter” or even a timer? What section of the system (C,D,f,g) would be appropriate for that?

Thank you in advance and again, I apologise for posting this question on a random blog entry