For Programmers: Free Programming Magazines  


Home > Archive > Matlab > January 2008 > help on sf_electrohydraulic.mdl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help on sf_electrohydraulic.mdl
tippana

2008-01-17, 8:23 am

hi everyone i am actually learning simulink and stateflow
and i came across the electrohydraulic servo model
(http://www.mathworks.com/products/d...eflow/sf_electr
ohydraulic.html) which
uses a pwm solenoid control but can anyone tell me how to
tune the solenoid response i mean the solenoid current
waveform is pulsed every 20 ms how can one tune it to
increase the timing for more real actuators . also can
anyone tell me how the data has been fed to the model and
how does it work i mean where all the calculation equations
loctaed or atleast from where is the necessary data
supplied to start the simulation

thanks howard for the suggestion

hrh1818

2008-01-17, 7:25 pm

On Jan 17, 5:37 am, "tippana " <sranth3...@gmail.com> wrote:
> hi everyone i am actually learning simulink and stateflow
> and i came across the electrohydraulic servo model
> (http://www.mathworks.com/products/d...eflow/sf_electr
> ohydraulic.html) which
> uses a pwm solenoid control but can anyone tell me how to
> tune the solenoid response i mean the solenoid current
> waveform is pulsed every 20 ms how can one tune it to
> increase the timing for more real actuators . also can
> anyone tell me how the data has been fed to the model and
> how does it work i mean where all the calculation equations
> loctaed or atleast from where is the necessary data
> supplied to start the simulation
>
> thanks howard for the suggestion


I couldn't get your link to work. However, performing a search at
Mathwork's Web Site on the word electrohydraulic produce a page that
had links to the following two articles.

MATLAB Digest - March 1998 - Electrohydraulic Servo Control
=2E.. Newsletters - MATLAB Digest Electrohydraulic Servo Control Summary
In this example we develop a Simulink=AE model for a hydraulic
servomechanism controlled by a pulse-width

Stateflow - Electrohydraulic
=2E.. Blue color indicates block is clickable Simulation Stateflow Block
Animation Info Exit Electrohydraulic Servomechanism A hydraulic servo
is controlled by a PWM solenoid. ...

The first link is to an article that shows how the Simulink model was
developed and the second link is a demo for the model.

Instead of the word tune the following is a better way to think about
why a PWM, pulse width modulation, signal is used to drive the
solenoid in Mathworks model. Pulse width modulation here means the
width of the current pulse applied to the solenoid is proportional to
the difference between the input signal and the output signal. With a
small error signal a very narrow current pulse is applied to the
solenoid. With a large error signal a wide current pulse is applied
to the solenoid. In the system in the Mathworks article when a
current pulse is applied to the solenoid there will be flow to and a
force applied to the piston thereby compressing the spring. When the
amplitude of the current pulse applied to the solenoid goes to zero
there will be flow away from the piston and no hydraulic force applied
to the piston. This means the spring pushes the piston in the
opposite direction of when a current pulse is present. The hydraulic
force applied to the piston is proportional to the duty cycle of the
pulses applied to the solenoid valve. Duty cycle is defined as the
ratio of on time/(off time + on time). In the Mathworks article the
value of the sum of (off time + on Time) =3D 20 milliseconds. Which is
one period of a 50 Hz sine wave. There is nothing magic about 20
milliseconds. Within reason you could use either a shorter or longer
period.
However, notice this is a bang-bang type of system and depends upon
the load on the piston having a large time constant relative to the
duty cycle's period. The inertia of the load on the piston must
smooth out the large variations in force applied to the piston.

With regard to your questions "how the data has been fed to the model
and how does it work i mean where all the calculation equations
loctaed or atleast from where is the necessary data supplied to start
the simulation". I strongly suspect the live demo is not a working
Simulink model It instead shows images of the blocks in the Simulink
model and the output you seen when you click on "Simulation' is just a
playback of the output taken when the actual Simulink simulation was
run.
The first article listed above provides the details on how the
simulation model was built. I suggest you build a Simulink model
based on the information supplied in the article. Building your own
Simulink model will go a long way towards helping you understand how
the model works.

Howard
tippana

2008-01-18, 7:26 pm

well thanks for the reply i did infactgo through the theory
mentioned and i am currently building a new model. but what
i still cannot understand that how can i control the rise
time or Ton. so thats why i had asked about how i could
change this 50 hz pulse signal. what i want o tknow is in
the original model ho is this pulse being generated every
20 ms. the rest of the equations and the stateflow logic is
clear.
regarding the model i actually have measured the current
graph of a solenoid controlled by pwm and here what i find
is that normally such fast actuators can damage system.the
solenoid current i measured reaches its maximum level in
atleast 8 -10 sec then the value of the resistance makes it
stay for 5 sec and then we switch over to hold current so
in actual the Ton is normally of the order 15-20 sec at
maximum current and then pwm for 20 sec. so the fastest
magnetic solenoid application is in paper management system
where these solenoids work at 72000 cycles per sec or with
a pulse period of 72 msec out of which ton is 30 sec. i got
the data from kendrion thoma magnet so what i want to know
is if we are implementing any pwm solenoid control
practically we cannot have the current rising to 2.5A in
just 3sec as shown by the simulation curve but as verified
it takes atleast 8-10 ms . i also think u are right about
the model not working. anyways it does not matter so how
can i control or change the pulse period because i want o
run several simulations to test the current rise graph.
i also apologize if u think i am still foolish and i cannot
getthe correct point but according to my understanding this
is what i have found out and understood
thanks

hrh1818 <hrhan@att.net> wrote in message <c6317249-8f44-
4f00-a2ab-c5b8948008b2@s19g2000prg.googlegroups.com>...
> On Jan 17, 5:37 am, "tippana " <sranth3...@gmail.com>

wrote:
stateflow[color=darkred]
(http://www.mathworks.com/products/d...eflow/sf_electr[color=darkred]
to[color=darkred]
and[color=darkred]
equations[color=darkred]
>
> I couldn't get your link to work. However, performing a

search at
> Mathwork's Web Site on the word electrohydraulic produce

a page that
> had links to the following two articles.
>
> MATLAB Digest - March 1998 - Electrohydraulic Servo

Control
> =2E.. Newsletters - MATLAB Digest Electrohydraulic Servo

Control Summary
> In this example we develop a Simulink=AE model for a

hydraulic
> servomechanism controlled by a pulse-width
>
> Stateflow - Electrohydraulic
> =2E.. Blue color indicates block is clickable Simulation

Stateflow Block
> Animation Info Exit Electrohydraulic Servomechanism A

hydraulic servo
> is controlled by a PWM solenoid. ...
>
> The first link is to an article that shows how the

Simulink model was
> developed and the second link is a demo for the model.
>
> Instead of the word tune the following is a better way to

think about
> why a PWM, pulse width modulation, signal is used to

drive the
> solenoid in Mathworks model. Pulse width modulation here

means the
> width of the current pulse applied to the solenoid is

proportional to
> the difference between the input signal and the output

signal. With a
> small error signal a very narrow current pulse is applied

to the
> solenoid. With a large error signal a wide current pulse

is applied
> to the solenoid. In the system in the Mathworks article

when a
> current pulse is applied to the solenoid there will be

flow to and a
> force applied to the piston thereby compressing the

spring. When the
> amplitude of the current pulse applied to the solenoid

goes to zero
> there will be flow away from the piston and no hydraulic

force applied
> to the piston. This means the spring pushes the piston

in the
> opposite direction of when a current pulse is present.

The hydraulic
> force applied to the piston is proportional to the duty

cycle of the
> pulses applied to the solenoid valve. Duty cycle is

defined as the
> ratio of on time/(off time + on time). In the Mathworks

article the
> value of the sum of (off time + on Time) =3D 20

milliseconds. Which is
> one period of a 50 Hz sine wave. There is nothing magic

about 20
> milliseconds. Within reason you could use either a

shorter or longer
> period.
> However, notice this is a bang-bang type of system and

depends upon
> the load on the piston having a large time constant

relative to the
> duty cycle's period. The inertia of the load on the

piston must
> smooth out the large variations in force applied to the

piston.
>
> With regard to your questions "how the data has been fed

to the model
> and how does it work i mean where all the calculation

equations
> loctaed or atleast from where is the necessary data

supplied to start
> the simulation". I strongly suspect the live demo is not

a working
> Simulink model It instead shows images of the blocks in

the Simulink
> model and the output you seen when you click

on "Simulation' is just a
> playback of the output taken when the actual Simulink

simulation was
> run.
> The first article listed above provides the details on

how the
> simulation model was built. I suggest you build a

Simulink model
> based on the information supplied in the article.

Building your own
> Simulink model will go a long way towards helping you

understand how
> the model works.
>
> Howard


hrh1818

2008-01-20, 7:26 pm

On Jan 18, 8:23 am, "tippana " <sranth3...@gmail.com> wrote:
> well thanks for the reply i did infactgo through the theory
> mentioned and i am currently building a new model. but what
> i still cannot understand that how can i control the rise
> time or Ton. so thats why i had asked about how i could
> change this 50 hz pulse signal. what i want o tknow is in
> the original model ho is this pulse being generated every
> 20 ms. the rest of the equations and the stateflow logic is
> clear.


The detailed Mathworks model uses the variable Tpwm to specify the
value of (On Time + Off Time) and in the Mathworks model Tpwm = 20
milliseconds. The value of Tpwm is set in a Matlab Command Window
with a Tpwm = 0.020; command and stored in the Matlab Workspace. See
Equation 8 in the Mathworks detailed model and the accompanying
discussion for the source of this statement. Notice in Equation 8 ton
and toff are the simulation times at which the solenoid valve is
turned on and off.

Equation 8 is repeated here for convenience. toff = ton +
duty_cycle*Tpwm/100;
The length of time the solenoid valve is on is equal to duty_cycle *
Tpwm/100.
For example if ton = 0.8 seconds at the beginning of a cycle,
duty_cycle = 40% and Tpwm = 0.02 then toff = 0.808 seconds.

During the solenoid valve's transition from the on state to the off
state the value of ton for starting the next cycle is updated. The
state chart uses " [t > toff] /ton += Tpwm: " line of code to
accomplish this.

Howard

> regarding the model i actually have measured the current
> graph of a solenoid controlled by pwm and here what i find
> is that normally such fast actuators can damage system.the
> solenoid current i measured reaches its maximum level in
> atleast 8 -10 sec then the value of the resistance makes it
> stay for 5 sec and then we switch over to hold current so
> in actual the Ton is normally of the order 15-20 sec at
> maximum current and then pwm for 20 sec. so the fastest
> magnetic solenoid application is in paper management system
> where these solenoids work at 72000 cycles per sec or with
> a pulse period of 72 msec out of which ton is 30 sec. i got
> the data from kendrion thoma magnet so what i want to know
> is if we are implementing any pwm solenoid control
> practically we cannot have the current rising to 2.5A in
> just 3sec as shown by the simulation curve but as verified
> it takes atleast 8-10 ms . i also think u are right about
> the model not working. anyways it does not matter so how
> can i control or change the pulse period because i want o
> run several simulations to test the current rise graph.
> i also apologize if u think i am still foolish and i cannot
> getthe correct point but according to my understanding this
> is what i have found out and understood
> thanks
>

tippana

2008-01-21, 5:09 am

hrh1818 <hrhan@att.net> wrote in message <457d6191-7fb6-
4781-a95a-34e22582a1c2@d70g2000hsb.googlegroups.com>...
> On Jan 18, 8:23 am, "tippana " <sranth3...@gmail.com>

wrote:
theory[color=darkred]
what[color=darkred]
rise[color=darkred]
in[color=darkred]
every[color=darkred]
logic is[color=darkred]
>
> The detailed Mathworks model uses the variable Tpwm to

specify the
> value of (On Time + Off Time) and in the Mathworks model

Tpwm = 20
> milliseconds. The value of Tpwm is set in a Matlab

Command Window
> with a Tpwm = 0.020; command and stored in the Matlab

Workspace. See
> Equation 8 in the Mathworks detailed model and the

accompanying
> discussion for the source of this statement. Notice in

Equation 8 ton
> and toff are the simulation times at which the solenoid

valve is
> turned on and off.
>
> Equation 8 is repeated here for convenience. toff

= ton +
> duty_cycle*Tpwm/100;
> The length of time the solenoid valve is on is equal to

duty_cycle *
> Tpwm/100.
> For example if ton = 0.8 seconds at the beginning of a

cycle,
> duty_cycle = 40% and Tpwm = 0.02 then toff = 0.808

seconds.
>
> During the solenoid valve's transition from the on state

to the off
> state the value of ton for starting the next cycle is

updated. The
> state chart uses " [t > toff] /ton += Tpwm: " line of

code to[color=darkred]
> accomplish this.
>
> Howard
>
find[color=darkred]
system.the[color=darkred]
makes it[color=darkred]
so[color=darkred]
system[color=darkred]
with[color=darkred]
got[color=darkred]
know[color=darkred]
verified[color=darkred]
about[color=darkred]
o[color=darkred]
cannot[color=darkred]
this[color=darkred]
well i had actually changed Tpwm parameter and there can be
nomore clearer explanati0on than yours one last doubt which
remains is the ascent of the magnetic curve to reach Ipull
is still within 3ms is there a way to control that because
such a thing is not possible. even though we can change the
Tpwm parymeter it only affects the cycl pulse time i also
experimented changing the magnetic data but it has no
affect ?ven with practical data in place . so does it mean
from the stateflow chart timin gis out of our control even
if we were to implement a time delay
thanks for the explanation
hrh1818

2008-01-21, 8:04 pm

On Jan 21, 2:09 am, "tippana " <sranth3...@gmail.com> wrote:
> hrh1818 <hr...@att.net> wrote in message <457d6191-7fb6-
>
> 4781-a95a-34e22582a...@d70g2000hsb.googlegroups.com>...
>
> wrote:
> theory
> what
> rise
> in
> every
> logic is
>
> specify the
> Tpwm = 20
> Command Window
> Workspace. See
> accompanying
> Equation 8 ton
> valve is
>
> = ton +
> duty_cycle *
> cycle,
> seconds.
>
> to the off
> updated. The
> code to
>
>
> find
> system.the
> makes it
> so
> system
> with
> got
> know
> verified
> about
> o
> cannot
> this
>
> well i had actually changed Tpwm parameter and there can be
> nomore clearer explanati0on than yours one last doubt which
> remains is the ascent of the magnetic curve to reach Ipull
> is still within 3ms is there a way to control that because
> such a thing is not possible. even though we can change the
> Tpwm parymeter it only affects the cycl pulse time i also
> experimented changing the magnetic data but it has no
> affect ?ven with practical data in place . so does it mean
> from the stateflow chart timin gis out of our control even
> if we were to implement a time delay
> thanks for the explanation


My first suggestion is you first try making a large increase in the
mass of the armature of the solenoid. A larger mass means a lower
acceleration and a longer closing time. In the meantime I will take a
look at the magnetic equations to see if anything can be changed
there. No guarantees. Otherwise I am completely mystified at to why
the solenoids you tested are taking seconds for the armature to close
and the Matlab's Simulink model shows milliseconds for closing time.

Howard.
tippana

2008-01-22, 8:57 am

i am sorry if there is was any confusion the practical data
as suggested is it takes at leats 10-12 ms to reach the
maximum current whereas the simulink model reaches it in
3ms no matter what variable you change. that swhy i had
suspected changing the pulse period to see if it affectsthe
rise time of the current
hrh1818

2008-01-22, 8:07 pm

On Jan 22, 8:29 am, "tippana " <sranth3...@gmail.com> wrote:
> i am sorry if there is was any confusion the practical data
> as suggested is it takes at leats 10-12 ms to reach the
> maximum current whereas the simulink model reaches it in
> 3ms no matter what variable you change. that swhy i had
> suspected changing the pulse period to see if it affectsthe
> rise time of the current


I got your E-Mail and from the data I can see why you want to change
the timing in the model at which pull-in occurs.
My suggestions for changing the timing at which pull-in occurs are:
1. Change the pull-in current set by the Hit Crossing block to 3 amps
from 2.5 amps.
2. If there is a variable that sets the number of turns for the
solenoid increase it by 100%. I say if because the figure for the
magnetic diagram is hard to read and I couldn't tell if this variable
appears in the diagram.
3. Increase the H value for the solenoid's core by 50%
4. Increase the spring constant for the solenoid's armature by 50%.
Increasing the spring constant means a larger current is required to
move the armature.
5. Increase the air gap length by 25%. Increasing the air gap length
means a larger current is required to pull in the armature.

Changes 2 and 3 are intended to increase the L/R ratio of the core
and there by increase the solenoid's pull-in time.
Changes 4 and 5 are intended to reduce the speed at which the armature
pulls in.

Howard

tippana

2008-01-23, 8:57 am

"tippana " <sranth3...@gmail.com> ,
hey thanks for the info i had infact tried it out by
changing Ipull to 3.5 A and also manipulated N no of
turns . what also cana ffect the ascent is changingn Vs the
voltage of the solenoid which when put to 10 V affects
response time of the controller generated duty cycle.
also it may be varied upto 16 V.
also are you aware of any example which i can study to
control these values from a gui instead of changing them
each time from the workspace mat file
thanks for the help it does work
hrh1818

2008-01-24, 8:01 pm

On Jan 23, 4:05 am, "tippana " <sranth3...@gmail.com> wrote:
> "tippana " <sranth3...@gmail.com> ,
> hey thanks for the info i had infact tried it out by
> changing Ipull to 3.5 A and also manipulated N no of
> turns . what also cana ffect the ascent is changingn Vs the
> voltage of the solenoid which when put to 10 V affects
> response time of the controller generated duty cycle.
> also it may be varied upto 16 V.
> also are you aware of any example which i can study to
> control these values from a gui instead of changing them
> each time from the workspace mat file
> thanks for the help it does work


I am guessing your question "control these variables from a GUI" means
you want to set a variable like ton in a Simulink model and pass the
value of the variable to a parameter inside a State Flow Chart. There
is a round about way of doing it. For example create a Simulink Model
with a Constant connected to a "To Workspace Block". Then in the
configuration pane for the "To Workspace Block" Set "To Workspace
Parameters" . "Variable Name" to your variable name, "Limit Data
Points to Last" to 1 and "Save Format" to Array. Set the Constant to
the value you want to pass and run the model.

Otherwise besides this Rube Goldberg I don't know of any method for
passing data to a variable inside a State Flow Chart from a GUI.

Howard
hrh1818

2008-01-24, 10:56 pm

On Jan 24, 5:12 pm, hrh1818 <hr...@att.net> wrote:
> On Jan 23, 4:05 am, "tippana " <sranth3...@gmail.com> wrote:
>
>
> I am guessing your question "control these variables from a GUI" means
> you want to set a variable like ton in a Simulink model and pass the
> value of the variable to a parameter inside a State Flow Chart. There
> is a round about way of doing it. For example create a Simulink Model
> with a Constant connected to a "To Workspace Block". Then in the
> configuration pane for the "To Workspace Block" Set "To Workspace
> Parameters" . "Variable Name" to your variable name, "Limit Data
> Points to Last" to 1 and "Save Format" to Array. Set the Constant to
> the value you want to pass and run the model.
>
> Otherwise besides this Rube Goldberg I don't know of any method for
> passing data to a variable inside a State Flow Chart from a GUI.
>
> Howard


Update I should have the variable Tpwm not ton.

Howard
tippana

2008-01-29, 5:30 am

well i guess this does work but what i also observe is that
th variable Tpwm is existing in the workspace and also it
can be configured through command prompt so can it not be
accessed through GUI and what about changing other
variables. do we use assignin() or some other function
thanks
hrh1818

2008-01-31, 8:28 pm

On Jan 29, 4:52 am, "tippana " <sranth3...@gmail.com> wrote:
> well i guess this does work but what i also observe is that
> th variable Tpwm is existing in the workspace and also it
> can be configured through command prompt so can it not be
> accessed through GUI and what about changing other
> variables. do we use assignin() or some other function
> thanks


I don't believe you can use assignin() to directly pass the value of a
variable to a Simulink model because I have never seen a separate name
given to the workspace for a Simulink model. If it helps you, you can
use assignin() to indirectly pass the value of a variable to a
Simulink model by using assignin() to pass the value of a variable to
the Matlab workspace. As far as I know you can only pass data to a a
variable in a Simulink model if the variable is unitialized. This also
means the variable has to be declared and assigned a value in the
Matlab workspace before the Simulink model will run. Simulink also
has a From Workspace Block. The From Workspace Block is used for
something different then assigning the value of a variable to a
variable. It is used for getting the values of input signals for a
Simulink model from the workspace.

Sometime after you run a Simulink model that uses the Stateflow
Toolbox use the the Workspace browser to look at the workspace to
see what variables are listed. You may find additional variables
listed there that can be initialized in the workspace before a model
runs.

If you have a bunch of variables you want to change between runs try
using a M-file. This should give you the least amount of typing when
making changes between runs.

Howard



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com