# Programming a duty cycle in CFX

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 October 2, 2013, 17:17 Programming a duty cycle in CFX #1 New Member   Anon Join Date: Oct 2013 Posts: 5 Rep Power: 6 Ok, I'm guessing this is probably a simple thing to implement, but I've spent all morning searching and can only jury rig a solution so far. How do I use a loop or create and expression to turn a boundary condition on and off for 10, 20, 30...% of the time. Right now, I'm using a simple if statement to create the cycle: .6253 [V] - if(atstep >(DutyCyclePercentage*.8[s]/10)/TimestepSize, .6253 [V], 0 [V]) +if(atstep > 8[s]/TimestepSize,.6253[V],0[V])- if(atstep >(8[s]+DutyCyclePercentage*.8[s]/10)/TimestepSize, .6253 [V], 0 [V]) + if(atstep >16[s]/TimestepSize,.6253[V],0[V])-..... but I basically have to repeat this over and over for the length of my simulation. How do I simplify this with a loop? I can't find the syntax.

 October 2, 2013, 18:10 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 14,214 Rep Power: 110 Use the mod function to work out where in the current cycle you are. Then do a single if statement on that value to get a repeating duty cycle signal.

 October 2, 2013, 18:34 #3 New Member   Anon Join Date: Oct 2013 Posts: 5 Rep Power: 6 Ah, so simple. Yeah thanks. if(mod(atstep,cyclelength),true,false)

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Jade M CFX 14 June 15, 2016 09:36 Joseph CFX 14 April 20, 2010 15:45 AirS OpenFOAM 0 January 12, 2010 08:08 Atit Koonsrisuk CFX 4 July 26, 2006 11:59 Pandu Sattvika CFX 1 December 1, 2001 05:07

All times are GMT -4. The time now is 16:13.

 Contact Us - CFD Online - Privacy Statement - Top