24小时热门版块排行榜    

查看: 527  |  回复: 1

amberpei2010

银虫 (小有名气)

[求助] 关于UDF编程某个语句含义的小问题,求大神指点

这是一个定义了0-20us以恒定速度变化至1.5um位置并在50us内保持静止位置不变,在接下来的30us内匀速下降【整个过程是一个梯形波。。。】我的重点是。。。
if(((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)<=0.000020&&((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)>0 ) 这一句根据前后理解应该是描述横轴t的,但是为什么要这么除以0.001乘0.001,而且ttime+deltat减去自己取整到底是什么意思啊?求高手指点!
#include <stdio.h>
#include "udf.h"
DEFINE_CG_MOTION(move1, dt, cg_vel, cg_omega, time, dtime)
{
  real loc=0.0;
  real velo=0.0;
  real ttime=0.0;
  real deltat=0.0;
  / * reset velocities * /
  NV_S (cg_vel, =, 0.0 ) ;
  NV_S (cg_omega, =, 0.0 ) ;
if (!Data_Valid_P ())
    return;
  ttime=time;
  deltat=dtime;
    if(((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)<=0.000020&&((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)>0 )
    {
                velo = 0.0000015/0.000020;
                loc += velo * dtime;
                }
    if(((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)<=0.000070&&((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)>0.000020 )
        {
                velo = 0.0;

        }
          if(((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)<=0.0001 &&((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)>0.000070 )
    {
                velo = (-1)*0.0000015/0.000030;
                loc += velo * dtime;

        }
        if(((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)<=0.001&&((ttime+deltat)-(int)((ttime+deltat)/0.001)*0.001)>0.0001 )
        {
                velo = 0.0;
        }
cg_vel[0] = velo;
}
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

amberpei2010

银虫 (小有名气)

2楼2014-01-08 10:47:23
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 amberpei2010 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 0854电子信息求调剂 +6 α____ 2026-03-22 7/350 2026-03-24 19:46 by sunjie8888
[考研] 070300化学求调剂 +9 苑豆豆 2026-03-20 9/450 2026-03-24 17:15 by licg0208
[考研] 277分求调剂,跨调材料 +3 考研调剂lxh 2026-03-24 3/150 2026-03-24 13:52 by JourneyLucky
[考研] 材料与化工328分调剂 +4 。,。,。,。i 2026-03-23 4/200 2026-03-24 11:03 by 544594351
[考博] 26申博自荐 +3 whh869393 2026-03-24 3/150 2026-03-24 09:55 by 21018060
[考研] 341求调剂(一志愿湖南大学070300) +5 番茄头--- 2026-03-22 6/300 2026-03-23 23:45 by Txy@872106
[论文投稿] 急发核心期刊论文 +3 贤达问津 2026-03-23 5/250 2026-03-23 17:13 by 妹子不好惹
[考研] 接收2026硕士调剂(学硕+专硕) +4 allen-yin 2026-03-23 6/300 2026-03-23 15:04 by 汪!?!
[考研] 276求调剂 +3 YNRYG 2026-03-21 4/200 2026-03-23 08:31 by 醉在风里
[考研] 311求调剂 +3 26研0 2026-03-20 3/150 2026-03-22 14:46 by ColorlessPI
[考研] 初试 317 +7 半拉月丙 2026-03-20 7/350 2026-03-21 22:26 by peike
[考研] 考研调剂 +3 呼呼?~+123456 2026-03-21 3/150 2026-03-21 20:04 by 无际的草原
[考研] 求调剂 +3 13341 2026-03-20 3/150 2026-03-21 18:28 by 学员8dgXkO
[考研] 296求调剂 +4 www_q 2026-03-20 4/200 2026-03-21 17:26 by 学员8dgXkO
[考研] 330求调剂0854 +3 assdll 2026-03-21 3/150 2026-03-21 13:01 by 搏击518
[考研] 华东师范大学-071000生物学-293分-求调剂 +3 研究生何瑶明 2026-03-18 3/150 2026-03-21 01:30 by JourneyLucky
[考研] 一志愿华中科技大学,080502,354分求调剂 +5 守候夕阳CF 2026-03-18 5/250 2026-03-21 01:06 by JourneyLucky
[考研] 一志愿 南京航空航天大学大学 ,080500材料科学与工程学硕 +5 @taotao 2026-03-20 5/250 2026-03-20 20:16 by JourneyLucky
[考研] 0856调剂,是学校就去 +8 sllhht 2026-03-19 9/450 2026-03-20 14:25 by 无懈可击111
[考研] 085410人工智能专硕317求调剂(0854都可以) +4 xbxudjdn 2026-03-18 4/200 2026-03-20 09:07 by 不168
信息提示
请填处理意见