Description | Example | Return message | Group

CalculationTool Scalar Calculation

Define and modify Scalar Calculation components and templates.

Syntax

CalculationTool <ScenarioPath> <ParentObject> {Action} {"Scalar Calculation" | "Scalar CalculationTemplate"} <ComponentName> [{ScalarCalculationType} <TypeParams>]

Related commands

Description

Use the "CalculationTool Scalar Calculation" command to add, modify, and delete Scalar Calculation components and templates.

For a component object, the <ParentObject> is a truncated object path or a Central Body path.

For a template, the <ParentObject> is an STK class name, and you must enter the "Scalar CalculationTemplate" keyword.

The Scalar Calculation component type is not valid for Star objects.

The following table provides a description of {Action} values and the applicable parameters:

{Action}ParametersDescription
Create{ScalarCalculationType} [<TypeParams>]<TypeParams> are optional, except where noted below. If you do not specify <TypeParams>, STK uses default values.
Modify{ScalarCalculationType} <TypeParams>The values <ComponentName> {ScalarCalculationType} must define an existing Scalar Calculation component or template. You cannot modify the {ScalarCalculationType}. <TypeParams> are required.
DeleteN/ADeletes the component or template identified by <ComponentName>.

You can specify any or all of the <TypeParams> for an {ScalarCalculationType} on a command line, except where indicated.

The following table describes each Scalar Calculation type and its parameters.

{ScalarCalculationType}<TypeParams>
"Angle"
  • InputAngle "<Angle>"
"Average"
  • InputScalar "<CalcScalar>"
  • AccumulationType {Static | CumulativeToCurrent | CumulativeFromCurrent | SlidingWindow}
  • StartOffset <Value>
  • StopOffset <Value>

The StartOffset <Value> and StopOffset <Value> are only used if AccumulationType is SlidingWindow. Enter them in Connect Time units. The StartOffset <Value> must be less than the StopOffset <Value>.

See below for Advanced Option parameters for this component type.

"Calculation Along Trajectory"
  • TrajectoryPoint "<Point>"
  • SpatialCalculation "<SpatialCalculation>"
"Constant"
  • Value <Value>
  • Dimension <DimensionName>

Enter the <Value> in the Scenario units of the specified dimension. Use the ShowUnits command with the GUI option for current Scenario units.

When entering Value <Value>, you must specify a <Value> that is valid for the specified dimension (e.g., Power).

"Custom Inline Script"

You can specify any or all of the following keyword-value pairs:

  • ScriptType {JScript | Matlab | VBScript}
  • ValueFunction "<string>"
  • DerivativeFunction "<string>"
  • Arguments {Add | Replace} <NumberOfScalars> <Scalars...>
  • Dimension <DimensionName>
  • RemoveArgument <ArgNum>

ValueFunction <string> and at least one Argument are required on the Create command.

There must be at least as many arguments defined as are specified in the functions. For example, if a function is defined as "x1+(t*x2)", there must be at least two arguments defined, x1 and x2.

When using Inline Script components, you may see error pop-ups from the scripts when there are errors in the functions that have been defined. Most of these errors will be caught when a Custom Inline Script component is created. To avoid the pop-ups, you must fix all errors before using the component.

Enter "Arguments Add" to add the specified Scalar Calculations to the argument list, and enter "Arguments Replace" to replace the Scalar Calculations in the argument list. <NumberOfScalars> indicates the number of Scalar Calculations entered.

For the RemoveArgument option, enter the index number of the argument to be removed. The first argument in the list has an index of 1. Use the CalculationTool_R with the Details option to see the list of components.

"Custom Script"{Reload | <CustomOption>}

<CustomOption> can be any or all of:

  • Filename "<FilePath>"
  • Dimension <DimensionName>

Reload is valid for the Modify command only.

Filename <FilePath> option is required when Creating the "Custom Script" Scalar Calculation.

"<FilePath>" can be a file with one of the following extensions: .m, .vbs, or .dll (PC only). The "<FilePath>" value should include a full path. Custom Script files must be located in a hierarchy of predetermined directories.

For more information, see Plugin Script Reference.

"Data Element"
  • DataElement "<DataPrvElement>"
  • UseSamples {Yes | No}

The DataElement "<DataPrvElement>" parameter is required when Creating the "Data Element" Scalar Calculation

The DataElement must be from a data provider that has a time element, and does not require additional data. Also, the data provider cannot be based on a VGT, Time, or Calculation component.

The "<DataPrvElement>" is constructed from the data provider name and the hierarchy to a scalar element, all delimited with hyphens '-' or colons ':'. For example, a valid Satellite data element would be: "Attitude YPR-Seq PRY-Pitch" or "Attitude YPR:Seq PRY:Pitch".

You cannot mix hyphens and colons as delimiters in a command. If the DataElement contains a hyphen, then you must use colons as delimiters. For example, "Solar Specular Point:X-Fixed".

Advanced options:

  • SaveOption {UseApplicationPrefs | SaveComputedData | None}

Parameters for Sampling are also valid for this component type. See "Parameters for Sampling" in table below.

Parameters for Interpolation:

  • InterpolationType {Lagrange | Hermite}
  • InterpolationOrder <Order>

<Order> is an integer between 0 and 10000.0

The Data Element Scalar Calculation type is not valid for CentralBody objects, Templates, or Comm objects (Antenna, Radar, Receiver, Transmitter).

"Derivative"
  • Scalar "<CalcScalar>"
  • Enter DifferencingTimeStep <Value> in Connect Time. The value must be between 1e-6 and 99999999999.0.
  • ForceUseOfNumericalDifferences {Yes | True | On} or {No | False | Off}
"Dot Product"
  • VectorA "<Vector>"
  • NormalizeA {Yes | No}
  • VectorB "<Vector>"
  • NormalizeB {Yes | No}
  • Dimension "<DimensionName>"
"Elapsed Time"
  • ReferenceTimeInstant "<TimeInstant>"
"File"
  • Filename "<ScalarFile>"
  • Reload
  • StartTime {TimeInstant}
  • OverrideStartTime {Yes | No}

"<ScalarFile>" is a Calculation Scalar Format (*.csc) file.

"<ScalarFile>" can be the path to a file on your local drive or the path to a file on an SDF server. See Specifying Paths for "<SDFFilePath>" syntax information.

The Filename "<ScalarFile>" parameter is required when Creating the "File" Scalar Calculation

The Reload parameter is valid for a Modify command only, and should be the only parameter on the command.

For valid {TimeInstant} values see Time Options.

Sending StartTime {TimeInstant} will turn on the OverrideStartTime option.

"Fixed at Time Instant"
  • InputScalar "<CalcScalar>"
  • ReferenceTimeInstant "<TimeInstant>"
"Function(x)"
  • Function {FunctionName}
  • ArgumentXScalar "<CalcScalar>"
  • ArgumentXTimeInstant "<TimeInstant>"
  • ArgumentXUnit <UnitAbbreviation>
  • a <Value>
  • b <Value>
  • c <Value>
  • d <Value>
  • OutputInheritDimension {Yes | No}
  • OutputDimension <DimensionName>
  • OutputUnit <UnitAbbreviation>

All <Value> entries are unitless.

Enter either ArgumentXScalar "<CalcScalar>" or ArgumentXTimeInstant "<TimeInstant>", but not both.

Enter ArgumentXUnit and OutputUnit parameters only on Modify commands.

Valid values for {FunctionName} and their definitions are:

Absa*|bx+c|+d
Cosa*Cos(bx+c)+d
Sina*Sin(bx+c)+d
Expa*Exp(bx+c)+d
Power10a*10^(bx+c)+d
Power2a*2^(bx+c)+d
Power(bx+c)^a+d
Lna*Ln(bx+c)+d
Log10a*Log10(bx+c)+d
Log2a*Log2(bx+c)+d
Erfca*Erfc(bx+c)+d
Qa*Q(bx+c)+d
Polynomiala+b*x+c*x^2+d*x^3
Inversea/(bx+c)+d
SquareRoota*Sqrt(bx+c)+d

The following options are available via Connect only. They are not on the UI.

  • OverflowLimit <Value>

OverflowLimit <Value> must be greater than or equal to 1000. This value defines the upper limit for functions that may otherwise continue to infinity.

Parameters for Sampling are also valid for this component type. See "Parameters for Sampling" in the table below.

Parameters for Convergence:

  • TimeTolerance <TimeTol>

Enter <TimeTol> in Connect time units. The value must be between 1e-13 and 99999999999.0.

"Function(x,y)"
  • Function {Plus | Minus | Multiply | Divide | Linear}
  • ArgumentX "<CalcScalar>"
  • ArgumentXUnit <UnitAbbreviation>
  • ArgumentY "<CalcScalar>"
  • ArgumentYUnit <UnitAbbreviation>
  • CoefficientA <Value>
  • CoefficientB <Value>
  • CoefficientC <Value>
  • OutputInheritDimension {FromX | FromY | No}
  • OutputDimension <DimensionName>
  • OutputUnit <UnitAbbreviation>

All <Value> entries are unitless.

Enter the ArgumentXUnit, ArgumentYUnit, and OutputUnit parameters only on Modify commands.

The function definitions are below. Not all coefficients (a, b, c) apply for every function:

Plusa*x+b*y
Minusa*x-b*y
Multiplya*x*y
Dividea*x/y
Lineara*x^2+b*x*y+c*y^2
"Integral"
  • InputScalar "<CalcScalar>"
  • ComputeAsAverage {Yes | No}
  • AccumulationType {Static | CumulativeToCurrent | CumulativeFromCurrent | SlidingWindow}
  • StartOffset <Value>
  • StopOffset <Value>

Only use StartOffset <Value> and StopOffset <Value> if AccumulationType is SlidingWindow. Enter them in Connect Time units. The StartOffset <Value> must be less than the StopOffset <Value>.

See below for Advanced Option parameters for this component type.

"Plugin"
  • PluginName "<ProgID>"
  • Reset

The Reset parameter is valid for a Modify command only.

The "<ProgID>" value is the ProgID that was used to register the plugin.

The PluginName "<ProgID>" parameter is required when Creating the "Plugin" Scalar Calculation.

The "Plugin" Scalar Calculation type is not valid for Templates.

"Standard Deviation"
  • InputScalar "<CalcScalar>"
  • AccumulationType {Static | CumulativeToCurrent | CumulativeFromCurrent | SlidingWindow}
  • StartOffset <Value>
  • StopOffset <Value>

Only use StartOffset <Value> and StopOffset <Value> if AccumulationType is SlidingWindow. Enter them in Connect Time units. The StartOffset <Value> must be less than the StopOffset <Value>.

See below for Advanced Option parameters for this component type.

"Surface Distance Between Points"

You can specify any or all of the following keyword-value pairs:

  • Point1 "<Point>"
  • Point2 "<Point>"
  • SurfaceCB <CBName>
  • DiffTimeStep <Value>

The <ParentObject> for the "Surface Distance Between Points" type cannot be a Star.

Enter DiffTimeStep <Step> in Connect time units. The value must be between 1e-6 and 99999999999.0.

"Vector Magnitude"
  • InputVector "<Vector>"

For details on the format of a reference component (e.g. "<CalcScalar>", "<TimeInstant>", etc), see Component Specification.

The following table describes Advanced Option parameters for "Average", "Integral", and "Standard Deviation" component types.

Advanced options:
  • SaveOption {UseApplicationPrefs | SaveComputedData | None}
  • SetTimeLimits {UseApplicationPrefs | Local}
  • TimeLimits "<IntervalOrIntervalList>"

If you set SetTimeLimits to Local, then STK will use the time interval or interval list specified by the TimeLimits parameter. The "<IntervalOrIntervalList>" should include the time component type, e.g., "Satellite/Sat1 EphemerisTimeSpan Interval".

Parameters for Sampling:
  • SamplingType {FixedStep | RelativeTolerance | CurvatureTolerance}

Parameters for SamplingType FixedStep:

  • TimeStep <TimeStep>

Parameters for SamplingType RelativeTolerance:

  • MinimumTimeStep <MinStep>
  • MaximumTimeStep <MaxStep>
  • StepAtBoundaries <StepBound>
  • SamplingRelativeTolerance <RelTol>
  • SamplingAbsoluteTolerance <AbsTol>

Parameters for SamplingType CurvatureTolerance:

  • MinimumTimeStep <MinStep>
  • MaximumTimeStep <MaxStep>
  • StepAtBoundaries <StepBound>
  • SamplingRelativeTolerance <RelTol>
  • SamplingAbsoluteTolerance <AbsTol>
  • CurvatureTolerance <CurveTol>

Enter <TimeStep>, <StepBound>, <MinStep>, and <MaxStep> in Connect time units. Their values must be between 1e-13 and 99999999999.0.

<RelTol>, and <CurveTol> must be between 1e-13 and 1.0.

<AbsTol> must be greater than or equal to 1e-13.

Parameters for Interpolation:

Parameters for Interpolation:

  • InterpolationType {Lagrange | Hermite}
  • InterpolationOrder <Order>

<Order> is an integer between 0 and 10000.0.

Parameters for Integral:

Parameters for Integral:

  • IntegralType {AdaptiveLobatto | Simpson | Trapezoidal}
  • MaxIterations <MaxIter>
  • IntegralTolerance <Tolerance>
  • KeepConstantOutsideTimeLimits {Yes | No}

<MaxIter> is an integer between 1 and 10000.

<Tolerance> must be greater than or equal to 1e-13.

Examples

To create and modify a "Function(x,y)" Scalar Calculation component:

CalculationTool * Satellite/ScenTestSat Create "Scalar Calculation" SatScalar11 "Function(x,y)"
CalculationTool * Satellite/ScenTestSat Modify "Scalar Calculation" SatScalar11 "Function(x,y)" ArgumentY "Satellite/ScenTestSat ElapsedTimeFromStop Scalar Calculation" CoefficientA 123.0 Function Divide
CalculationTool * Satellite/ScenTestSat Modify "Scalar Calculation" SatScalar11 "Function(x,y)" OutputInheritDimension FromY OutputUnit min

To create a "Data Element" Scalar Calculation component:

CalculationTool * Satellite/ScenTestSat Create "Scalar Calculation" SatScalar4 "Data Element" DataElement "Attitude YPR-Seq PRY-Pitch"

To create and modify a "Vector Magnitude" Scalar Calculation Template:

CalculationTool * Satellite Create "Scalar CalculationTemplate" SatScalarT1 "Vector Magnitude"
CalculationTool * Satellite Modify "Scalar CalculationTemplate" SatScalarT1 "Vector Magnitude" InputVector "Satellite Velocity Vector"

To create "Constant" Scalar Calculation component that specifies a constant Date value:

CalculationTool * Satellite/ScenTestSat Modify "Scalar Calculation" SatScalar3 "Constant" Value "17 Oct 2012 16:43:00.00" Dimension Date

To create and modify an "Integral" Scalar Calculation:

CalculationTool * Satellite/ScenTestSat Create "Scalar Calculation" SatScalar11 "Integral"
CalculationTool * Satellite/ScenTestSat Modify "Scalar Calculation" SatScalar11 "Integral" SetTimeLimits Local TimeLimits "Satellite/ScenTestSat LightingIntervals.Sunlight Interval List"
CalculationTool * Satellite/ScenTestSat Modify "Scalar Calculation" SatScalar11 "Integral" AccumulationType SlidingWindow

To create "File" Scalar Calculation component, specifying a time to override the start time in the file:

CalculationTool * Satellite/ScenTestSat Create "Scalar Calculation" SatFile38 "File" FileName "C:\stk\User\stkData\ScalarTest72.csc" StartTime "17 Oct 2012 16:43:00.00"

Examples

To create and modify an "Custom Inline Script" Scalar Calculation:

CalculationTool * Satellite/Satellite1 Create "Scalar Calculation" Inline4 "Custom Inline Script" ValueFunction "t + x1" Arguments Add 1 "Satellite/Satellite1 Speed"
CalculationTool * Satellite/Satellite1 Modify "Scalar Calculation" Inline4 "Custom Inline Script" DerivativeFunction "x1+t*dx1" Dimension Distance

Return message

Group membership

This command belongs to the following group(s):

Area Targets

Comm

Facilities, Places & Targets

Line Targets

Radar

Scenarios

Sensors

Stars & Planets

Object Tools

Vehicles

VO

VO Objects

Version

12.8