# Pforce

Model ElementPforce defined in a MotionSolve expression.

## Class Name

Pforce

## Description

The generalized force acts on all the coordinates involved in the definition of the constraint.

Pforce is available in three different implementations.

## Attribute Summary

Name | Property | Modifiable by command? | Designable? |
---|---|---|---|

id | Int () | ||

label | Str () | Yes | |

penalty | Double () | Yes | FD Only |

penalty1 | Double () | Yes | FD Only |

unilateral | Bool () | Yes | |

smoothing_factor | Double () | Yes | FD Only |

function | Function ("PFOSUB") | Yes | |

routine | Routine () | ||

active | Bool () | Yes |

## Usage

```
#1. Constraint defined in a MotionSolve expression
Pforce (function=expressionString, penalty=double, optional_attributes)
#2. Constraint defined in a compiled DLL
Pforce (function= userString, penalty=double, routine=string, optional_attributes)
#3. Constraint defined in a Python/Matlab script
Pforce (function= userString, penalty=double, routine=functionPointer, optional_attributes)
```

## Attributes

`function`- String defining a valid MotionSolve expression.
`penalty`- Double

`function`- String defining a valid user function MotionSolve expression.
`penalty`- Double
`routine`- String

`function`- String defining a valid user function MotionSolve expression.
`penalty`- Double
`routine`- Pointer to a callable function in Python.

`id`- Integer
`label`- String
`penalty1`- Double
`unilateral`- Boolean
`smoothing_factor`- Double
`active`- Bool

## Example

- Particle sliding on a catenary.XML Syntax
`<Force_Penalty id = "1" label = "Particle on a catenary" type = "Expression" expr = "dy (9) - cosh(dx(9))" penalty = "1E4" penalty1 = "1E2" />`

Python Syntax`pf1 = Pforce (label="particle sliding on a catenary", function= "dy(9)-cosh(dx(9))", penalty=1e4, penalty1=1e2)`

- Enforce movement of a point P such that it moves in the region
1+x < = yXML Syntax
`<Force_Penalty id = "10" label = "Enforce 1+x < y" type = "EXPRESSION" expr = "1 + dx(10) - dy(10)" penalty = "1E4" penalty1 = "1E2" unilateral = "True" smoothing_factor = "1.0" />`

Python Syntax`pf2 = Pforce (label="Enforce 1+x < = y", function="1+dx(10)-dy(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1)`

- Enforce movement of a point P such that it moves in the region
1+x < = z and 1-x ≤
zXML Syntax
`<Force_Penalty id = "1" label = "Enforce 1+x <=z" type = "EXPRESSION" expr = "1+dx(10)-dz(10)" penalty = "1E4" penalty1 = "1E2" unilateral = "True" smoothing_factor = "1.0" />`

`<Force_Penalty id = "2" label = "Enforce 1-x <=z" type = "EXPRESSION" expr = "1-dx(10)-dz(10)" penalty = "1E4" penalty1 = "1E2" unilateral = "True" smoothing_factor = "1.0" />`

Python Syntax`pf3 = Pforce (label="Enforce 1+x < = z", function="1+dx(10)-dz(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1) pf4 = Pforce (label="Enforce 1-x < = z", function="1-dx(10)-dz(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1)`

## Comments

- See Properties for an explanation about what properties are, why they are used, and how you can extend these.
- For a more detailed explanation about Pforce, see Force: Penalty.