Doing the Math in GENESYS: The Parameter Solver
Parameters are where a lot of the real engineering lives: mass, power, voltage, MTBF, and
all the numbers that have to add up. The catch is that they usually add up somewhere else,
in a spreadsheet off to the side, and then someone types the answer back into the model by
hand. The Parameter Solver is a GENESYS script that keeps the math inside GENESYS.
Select an entity, click a ribbon button, and a little calculator opens that knows your
entity's parameters and can write results straight back to the design value.
Click here to download the Parameter Solver script.
This article covers what it does and how to install it.
What it does
Run the command on an entity and the Solver shows you every parameter on it, plus the
parameters of the entities it is related to, each field laid out with a ready-made variable
name. Then you write plain math against those names and watch the answer update live as you
type.
A few things worth knowing:
-
Dot notation for reads. Reference any field as `name.field`, for example
`cmdCtrPower.design` or `mass.max`. The bare name means the design value. -
Assignments write back. A line like `Total.design = partA.design + partB.design`
computes the value and, on Apply, writes it to that parameter's design value. Stack
several lines and they run top to bottom, so later lines can use earlier results. -
Related entities are fair game. Roll a value up across everything connected to your
entity with `agg`, for example `Total.design = agg(sum, Mass.design)` for a mass budget. -
A proper function set. Trig, logs, roots, rounding, stats like `mean` and `stdev`,
`if()` for conditional logic, and shorthand number suffixes like `2.4k`. -
It sticks. Applied values are committed to the repository, so they are still there
after you close and reopen the project.
Everything previews before you commit, and every change is confirmed, so nothing lands in
the model until you say so.
Installing the script
The Solver ships as a ready-to-import GENESYS file, so there's no code to create or paste.
You import it, wire it to a ribbon button, and you're done.
-
Import the script. In GENESYS, go to File (top left corner), and then Import to bring in the provided
`.gnsx` file. GENESYS adds a Parameter Solver folder to the Scripts section of
the Project Explorer, containing the Solver, with nothing to copy, edit, or compile. -
Add a ribbon button. Open the Custom Ribbon editor, the small
screwdriver-and-wrench icon on the right side of the Project Explorer, next to the help
button. Click Add to create a ribbon group (say, "Parameters"), select it, and click
Add again to create a button. Give it a short name like "Parameter Solver", pick a 32x32
icon, and assign the script. -
Run it. Click OK and a new Custom tab appears in the ribbon with your button.
Select an entity that has parameters, click the button, and the Solver opens ready to go.
Putting it to work
Pick an entity, open the Solver, and the workflow is quick: read the values you need, write
an expression or two, glance at the live result, and apply. The math stays with the model,
the numbers persist, and nobody has to alt-tab to a calculator to figure out the total mass
again.
Comments
0 comments
Please sign in to leave a comment.