搜索
楼主: PEN

使用Python进行液压缸模拟

    [复制链接]
发表于 2019-4-14 17:52:14 | 显示全部楼层
本帖最后由 854619267 于 2019-4-14 18:22 编辑
PEN 发表于 2018-6-9 15:08
请不要编写与Python无关的主题和关于此主题的模拟。
我的帖子将按照承诺提供RMC项目。
http://deltamotio ...

                                 
回复 支持 反对

使用道具 举报

发表于 2019-4-14 18:33:05 | 显示全部楼层
854619267 发表于 2019-4-14 17:02
Mr.Pen, very tanks for your python code, but i only find P,PI,PID methods in closedloop class,exce ...

the lastest version include this code  
回复 支持 反对

使用道具 举报

  • 打卡等级:偶尔看看
  • 打卡总天数:101
  • 打卡总奖励:315
 楼主| 发表于 2019-4-15 00:24:57 | 显示全部楼层
我更新了hydsim-linear.zip
2019-04-19
https://deltamotion.com/peter/py/HydSim.zip
图形得到了很大改善。
我用这个程序制作图形来展示我在撰写杂志文章时所写的内容。
新程序生成.svg文件。
.svg表示可缩放的矢量图形。
.svg文件适合包含在网页和MS Word中,因为图形可以调整大小并且看起来仍然很好。

目标轨迹路径软件生成余弦斜坡。(tgcos)
有许多闭环选项。 有PIDFF。 这是P I D,速度和加速度前馈。

我现在有理由在这个项目上更多地工作,因为我会将它用于我的杂志文章。
回复 支持 反对

使用道具 举报

  • 打卡等级:无名新人
  • 打卡总天数:2
  • 打卡总奖励:3
发表于 2019-6-13 17:30:56 | 显示全部楼层
PEN 发表于 2019-4-15 00:24
我更新了hydsim-linear.zip
2019-04-19
https://deltamotion.com/peter/py/HydSim.zip

51#   #Initialize the gains and controller 初始化控制器增益
67#   #cl0 = control0.PIDFF   # select the control algorithm here在这里选择控制算法
38#   #create an instance of the Move Sine class         创建一个正弦运动实例
69#    # allocate and clear arrays       分配和清除数组
71#    # number of iterations 迭代次数

上面这几条不明白,请教: 如何更改控制器算法?如何让执行器做正弦运动?
回复 支持 反对

使用道具 举报

  • 打卡等级:偶尔看看
  • 打卡总天数:101
  • 打卡总奖励:315
 楼主| 发表于 2019-6-17 00:07:48 | 显示全部楼层
本帖最后由 PEN 于 2019-6-17 00:09 编辑

我改变了一些参数让你开始。
您可以在5个地方更改参数。
@ 1是开环增益,固有频率和阻尼系数改变的地方。
目前,固有频率为10 Hz,对于正弦波测试而言非常低。
@ 2是幅度,频率,相位和偏移的变化。
@ 3是控制器闭环增益改变的地方
@ 4是前馈增益改变的地方。
@ 5是控制算法改变的地方。 控制算法必须在“closedloop.py”中定义

https://deltamotion.com/peter/py/HydSim.zip

I changed some of the parameters for you to get you started.
There are 5 places where you can change parameters.
@1 is where open loop gain, natural frequency and damping factor is changed.
Currently the natural frequency is 10 Hz which is very low for testing with sine waves.
@2 is where amplitude, frequency, phase and offset are changed.
@3 is where controller closed loop gains are changed
@4 is where the feed forward gains are changed.
@5 is where the control algorithm is changed.  The control algorithm must be defined in “closedloop.py”

https://deltamotion.com/peter/py/HydSim.zip

HydSim.zip

9.28 KB, 下载次数: 32

回复 支持 反对

使用道具 举报

  • 打卡等级:无名新人
  • 打卡总天数:2
  • 打卡总奖励:8
发表于 2019-9-28 20:41:43 | 显示全部楼层
PEN 发表于 2018-4-9 01:34
我喜欢使用简单的开环线性模型进行仿真。
OLTF(s)= K *ω^2 /(s *(s^ 2+ s *ζ*ω* s+ω^2)
Python ...

Hi  Peter,

I noticed the three differential equation in your openloop simulation are:

1.  dPosition(t)/dt=v (last round)
2.  dVelocity(t)/dt=a (las round)
3.  dAcceleration(t)/dt=jerk= -c^2·v-2·ζ·ω·a+ω^2·K·control

yet I don't know where the third one comes from, if follow your post here
https://www.iyeya.cn/thread-60194-1-1.html


you said:

you use equation below:

x'+ 2 * zeta * omega * x'+ omega ^ 2 * x = A(t)

1. is the first x' translation mistake, should be x'' ?
2. I don't know the first term -c^2·v and the secon term -2·ζ·ω·a come from, could you please explain them in detail? Thanks.


回复 支持 反对

使用道具 举报

  • 打卡等级:偶尔看看
  • 打卡总天数:101
  • 打卡总奖励:315
 楼主| 发表于 2019-9-30 01:05:15 | 显示全部楼层
1.        You are correct.  I corrected the error above.
2.        I could not find dAcceleration in English on iyeya.cn.   I searched on Google. I also searched my own document.
I have a document where I keep track of what I write by topic URL.

1.你是对的。 我更正了上面的错误。
2.我在iyeya.cn上找不到英文的dAcceleration。 我在Google上搜索。 我还搜索了自己的文档。
我有一个文档,可以按主题URL跟踪编写的内容。

回复 支持 反对

使用道具 举报

  • 打卡等级:无名新人
  • 打卡总天数:2
  • 打卡总奖励:8
发表于 2019-9-30 12:29:11 | 显示全部楼层
PEN 发表于 2019-9-30 01:05
1.        You are correct.  I corrected the error above.
2.        I could not find dAcceleration in English on i ...

why I need to know how they come from is because I want to use the method to calculate ζ,the way you posted in here:
https://www.iyeya.cn/forum.php?mod=viewthread&tid=60194&page=1#pid474360


Then I modefied the py file you uploaded and made a model with

ζ = 0.333333
ω = 10*2*pi
K = 13.4815 mm/s/%


and I creat a openloop with control increasing from 0 to 30%, and increasing ratio is 300 %/second, finally I got curve and result below


30-300.png

jerk,control vs time

jerk,control vs time


Average velocity = 404.4436
Shock percent = 0.0730


then the model ζ was calculated,  0.6401, is far greater than the value I made this model.
So what's wrong with my code? thanks very much.
回复 支持 反对

使用道具 举报

  • 打卡等级:偶尔看看
  • 打卡总天数:101
  • 打卡总奖励:315
 楼主| 发表于 2019-10-1 22:56:15 | 显示全部楼层
本帖最后由 PEN 于 2019-10-1 22:59 编辑

您必须尝试通过测量过冲来计算阻尼系数。 除非控制输出立即更改,否则将无法正常工作。 在您的示例中,控制输出逐渐变化。

You must be trying to calculate the damping factor by measuring the overshoot.   That will not work unless the control output changes instantly.  In your example the control output changes gradually.
我修复了Python代码中的某些问题。 新代码在
https://deltamotion.com/peter/py/HydSim.zip


I fixed some things in the Python code.  New code is at
https://deltamotion.com/peter/py/HydSim.zip



回复 支持 反对

使用道具 举报

  • 打卡等级:无名新人
  • 打卡总天数:2
  • 打卡总奖励:8
发表于 2019-10-2 08:53:16 | 显示全部楼层
PEN 发表于 2019-10-1 22:56
您必须尝试通过测量过冲来计算阻尼系数。 除非控制输出立即更改,否则将无法正常工作。 在您的示例中,控制 ...

It works!!! Thank you Peter!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则