﻿ 20-sim webhelp > Language Reference > Functions > Port > direct

# direct

## Syntax

y = direct(p.e);

y = direct(p.f);

(with p.e and p.f powerportvariables)

## Description

This function is equal to the collect function, but utilizes the direction of the bonds connected to the submodel to sign the powerportvariables. This function is created specially for the bond graph submodels OneJunction.emx and ZeroJunction.emx. Try to avoid the use of this function!

## Examples

Suppose we have 4 bonds connected to a 0-junction, collected in a port p. p1 and p4 are pointing towards the junction and p2 and p3 are pointing from the 0-junction. We could then use the equation:

Y = direct(p.f);

During processing, this equation will be rewritten as:

Y = [p.f1;-p.f2;-p.f3,p.f4];

Which can of course be used in combination with the sum function:

sum(Y) = 0;

To get the 0-junction equation:

p.f1 - p.f2 - p.f3 + p.f4 = 0;

## Limitations

This function is designed for a special class of models and should be used by experienced users only! The function is only valid when used in a submodel.