码迷,mamicode.com
首页 > Windows程序 > 详细

C# 50Hz陷波器实现类

时间:2017-09-02 11:22:59      阅读:279      评论:0      收藏:0      [点我收藏+]

标签:ora   block   nbsp   inpu   output   stat   void   str   rtu   

class bandStop50Hz    

{         // Block signals and states (auto storage) for system ‘<Root>‘        

public struct DW         {            

public double Delay11_DSTATE;               /* ‘<S1>/Delay11‘ */            

public double Delay21_DSTATE;               /* ‘<S1>/Delay21‘ */            

public double Delay12_DSTATE;               /* ‘<S1>/Delay12‘ */            

public double Delay22_DSTATE;               /* ‘<S1>/Delay22‘ */        

}

        //External inputs (root inport signals with auto storage)        

public struct ExtU        

{           public double Input;                        /* ‘<Root>/Input‘ */        

}

        /* External outputs (root outports fed by signals with auto storage) */        

public struct ExtY         {           public double Output;                        /* ‘<Root>/Output‘ */        

}

        /* Block signals and states (auto storage) */        

public DW rtDW;

        /* External inputs (root inport signals with auto storage) */        

public ExtU rtU;

        /* External outputs (root outports fed by signals with auto storage) */        

public ExtY rtY;

        public void bandstop50Hzat1k0_step()        

{           double rtb_Delay11;           double rtb_SumA31;           double rtb_Delay12;           double rtb_SumA32;

          /* Delay: ‘<S1>/Delay11‘ */           rtb_Delay11 = rtDW.Delay11_DSTATE;

          /* Sum: ‘<S1>/SumA31‘ incorporates:            *  Delay: ‘<S1>/Delay11‘            *  Delay: ‘<S1>/Delay21‘            *  Gain: ‘<S1>/a(2)(1)‘            *  Gain: ‘<S1>/a(3)(1)‘            *  Gain: ‘<S1>/s(1)‘            *  Inport: ‘<Root>/Input‘            *  Sum: ‘<S1>/SumA21‘            */          

rtb_SumA31 = (0.995566971680792 * rtU.Input - -1.8908514634621669 *                         rtDW.Delay11_DSTATE) - 0.991033147905415 * rtDW.Delay21_DSTATE;

          /* Delay: ‘<S1>/Delay12‘ */           rtb_Delay12 = rtDW.Delay12_DSTATE;

          /* Sum: ‘<S1>/SumA32‘ incorporates:            *  Delay: ‘<S1>/Delay11‘            *  Delay: ‘<S1>/Delay12‘            *  Delay: ‘<S1>/Delay21‘            *  Delay: ‘<S1>/Delay22‘            *  Gain: ‘<S1>/a(2)(2)‘            *  Gain: ‘<S1>/a(3)(2)‘            *  Gain: ‘<S1>/b(2)(1)‘            *  Gain: ‘<S1>/s(2)‘            *  Sum: ‘<S1>/SumA22‘            *  Sum: ‘<S1>/SumB21‘            *  Sum: ‘<S1>/SumB31‘            */          

rtb_SumA32 = (((-1.9021505794142433 * rtDW.Delay11_DSTATE + rtb_SumA31) +                          rtDW.Delay21_DSTATE) * 0.995566971680792 - -1.8965480696203423 *                         rtDW.Delay12_DSTATE) - 0.99127405848172945 * rtDW.Delay22_DSTATE;

          /* Outport: ‘<Root>/Output‘ incorporates:            *  Delay: ‘<S1>/Delay12‘            *  Delay: ‘<S1>/Delay22‘            *  Gain: ‘<S1>/b(2)(2)‘            *  Sum: ‘<S1>/SumB22‘            *  Sum: ‘<S1>/SumB32‘            */          

rtY.Output = (-1.9021505794142433 * rtDW.Delay12_DSTATE + rtb_SumA32) +             rtDW.Delay22_DSTATE;

          /* Update for Delay: ‘<S1>/Delay11‘ */          

rtDW.Delay11_DSTATE = rtb_SumA31;

          /* Update for Delay: ‘<S1>/Delay21‘ */          

rtDW.Delay21_DSTATE = rtb_Delay11;

          /* Update for Delay: ‘<S1>/Delay12‘ */          

rtDW.Delay12_DSTATE = rtb_SumA32;

          /* Update for Delay: ‘<S1>/Delay22‘ */          

rtDW.Delay22_DSTATE = rtb_Delay12;         }

public void initialize()        

{           rtDW.Delay11_DSTATE = 0.0;          

rtDW.Delay21_DSTATE = 0.0;          

rtDW.Delay12_DSTATE = 0.0;          

rtDW.Delay22_DSTATE = 0.0;

          rtU.Input = 0.0;          

rtY.Output = 0.0; //optional;        

}    

}

C# 50Hz陷波器实现类

标签:ora   block   nbsp   inpu   output   stat   void   str   rtu   

原文地址:http://www.cnblogs.com/xyzrobot/p/7465884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!