|
[Sponsors] |
October 2, 2013, 17:17 |
Programming a duty cycle in CFX
|
#1 |
New Member
Anon
Join Date: Oct 2013
Posts: 5
Rep Power: 12 |
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: 17,703
Rep Power: 143 |
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: 12 |
Ah, so simple. Yeah thanks.
if(mod(atstep,cyclelength),true,false) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFX Treatment of Laminar and Turbulent Flows | Jade M | CFX | 18 | September 15, 2022 07:08 |
ATTENTION! Reliability problems in CFX 5.7 | Joseph | CFX | 14 | April 20, 2010 15:45 |
Different flow pattern between OpenFOAM and CFX | AirS | OpenFOAM | 0 | January 12, 2010 07:08 |
CFX 10's solutions differ from CFX 5.7's | Atit Koonsrisuk | CFX | 4 | July 26, 2006 11:59 |
CFX 4.4 installation problem | Pandu Sattvika | CFX | 1 | December 1, 2001 04:07 |