Skip to content

AcresImplementCoupling.h#

Acres/Source/Acres/AcresImplementCoupling.h Generated

Glue between the soil library (AcresSoilModel.h), the implement model (AcresImplementModel.h) and the places that drive it: the pawn (AcresVehicle.cpp), the menu's validation (AcresSession.cpp) and the optimizer (AcresOptimizer.cpp). Pure C++ in SI units, no Unreal types, so Tools/ImplementModel builds and tests it.

  • ImplementSoilFromLibrary: the FImplementSoil the implement sees, from a soil library class at a water content, density and surface wetness (the same state the tyres use).
  • ImplementLeverForDepth / ImplementDepthRangeM / ImplementDefaultControls: operator settings in physical terms (working depth in metres) turned into the model's controls (hitch lever, roller setting, hitch mode).
  • ApplyImplementValues: data-file keys (Content/Simulation/implements/<id>.json flattened to "block.key" and "block.key[i]") applied with SetImplementParameter, counts first.
  • ImplementSteadyState: the settled response at a constant speed, for the optimizer's draft and the tests.

TextureOfSoilClass#

ASABE D497.7 texture group of a soil library class, as FImplementSoil::Texture and ESoilTexture use it.

Argument Description
ClassIndex Soil library index (clamped).

Returns: 0 fine (silty clay loam, clay), 1 medium (loam, silt loam), 2 coarse (sand, loamy sand, sandy loam).

int TextureOfSoilClass(int ClassIndex);

ImplementSoilFromLibrary#

The soil under an implement from the soil library.

Evaluates SoilStateAt (moisture through suction stress and, for wet fines, undrained strength; density; surface wetness) and maps it field by field: cohesion and friction angle from the representative Mohr-Coulomb pair, dry bulk density, soil-metal adhesion and friction, cone index, water content, texture group, the Bekker moduli of the state and its Janosi modulus. The suction part of the cohesion is scaled by Se^(kappa - 1) with Vanapalli and Fredlund's (2000) plasticity-dependent kappa: a tool fails the fissured topsoil along its drained inter-aggregate pores, where less of the suction acts than under a tyre (see the .cpp). TilledModulusRatio is the bearing measure of the class at its loose density over that of the state, i.e. how much softer the tilth behind the tools is than the ground they work (clamped to 0.05..1).

Argument Description
ClassIndex Soil library index (AcresSoilModel.h ESoilClass).
Theta Volumetric water content, m3/m3.
DensityMgM3 Dry bulk density, Mg/m3 (<= 0 means the class's firm density).
SurfaceWetness Rain film 0..1 (lowers the soil-metal friction like the tyre's rubber friction).
RootCohesionPa Root reinforcement of a sod the tools cut (grass lane, verge), Pa; 0 on field soil.

Returns: The implement soil, SI.

FImplementSoil ImplementSoilFromLibrary(int ClassIndex, double Theta, double DensityMgM3, double SurfaceWetness = 0, double RootCohesionPa = 0);

Example

const FImplementSoil Soil = ImplementSoilFromLibrary(SoilClassSiltLoam, 0.28, 0, 0);

ImplementDepthRangeM#

Working-depth range an implement's own depth setting can reach on flat, firm ground, m.

Tines (cultivator, chisel plow): point depth at the lowest and highest hitch lift. Disc harrow: disc depth when it rides on its packer roller over the roller carrier's setting range. Other implements have no depth setting (the drill's openers run on spring arms, the sprayer carries no tools): 0..0.

Argument Description
P Implement parameters.
OutMinM Shallowest depth, m (0 when the range reaches above the ground).
OutMaxM Deepest depth, m.

Returns: True when the implement has a depth setting.

bool ImplementDepthRangeM(const FImplementParameters& P, double& OutMinM, double& OutMaxM);

ImplementControlsForDepth#

Hitch lever (tines) or roller setting (disc harrow) for a working depth on flat, firm ground.

Tines: the lift that puts the untripped points DepthM below the ground plane, as a lever 0..1 (the model's linear lever-to-lift map). Disc harrow: the roller setting, rad, at which the harrow resting on its roller runs its discs DepthM deep (roller sinkage ignored, so a soft seedbed runs a little deeper); the hitch then floats.

Argument Description
P Implement parameters.
DepthM Working depth, m (clamped to ImplementDepthRangeM).
Controls Receives HitchLever (tines) or RollerSettingRad (harrow); other fields untouched.
void ImplementControlsForDepth(const FImplementParameters& P, double DepthM, FImplementControls& Controls);

ImplementDefaultControls#

Default operator controls for an implement working in the field.

Tines: position control at the design depth, draft set-point 15 kN. Disc harrow and seed drill: float on the roller / ground wheels (harrow roller set for the design depth). Sprayer: lever 0.5 (boom carried), spraying off, boom unfolded, 0.5 m boom lift. Loader, backhoe: levers centred. Baler: pickup down, 3 kg/m windrow. Every implement starts raised (bRaise) with the PTO off; the operator lowers it.

Argument Description
P Implement parameters.

Returns: Controls to start from.

FImplementControls ImplementDefaultControls(const FImplementParameters& P);

ApplyImplementValues#

Applies data-file values with SetImplementParameter: scalar keys first (so "tines.count" precedes "tines.pivot_x_m[10]"), then array elements, each group in the given order.

Argument Description
P Parameters to change (typically MakeImplementParameters of the file's id).
Values Values to apply.
Count Number of values.
OutFailed Index into Values of the first rejected key, or -1.

Returns: False when a key is unknown or out of range (the keys before it are applied).

bool ApplyImplementValues(FImplementParameters& P, const FImplementKeyValue* Values, int Count, int& OutFailed);

ImplementSteadyState#

Settled response of an implement pulled at a constant speed over uniform flat ground.

Runs StepImplement from ResetImplement at 120 Hz for SettleS seconds with the controls given and averages the last second (draft, vertical force, depth, PTO and hydraulic power; the rest from the last step). The hitch starts lowered (LiftRad at the lever's lift) so the settling time is the tools' and the controller's.

Argument Description
P Implement parameters.
Soil Soil under the implement.
SpeedMps Forward speed, m/s.
Controls Operator controls (bRaise is cleared).
PtoRadS PTO shaft speed, rad/s (only the sprayer and the baler use it).
SettleS Simulated time, s (at least 1.5).

Returns: The averaged output.

FImplementOutput ImplementSteadyState(const FImplementParameters& P, const FImplementSoil& Soil, double SpeedMps, const FImplementControls& Controls, double PtoRadS = 0, double SettleS = 4);

Example

FImplementParameters P = MakeImplementParameters(EImplementKind::ChiselPlow);
FImplementControls C = ImplementDefaultControls(P);
ImplementControlsForDepth(P, 0.2, C);
const FImplementOutput Out =
    ImplementSteadyState(P, ImplementSoilFromLibrary(SoilClassSiltLoam, .25, 0), 2.2, C, 0, 4);

FImplementKeyValue#

struct FImplementKeyValue

One data-file value: "block.key" or "block.key[i]" and its value in file units.