Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions StkExtensionPlugins/AccelHist.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
' this script takes a report containing
' Astrogator Maneuver Ephemeris Block History - Top - Epoch
' Astrogator Maneuver Ephemeris Block History - Top - Time
' Astrogator Maneuver Ephemeris Block History - Maneuver - Thrust_Vector_X
' Astrogator Maneuver Ephemeris Block History - Maneuver - Thrust_Vector_Y
' Astrogator Maneuver Ephemeris Block History - Maneuver - Thrust_Vector_Z
' Astrogator Maneuver Ephemeris Block History - Maneuver - Total_Mass
'
' and reformats it into an accesHist file. Note that Epoch is expected to be in UTCG and Time in EpSec
'
' author: jens ramrath
' date: 17 Mar 2020


' read the report
set oArgs = wscript.arguments
path = oArgs(0)
set oArgs = nothing
fileArray = getFileToArray(path)



dataStr = ""
epochTime = ""
epochSec = 0
counter = 0
headerSize = 9

' loop through report
for i = 0 to ubound(fileArray)
' ignore header
if i > headerSize then
' ignore blank
if Trim(fileArray(i)) <> "" then

' remove empty elements
for j = 1 to 10
fileArray(i) = Replace(fileArray(i), " ", " ")
next

' split line assemble parts
thisLineSplit = Split(Trim(fileArray(i)), " ")

timeString = thisLineSplit(0) - epochSec
epochString = thisLineSplit(1) & " " & thisLineSplit(2) & " " & thisLineSplit(3) & " " & thisLineSplit(4)
accX = thisLineSplit(5)/thisLineSplit(8)
accY = thisLineSplit(6)/thisLineSplit(8)
accZ = thisLineSplit(7)/thisLineSplit(8)

if i = headerSize + 1 then
epochTime = epochString
epochSec = timeString
timeString = 0
end if

dataStr = dataStr & timeString & " " & accX & " " & accY & " " & accZ & vbcrlf

counter = counter + 1
end if
end if
next



' write everything to report
' header
fileStr = "stkv4.3" & vbcrlf
fileStr = fileStr & "BEGIN AccelHistory" & vbcrlf
fileStr = fileStr & "NumberOfEphemerisPoints " & counter & vbcrlf
fileStr = fileStr & "ScenarioEpoch " & epoch & vbcrlf
fileStr = fileStr & "CoordinateSystem J2000" & vbcrlf
fileStr = fileStr & "InterpolationOrder 1" & vbcrlf
fileStr = fileStr & "EPHEMERISTIMEACC" & vbcrlf

' data
fileStr = fileStr & dataStr

' footer
fileStr = fileStr & "End AccelHistory" & vbcrlf



writeStrToFile path, fileStr

' the end




' ***** read report and write it to array *****
Function getFileToArray(path)
set fso = createObject("Scripting.FileSystemObject")
set fIn = fso.OpenTextFile(path, 1)
i = 0
while not fIn.AtEndOfStream
redim preserve fileArray(i)
fileArray(i) = fIn.ReadLine
i = i + 1
wend
set fIn = nothing
getFileToArray = fileArray
End Function


' ***** write everything to report *****
Sub writeStrToFile(path,string) 'saves a string to the given path
dim fso, f
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.CreateTextFile(path)

f.write string

set f = nothing
set fso = nothing
End Sub
225 changes: 225 additions & 0 deletions StkExtensionPlugins/Accel_File.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
stk.v.11.0
WrittenBy STK_v11.7.1

BEGIN ReportStyle

BEGIN ClassId
Class Satellite
END ClassId

BEGIN Header
StyleType 0
Date Yes
Name Yes
IsHidden No
DescShort No
DescLong No
YLog10 No
Y2Log10 No
YUseWholeNumbers No
Y2UseWholeNumbers No
VerticalGridLines No
HorizontalGridLines No
AnnotationType Spaced
NumAnnotations 3
NumAngularAnnotations 5
ShowYAnnotations Yes
AnnotationRotation 1
BackgroundColor #ffffff
ForegroundColor #000000
ViewableDuration 3600
RealTimeMode No
DayLinesStatus 1
LegendStatus 1
LegendLocation 1
TextPointSize 10
TextForegroundColor #ffff00
TextBackgroundColor #000000

BEGIN PostProcessor
Destination 0
Use 1
ScriptName U:\STK\Plugins\PostProcessing\AccelHist\AccelHist.vbs
Destination 1
Use 1
ScriptName C:\temp\delete\Accel_File_PPS.pl
Destination 2
Use 1
ScriptName C:\temp\delete\Accel_File_PPS.pl
Destination 3
Use 1
ScriptName C:\temp\delete\Accel_File_PPS.pl
END PostProcessor
NumSections 1
END Header

BEGIN Section
Name Section 1
ClassName Satellite
NameInTitle No
ExpandMethod 0
PropMask 770
ShowIntervals No
NumIntervals 0
NumLines 1

BEGIN Line
Name Line 1
NumElements 6

BEGIN Element
Name Time
IsIndepVar Yes
IndepVarName Time
Title Time
NameInTitle No
Service AstrogatorSegmentHistory
Type Top
Element Time
SumAllowedMask 0
SummaryOnly No
DataType 0
UnitType 2
LineStyle 0
LineWidth 0
PointStyle 0
PointSize 0
FillPattern 0
LineColor #000000
FillColor #000000
PropMask 0
UseScenUnits No
BEGIN Units
DateFormat EpochSeconds
END Units
END Element

BEGIN Element
Name Astrogator Maneuver Ephemeris Block History-Top-Epoch
IsIndepVar No
IndepVarName Time
Title Epoch
NameInTitle Yes
Service AstrogatorSegmentHistory
Type Top
Element Epoch
SumAllowedMask 1559
SummaryOnly No
DataType 0
UnitType 2
LineStyle 0
LineWidth 0
PointStyle 0
PointSize 0
FillPattern 0
LineColor #000000
FillColor #000000
PropMask 0
UseScenUnits No
BEGIN Units
DateFormat GregorianUTC
END Units
END Element

BEGIN Element
Name Astrogator Maneuver Ephemeris Block History-Maneuver-Thrust_Vector_X
IsIndepVar No
IndepVarName Time
Title Thrust_Vector_X
NameInTitle Yes
Service AstrogatorSegmentHistory
Type Maneuver
Element Thrust_Vector_X
SumAllowedMask 1559
SummaryOnly No
DataType 0
UnitType 30
LineStyle 0
LineWidth 0
PointStyle 0
PointSize 0
FillPattern 0
LineColor #000000
FillColor #000000
PropMask 0
UseScenUnits Yes
END Element

BEGIN Element
Name Astrogator Maneuver Ephemeris Block History-Maneuver-Thrust_Vector_Y
IsIndepVar No
IndepVarName Time
Title Thrust_Vector_Y
NameInTitle Yes
Service AstrogatorSegmentHistory
Type Maneuver
Element Thrust_Vector_Y
SumAllowedMask 1559
SummaryOnly No
DataType 0
UnitType 30
LineStyle 0
LineWidth 0
PointStyle 0
PointSize 0
FillPattern 0
LineColor #000000
FillColor #000000
PropMask 0
UseScenUnits Yes
END Element

BEGIN Element
Name Astrogator Maneuver Ephemeris Block History-Maneuver-Thrust_Vector_Z
IsIndepVar No
IndepVarName Time
Title Thrust_Vector_Z
NameInTitle Yes
Service AstrogatorSegmentHistory
Type Maneuver
Element Thrust_Vector_Z
SumAllowedMask 1559
SummaryOnly No
DataType 0
UnitType 30
LineStyle 0
LineWidth 0
PointStyle 0
PointSize 0
FillPattern 0
LineColor #000000
FillColor #000000
PropMask 0
UseScenUnits Yes
END Element

BEGIN Element
Name Astrogator Maneuver Ephemeris Block History-Maneuver-Total_Mass
IsIndepVar No
IndepVarName Time
Title Total_Mass
NameInTitle Yes
Service AstrogatorSegmentHistory
Type Maneuver
Element Total_Mass
SumAllowedMask 1559
SummaryOnly No
DataType 0
UnitType 8
LineStyle 0
LineWidth 0
PointStyle 0
PointSize 0
FillPattern 0
LineColor #000000
FillColor #000000
PropMask 0
UseScenUnits Yes
END Element
END Line
END Section

BEGIN LineAnnotations
END LineAnnotations
END ReportStyle