Skip to content

Piston equivalents

Deyan Dobromirov edited this page Jul 21, 2020 · 3 revisions

Description

For example, the Expression2 snippets below are equivalent and are also presented how they are used in E2 Chip here with a top piston configuration of 55.306 degrees as a number and vector internals. The value of Shaft:cnvPistonMark() as VBER is actually the same angle but represented as a local vector relative to the crankshaft, which is later converted to one relative to the Base entity for efficiency ( Otherwise all the top piston vectors must be converted to the Shaft or all to be converted to world-space rather than local ). The value Base is the base prop of your engine that your crankshaft is constrained to via an axis and Shaft is the entity based on which the bearing is calculated. Whatever bearing data type you prefer to represent the bearing either number or vector it is due to a way of preference. The piston configuration properties are described below with a tutorial on how to create a piston, define bearing and use it as needed. The execution speed scaled 1..10:

When using bearing data as a number

Sign timing (1) Mode = 1

Initialization:

Shaft:setPistonSign(1, 55.306)

Usage:

BER = Chip:bearing(GPS)
Shaft:getPiston(1, BER)
Shaft:getPiston(2, BER)
Shaft:getPiston(N, BER)

Wave timing (10) Mode = 2

Initialization:

Shaft:setPistonWave(1, 55.306)

Usage:

BER = Chip:bearing(GPS)
Shaft:getPiston(1, BER)
Shaft:getPiston(2, BER)
Shaft:getPiston(N, BER)

Symmetrical triangular ramp timing (3) Mode = 5

Initialization:

Shaft:setPistonRamp(1, 55.306)

Usage:

BER = Chip:bearing(GPS)
Shaft:getPiston(1, BER)
Shaft:getPiston(2, BER)
Shaft:getPiston(N, BER)

When using bearing data as a vector

Cross product sign timing (6) Mode = 4

Initialization:

Shaft = entity()
setPistonBase(Shaft:isConstrainedTo("axis"))
setPistonAxis(0.601048110939, -0.79921284295, 0)
setPistonMark(0,0,1)
Shaft:setPistonSignX(1, vec(0,1,0))

Usage:

BER = Shaft:cnvPistonMark()
Shaft:getPiston(1, BER)
Shaft:getPiston(2, BER)
Shaft:getPiston(N, BER)

Cross product wave timing (5) Mode = 3

Initialization:

Shaft = entity()
setPistonBase(Shaft:isConstrainedTo("axis"))
setPistonAxis(0.601048110939, -0.79921284295, 0)
setPistonMark(0,0,1)
Shaft:setPistonSignX(1, vec(0,1,0))

Usage:

BER = Shaft:cnvPistonMark()
Shaft:getPiston(1, BER)
Shaft:getPiston(2, BER)
Shaft:getPiston(N, BER)