﻿ 20-sim webhelp > Language Reference > Statements > flowincausality

# flowincausality

## Syntax

flowincausality (portname) then

equation;

equation;

...

else

equation;

equation;

...

end;

## Description

The effortincausality statement evaluates if a port has causality flow in and performs the first set of equation(s) if the condition is true and the second set of equation(s) if the condition is false. If the condition is true, 20-sim ignores the second set of equation(s). If the condition is false, 20-sim ignores the first set of equation(s).

Depending on the domain you are working in, effort and flow correspond to particular variables. The table below shows the variables for the domains that are currently supported in 20-sim.

 Domain effort (e) flow (f) power effort e flow f mechanical (translation) force F [N] velocity v [m/s] mechanical (rotation) torque T [Nm] angular velocity omega [rad/s] pneumatic pressure p [Pa] volume flow phi [m3/s] thermal temperature T [K] entropy flow dS [J/Ks] electric voltage u [V] current i [A] hydraulic pressure p [Pa] volume flow phi [m3/s] magnetic current i [A] voltage u [V] pseudothermal temperature T [K] heat flow dQ [W]

## Examples

flowincausality p then

R = if p.i > 0 then Ron else Roff end; // executed if causality of port p is flow (i) in

else

R = if p.u > 0 then Ron else Roff end; // executed if causality of port p is effort (u) in

end;

p.u = p.i*R;

## Note

 1 Take care when using event functions in effortincausality statements. In this statement only the equations of the true parts are evaluated, so event functions may not always be triggered!
 2 There is also an effortincausality statement.
 3 Equations within an effortincausality have to be written in the correct order of execution, i.e. they are not rewritten into a causal form but executed sequentially.