Scripting Maneuver Sets
Listed below are significant aspects about maneuvers and their interfaces in the Ansys Orbit Determination Tool Kit (ODTK®) application.
- Maneuvers are managed as ordered sets rather than unordered lists.
- The ODTK application automatically sorts maneuvers by:
- Start Time (finite maneuvers) or Epoch (impulsive maneuvers)
- Maneuver type
- Enabled / disabled status
- Name
- Maneuver sets have a method, InsertNew(string), for which the string is the name of the maneuver choices.
- Maneuvers have methods FindByName(string) and RemoveByName(string), where string is the name of a maneuver.
- For ODTK application versions 6 and earlier, you created a new maneuver element and then pushed it onto the bottom of the list using push_back(). However, sets do not support push_back(). Simply replacing push_back() with insert() does not guarantee that the new element will be at the end of the set, because the set is sorted.
Recommended methods for finite and impulsive maneuvers
The code samples below demonstrate the recommended methods for working with maneuver sets. Each sample includes both finite and impulsive examples. Note the use of iterators to work with items in the set.
COM
Copy
set sat = ODTK.Scenario(0).Satellite("Satellite1")
'-------------------------------------------------------
' Finite maneuver example
'-------------------------------------------------------
' Clear out any existing finite maneuvers and add a new
' one in.
set fmSet = sat.ForceModel.FiniteManeuvers
fmSet.clear()
' Create a new maneuver to model a cross-track delta-I
set fmIter = fmSet.InsertNew("FiniteManConstThrust")
if fmIter.IsSafeToDereference() then
set fm = fmIter.Dereference()
fm.Name = "FMTest1"
fm.Enabled = true
fm.Frame = "Gaussian (RIC)"
fm.Estimate = "MagnitudeAndPointing"
' Configure the burn time
fm.Time.StopMode = "TimeSpan"
set unused = fm.Time.StartTime.Set("1 Jun 2009 00:00:00", "UTCG")
set unused = fm.Time.TimeSpan.Set("45", "min")
' Configure the burn parameters
fm.Thrust.Specification = "ByComponent"
set unused = fm.Thrust.ThrustX.Set(0, "N")
set unused = fm.Thrust.ThrustY.Set(0, "N")
set unused = fm.Thrust.ThrustZ.Set(2, "lbf")
' Configure the mass loss
fm.Mass.LossMethod = "BasedOnIsp"
set unused = fm.Mass.Isp.Set(325.0,"sec")
' Configure the burn uncertainty
fm.Uncertainty.Type = "%MagnitudeAndPointing"
set unused = fm.Uncertainty.PercentMagnitudeSigma.Set( 3.0, "%")
set unused = fm.Uncertainty.PointingSigma.Set(1.5, "deg")
set unused = fm.Uncertainty.MagnitudeHalfLife.Set(1, "hr")
set unused = fm.Uncertainty.PointingHalfLife.Set(1, "hr")
end if
' Add in a second maneuver as a dummy maneuver just
' to prove that we can find the right maneuver
set fmIter = fmSet.InsertNew("FiniteManConstThrust")
if fmIter.IsSafeToDereference() then
set fm = fmIter.Dereference()
' We'll set the name and accept the defaults for all the
' other parameters.
fm.Name = "FMTest2"
end if
' Now try to find the first maneuver and report the
' thrust.
set fmIter = fmset.FindByName("FMTest1")
if fmIter.IsSafeToDereference() then
set fm = fmIter.Dereference()
MsgBox "Found maneuver " & fm.Name & vbCrLf & "Thrust is " & fm.Thrust.ThrustZ.GetIn("lbf") & " lbf"
end if
' Now delete the second maneuver
set fmIter = fmset.FindByName("FMTest2")
if fmIter.IsSafeToDereference() then
MsgBox "Found second maneuver"
fmset.RemoveByName("FMTest2")
end if
' Verify that the second maneuver is gone.
set fmIter = fmset.FindByName("FMTest2")
if not fmIter.IsSafeToDereference() then
MsgBox "Second maneuver was deleted"
end if
'-------------------------------------------------------
' Impulsive maneuver example
'-------------------------------------------------------
' Clear out any existing impulsive maneuvers and add a new
' one in.
set imSet = sat.ForceModel.ImpulsiveManeuvers
imSet.clear()
' Create a new maneuver to model an in-track Delta-V
set imIter = imSet.InsertNew("ImpulsiveManDeltaV")
if imIter.IsSafeToDereference() then
set im = imIter.Dereference()
im.Name = "IMTest1"
im.Enabled = true
im.Frame = "Gaussian (RIC)"
' Configure the burn time (assumes the actual burn is
' 4 minutes long but is modeled as an impulsive burn)
set unused = im.Epoch.Set("1 Jan 2009 01:23:45", "UTCG")
set unused = im.TimeAfterStart.Set(2, "min")
set unused = im.TimeBeforeEnd.Set(2, "min")
' Configure the burn parameters
im.DeltaV.Specification = "ByComponent"
set unused = im.DeltaV.DeltaVX.Set(0.0, "m/sec")
set unused = im.DeltaV.DeltaVY.Set(0.1, "m/sec")
set unused = im.DeltaV.DeltaVZ.Set(0.0, "m/sec")
' Configure the mass loss
im.Mass.LossMethod = "Explicit"
set unused = im.Mass.MassLoss.Set(1,"kg")
' Configure the burn uncertainty
im.Uncertainty.Type = "ByComponent"
set unused = im.Uncertainty.XSigma.Set(0.01, "m/sec")
set unused = im.Uncertainty.YSigma.Set(0.02, "m/sec")
set unused = im.Uncertainty.ZSigma.Set(0.01, "m/sec")
end if
' Add in a second maneuver as a dummy maneuver just
' to prove that we can find the right maneuver
set imIter = imSet.InsertNew("ImpulsiveManDeltaV")
if imIter.IsSafeToDereference() then
set im = imIter.Dereference()
' We'll set the name and accept the defaults for all the
' other parameters.
im.Name = "IMTest2"
end if
' Now try to find the first maneuver and report the Delta-V
set imIter = imSet.FindByName("IMTest1")
if imIter.IsSafeToDereference() then
set im = imIter.Dereference()
MsgBox "Found maneuver " & im.Name & vbCrLf & "Delta-V is " & im.DeltaV.DeltaVY.GetIn("m/sec") & " m/sec"
end if
' Now delete the second maneuver
set imIter = imSet.FindByName("IMTest2")
if imIter.IsSafeToDereference() then
MsgBox "Found second maneuver"
imSet.RemoveByName("IMTest2")
end if
' Verify that it is gone.
set imIter = imSet.FindByName("IMTest2")
if not imIter.IsSafeToDereference() then
MsgBox "Second maneuver was deleted"
end if
' At this point the only maneuvers left on the satellite should be
' FMTest1 and IMTest1.
Copy
var Shell = new ActiveXObject("WScript.Shell");
var sat = ODTK.Scenario(0).Satellite("Satellite1");
//-------------------------------------------------------
// Finite maneuver example
//-------------------------------------------------------
// Clear out any existing finite maneuvers and add a new
// one in.
var fmSet = sat.ForceModel.FiniteManeuvers;
fmSet.clear();
// Create a new maneuver to model a cross-track delta-I
var fmIter = fmSet.InsertNew("FiniteManConstThrust")
if (fmIter.IsSafeToDereference())
{
var fm = fmIter.Dereference();
fm.Name = "FMTest1"
fm.Enabled = true;
fm.Frame = "Gaussian (RIC)";
fm.Estimate = "MagnitudeAndPointing";
// Configure the burn time
fm.Time.StopMode = "TimeSpan";
var unused = fm.Time.StartTime.Set("1 Jun 2009 00:00:00", "UTCG");
unused = fm.Time.TimeSpan.Set("45", "min");
// Configure the burn parameters
fm.Thrust.Specification = "ByComponent"
unused = fm.Thrust.ThrustX.Set(0, "N");
unused = fm.Thrust.ThrustY.Set(0, "N");
unused = fm.Thrust.ThrustZ.Set(2, "lbf");
// Configure the mass loss
fm.Mass.LossMethod = "BasedOnIsp";
unused = fm.Mass.Isp.Set(325.0,"sec");
// Configure the burn uncertainty
fm.Uncertainty.Type = "%MagnitudeAndPointing";
fm.Uncertainty.PercentMagnitudeSigma = 3.0;
unused = fm.Uncertainty.PointingSigma.Set(1.5, "deg");
unused = fm.Uncertainty.MagnitudeHalfLife.Set(1, "hr");
unused = fm.Uncertainty.PointingHalfLife.Set(1, "hr");
}
// Add in a second maneuver as a dummy maneuver just
// to prove that we can find the right maneuver
fmIter = fmSet.InsertNew("FiniteManConstThrust");
if (fmIter.IsSafeToDereference())
{
fm = fmIter.Dereference();
// We'll set the name and accept the defaults for all the
// other parameters.
fm.Name = "FMTest2";
}
// Now try to find the first maneuver and report the
// thrust.
fmIter = fmSet.FindByName("FMTest1");
if (fmIter.IsSafeToDereference())
{
fm = fmIter.Dereference();
Shell.Popup("Found maneuver " + fm.Name + "\n" + "Thrust is " + fm.Thrust.ThrustZ.GetIn("lbf") + " lbf");
}
// Now delete the second maneuver
fmIter = fmSet.FindByName("FMTest2");
if (fmIter.IsSafeToDereference())
{
Shell.Popup("Found second maneuver");
fmSet.RemoveByName("FMTest2");
}
// Verify that the second maneuver is gone.
fmIter = fmSet.FindByName("FMTest2")
if (fmIter.IsSafeToDereference() == false)
{
Shell.Popup("Second maneuver was deleted");
}
//-------------------------------------------------------
// Impulsive maneuver example
//-------------------------------------------------------
// Clear out any existing impulsive maneuvers and add a new
// one in.
var imSet = sat.ForceModel.ImpulsiveManeuvers;
imSet.clear();
// Create a new maneuver to model an in-track Delta-V
imIter = imSet.InsertNew("ImpulsiveManDeltaV");
if (imIter.IsSafeToDereference())
{
var im = imIter.Dereference();
im.Name = "IMTest1";
im.Enabled = true;
im.Frame = "Gaussian (RIC)";
// Configure the burn time (assumes the actual burn is
// 4 minutes long but is modeled as an impulsive burn)
unused = im.Epoch.Set("1 Jan 2009 01:23:45", "UTCG");
unused = im.TimeAfterStart.Set(2, "min");
unused = im.TimeBeforeEnd.Set(2, "min");
// Configure the burn parameters
im.DeltaV.Specification = "ByComponent";
unused = im.DeltaV.DeltaVX.Set(0.0, "m/sec");
unused = im.DeltaV.DeltaVY.Set(0.1, "m/sec");
unused = im.DeltaV.DeltaVZ.Set(0.0, "m/sec");
// Configure the mass loss
im.Mass.LossMethod = "Explicit";
unused = im.Mass.MassLoss.Set(1,"kg");
// Configure the burn uncertainty
im.Uncertainty.Type = "ByComponent";
unused = im.Uncertainty.XSigma.Set(0.01, "m/sec");
unused = im.Uncertainty.YSigma.Set(0.02, "m/sec");
unused = im.Uncertainty.ZSigma.Set(0.01, "m/sec");
}
// Add in a second maneuver as a dummy maneuver just
// to prove that we can find the right maneuver
imIter = imSet.InsertNew("ImpulsiveManDeltaV");
if (imIter.IsSafeToDereference())
{
im = imIter.Dereference();
// We'll set the name and accept the defaults for all the
// other parameters.
im.Name = "IMTest2";
}
// Now try to find the first maneuver and report the Delta-V
imIter = imSet.FindByName("IMTest1");
if (imIter.IsSafeToDereference())
{
im = imIter.Dereference();
Shell.Popup("Found maneuver " + im.Name + "\n" + "Delta-V is " + im.DeltaV.DeltaVY.GetIn("m/sec") + " m/sec");
}
// Now delete the second maneuver
imIter = imSet.FindByName("IMTest2")
if (imIter.IsSafeToDereference())
{
Shell.Popup("Found second maneuver");
imSet.RemoveByName("IMTest2");
}
// Verify that it is gone.
imIter = imSet.FindByName("IMTest2");
if (imIter.IsSafeToDereference() == false)
{
Shell.Popup("Second maneuver was deleted");
}
// At this point the only maneuvers left on the satellite should be
// FMTest1 and IMTest1.
Copy
my $sat = $ODTK->Scenario(0)->$satellite("Satellite1");
#-------------------------------------------------------
# Finite maneuver example
#-------------------------------------------------------
# Clear out any existing finite maneuvers and add a new
# one in.
my $fmSet = $sat->ForceModel->FiniteManeuvers;
$fmSet->clear();
# Create a new maneuver to model a cross-track delta-I
my $fmIter = $fmSet->InsertNew("FiniteManConstThrust");
if ($fmIter->IsSafeToDereference()-{Value})
{
my $fm = $fmIter->Dereference();
$fm->{Name} = "FMTest1";
$fm->{Enabled} = 1;
$fm->{Frame} = "Gaussian (RIC)";
$fm->{Estimate} = "MagnitudeAndPointing";
# Configure the burn time
$fm->Time->{StopMode} = "TimeSpan";
my $unused = $fm->Time->StartTime->Set("1 Jun 2009 00:00:00", "UTCG");
$unused = $fm->Time->TimeSpan->Set("45", "min");
# Configure the burn parameters
$fm->Thrust->{Specification} = "ByComponent";
$unused = $fm->Thrust->ThrustX->Set(0, "N");
$unused = $fm->Thrust->ThrustY->Set(0, "N");
$unused = $fm->Thrust->ThrustZ->Set(2, "lbf");
# Configure the mass loss
$fm->Mass->{LossMethod} = "BasedOnIsp";
$unused = $fm->Mass->Isp->Set(325.0,"sec");
# Configure the burn uncertainty
$fm->Uncertainty->{Type} = "%MagnitudeAndPointing";
$unused = $fm->Uncertainty->PercentMagnitudeSigma->Set(3.0, "%");
$unused = $fm->Uncertainty->PointingSigma->Set(1.5, "deg");
$unused = $fm->Uncertainty->MagnitudeHalfLife->Set(1, "hr");
$unused = $fm->Uncertainty->PointingHalfLife->Set(1, "hr");
}
# Add in a second maneuver as a dummy maneuver just
# to prove that we can find the right maneuver
$fmIter = $fmSet->InsertNew("FiniteManConstThrust");
if ($fmIter->IsSafeToDereference()->{Value})
{
my $fm = $fmIter->Dereference();
# We'll set the name and accept the defaults for all the
# other parameters.
$fm->{Name} = "FMTest2";
}
# Now try to find the first maneuver and report the
# thrust.
$fmIter = $fmSet->FindByName("FMTest1");
if ($fmIter->IsSafeToDereference()->{Value})
{
my $fm = $fmIter->Dereference();
Win32::MsgBox "Found maneuver " . $fm->Name->{Value} . "\nThrust is " . $fm->Thrust->ThrustZ->GetIn("lbf")->{Value} . " lbf";
}
# Now delete the second maneuver
$fmIter = $fmSet->FindByName("FMTest2");
if ($fmIter->IsSafeToDereference()->{Value})
{
Win32::MsgBox "Found second maneuver";
$fmSet->RemoveByName("FMTest2");
}
# Verify that the second maneuver is gone
$fmIter = $fmSet->FindByName("FMTest2");
if (! $fmIter->IsSafeToDereference()->{Value})
{
Win32::MsgBox "Second maneuver was deleted";
}
#-------------------------------------------------------
# Impulsive maneuver example
#-------------------------------------------------------
# Clear out any existing impulsive maneuvers and add a new
# one in.
my $imSet = $sat->ForceModel->ImpulsiveManeuvers;
$imSet->clear();
# Create a new maneuver to model an in-track Delta-V
my $imIter = $imSet->InsertNew("ImpulsiveManDeltaV");
if ($imIter->IsSafeToDereference()->{Value})
{
my $im = $imIter->Dereference();
$im->{Name} = "IMTest1";
$im->{Enabled} = 1;
$im->{Frame} = "Gaussian (RIC)";
# Configure the burn time (assumes the actual burn is
# 4 minutes long but is modeled as an impulsive burn)
my $unused = $im->Epoch->Set("1 Jan 2009 01:23:45", "UTCG");
$unused = $im->TimeAfterStart->Set(2, "min");
$unused = $im->TimeBeforeEnd->Set(2, "min");
# Configure the burn parameters
$im->DeltaV->{Specification} = "ByComponent";
$unused = $im->DeltaV->DeltaVX->Set(0.0, "m/sec");
$unused = $im->DeltaV->DeltaVY->Set(0.1, "m/sec");
$unused = $im->DeltaV->DeltaVZ->Set(0.0, "m/sec");
# Configure the mass loss
$im->Mass->{LossMethod} = "Explicit";
$unused = $im->Mass->MassLoss->Set(1,"kg");
# Configure the burn uncertainty
$im->Uncertainty->{Type} = "ByComponent";
$unused = $im->Uncertainty->XSigma->Set(0.01, "m/sec");
$unused = $im->Uncertainty->YSigma->Set(0.02, "m/sec");
$unused = $im->Uncertainty->ZSigma->Set(0.01, "m/sec");
}
# Add in a second maneuver as a dummy maneuver just
# to prove that we can find the right maneuver
$imIter = $imSet->InsertNew("ImpulsiveManDeltaV");
if ($imIter->IsSafeToDereference()->{Value})
{
my $im = $imIter->Dereference();
# We'll set the name and accept the defaults for all the
# other parameters->
$im->{Name} = "IMTest2";
}
# Now try to find the first maneuver and report the Delta-V
$imIter = $imSet->FindByName("IMTest1");
if ($imIter->IsSafeToDereference()->{Value})
{
my $im = $imIter->Dereference();
Win32::MsgBox "Found maneuver " . $im->Name->{Value} . "\nDelta-V is " . $im->DeltaV->DeltaVY->GetIn("m/sec")->{Value} . " m/sec";
}
# Now delete the second maneuver
$imIter = $imSet->FindByName("IMTest2");
if ($imIter->IsSafeToDereference()->{Value})
{
Win32::MsgBox "Found second maneuver";
$imSet->RemoveByName("IMTest2");
}
# Verify that it is gone->
$imIter = $imSet->FindByName("IMTest2");
if (! $imIter->IsSafeToDereference()->{Value})
{
Win32::MsgBox "Second maneuver was deleted";
}
# At this point the only maneuvers left on the satellite should be
# FMTest1 and IMTest1.
Copy
sat = ODTK.Scenario(0).Satellite("Satellite1")
#-------------------------------------------------------
# Finite maneuver example
#-------------------------------------------------------
# Clear out any existing finite maneuvers and add a new
# one in.
fmSet = sat.ForceModel.FiniteManeuvers
fmSet.clear()
# Create a new maneuver to model a cross-track delta-I
fmIter = fmSet.InsertNew("FiniteManConstThrust")
if fmIter.IsSafeToDereference():
fm = fmIter.Dereference()
fm.Name = "FMTest1"
fm.Enabled = True
fm.Frame = "Gaussian (RIC)"
fm.Estimate = "MagnitudeAndPointing"
# Configure the burn time
fm.Time.StopMode = "TimeSpan"
fm.Time.StartTime.Set("1 Jun 2009 00:00:00", "UTCG")
fm.Time.TimeSpan.Set("45", "min")
# Configure the burn parameters
fm.Thrust.Specification = "ByComponent"
fm.Thrust.ThrustX.Set(0, "N")
fm.Thrust.ThrustY.Set(0, "N")
fm.Thrust.ThrustZ.Set(2, "lbf")
# Configure the mass loss
fm.Mass.LossMethod = "BasedOnIsp"
fm.Mass.Isp.Set(325.0,"sec")
# Configure the burn uncertainty
fm.Uncertainty.Type = "%MagnitudeAndPointing"
fm.Uncertainty.PercentMagnitudeSigma.Set(3.0, '%')
fm.Uncertainty.PointingSigma.Set(1.5, "deg")
fm.Uncertainty.MagnitudeHalfLife.Set(1, "hr")
fm.Uncertainty.PointingHalfLife.Set(1, "hr")
# Add in a second maneuver as a dummy maneuver just
# to prove that we can find the right maneuver
fmIter = fmSet.InsertNew("FiniteManConstThrust")
if fmIter.IsSafeToDereference():
fm = fmIter.Dereference()
# We'll set the name and accept the defaults for all the
# other parameters.
fm.Name = "FMTest2"
# Now try to find the first maneuver and report the
# thrust.
fmIter = fmSet.FindByName("FMTest1")
if fmIter.IsSafeToDereference():
fm = fmIter.Dereference()
print("Found maneuver " + str(fm.Name) + "\n" + "Thrust is " + str(fm.Thrust.ThrustZ.GetIn("lbf")) + " lbf")
# Now delete the second maneuver
fmIter = fmSet.FindByName("FMTest2")
if fmIter.IsSafeToDereference():
fm = fmIter.Dereference()
print("Found maneuver " + str(fm.Name))
print("Thrust is " + str(fm.Thrust.ThrustZ.GetIn("lbf")) + " lbf" )
fmSet.RemoveByName("FMTest2")
# Verify that the second maneuver is gone.
fmIter = fmSet.FindByName("FMTest2")
if not fmIter.IsSafeToDereference().value:
print("Second maneuver was deleted")
#-------------------------------------------------------
# Impulsive maneuver example
#-------------------------------------------------------
# Clear out any existing impulsive maneuvers and add a new
# one in.
imSet = sat.ForceModel.ImpulsiveManeuvers
imSet.clear()
# Create a new maneuver to model an in-track Delta-V
imIter = imSet.InsertNew("ImpulsiveManDeltaV")
if imIter.IsSafeToDereference().value:
im = imIter.Dereference()
im.Name = "IMTest1"
im.Enabled = True
im.Frame = "Gaussian (RIC)"
# Configure the burn time (assumes the actual burn is
# 4 minutes long but is modeled as an impulsive burn)
im.Epoch.Set("1 Jan 2009 01:23:45", "UTCG")
im.TimeAfterStart.Set(2, "min")
im.TimeBeforeEnd.Set(2, "min")
# Configure the burn parameters
im.DeltaV.Specification = "ByComponent"
im.DeltaV.DeltaVX.Set(0.0, "m/sec")
im.DeltaV.DeltaVY.Set(0.1, "m/sec")
im.DeltaV.DeltaVZ.Set(0.0, "m/sec")
# Configure the mass loss
im.Mass.LossMethod = "Explicit"
im.Mass.MassLoss.Set(1,"kg")
# Configure the burn uncertainty
im.Uncertainty.Type = "ByComponent"
im.Uncertainty.XSigma.Set(0.01, "m/sec")
im.Uncertainty.YSigma.Set(0.02, "m/sec")
im.Uncertainty.ZSigma.Set(0.01, "m/sec")
# Add in a second maneuver as a dummy maneuver just
# to prove that we can find the right maneuver
imIter = imSet.InsertNew("ImpulsiveManDeltaV")
if imIter.IsSafeToDereference().value:
im = imIter.Dereference()
# We'll set the name and accept the defaults for all the
# other parameters.
im.Name = "IMTest2"
# Now try to find the first maneuver and report the Delta-V
imIter = imSet.FindByName("IMTest1")
if imIter.IsSafeToDereference().value:
im = imIter.Dereference()
print("Found maneuver " + str(im.Name) + "\n" + "Delta-V is " + str(im.DeltaV.DeltaVY.GetIn("m/sec")) + " m/sec")
# Now delete the second maneuver
imIter = imSet.FindByName("IMTest2")
if imIter.IsSafeToDereference().value:
print("Found second maneuver")
imSet.RemoveByName("IMTest2")
# Verify that it is gone.
imIter = imSet.FindByName("IMTest2")
if not imIter.IsSafeToDereference().value:
print("Second maneuver was deleted")
# At this point the only maneuvers left on the satellite should be
# FMTest1 and IMTest1.
Copy
sat = odtk.invoke('Scenario').invoke('Item', 0).invoke('Satellite').invoke('Satellite1') ;
%-------------------------------------------------------
% Finite maneuver example
%-------------------------------------------------------
% Clear out any existing finite maneuvers and add a new
% one in.
fmSet = sat.invoke('ForceModel').invoke('FiniteManeuvers');
fmSet.invoke('clear');
% Create a new maneuver to model a cross-track delta-I
fmIter = fmSet.invoke('InsertNew', 'FiniteManConstThrust');
if (fmIter.invoke('IsSafeToDereference').invoke('Value'))
fm = fmIter.invoke('Dereference');
fm.set('Name', 'FMTest1');
fm.set('Enabled', true);
fm.set('Frame', 'Gaussian (RIC)');
fm.set('Estimate', 'MagnitudeAndPointing');
% Configure the burn time
fm.invoke('Time').set('StopMode', 'TimeSpan');
fm.invoke('Time').invoke('StartTime').invoke('Set', '1 Jun 2009 00:00:00', 'UTCG');
fm.invoke('Time').invoke('TimeSpan').invoke('Set', '45', 'min');
% Configure the burn parameters
fm.invoke('Thrust').set('Specification', 'ByComponent');
fm.invoke('Thrust').invoke('ThrustX').invoke('Set', 0, 'N');
fm.invoke('Thrust').invoke('ThrustY').invoke('Set', 0, 'N');
fm.invoke('Thrust').invoke('ThrustZ').invoke('Set', 2, 'lbf');
% Configure the mass loss
fm.invoke('Mass').set('LossMethod', 'BasedOnIsp');
fm.invoke('Mass').invoke('Isp').invoke('Set', 325.0,'sec');
% Configure the burn uncertainty
fm.invoke('Uncertainty').set('Type', '%MagnitudeAndPointing');
fm.invoke('Uncertainty').invoke('PercentMagnitudeSigma').invoke('Set', 3.0, '%');
fm.invoke('Uncertainty').invoke('PointingSigma').invoke('Set', 1.5, 'deg');
fm.invoke('Uncertainty').invoke('MagnitudeHalfLife').invoke('Set', 1, 'hr');
fm.invoke('Uncertainty').invoke('PointingHalfLife').invoke('Set', 1, 'hr');
end
% Add in a second maneuver as a dummy maneuver just
% to prove that we can find the right maneuver
fmIter = fmSet.invoke('InsertNew', 'FiniteManConstThrust');
if fmIter.invoke('IsSafeToDereference').invoke('Value')
fm = fmIter.invoke('Dereference');
% We'll set the name and accept the defaults for all the
% other parameters.
fm.set('Name', 'FMTest2');
end
% Now try to find the first maneuver and report the
% thrust.
fmIter = fmSet.invoke('FindByName', 'FMTest1');
if fmIter.invoke('IsSafeToDereference').invoke('Value')
fm = fmIter.invoke('Dereference');
fprintf('Found maneuver %s\nThrust is %f lbf\n', fm.invoke('Name').invoke('Value'), fm.invoke('Thrust').invoke('ThrustZ').invoke('GetIn', 'lbf').invoke('Value'));
end
% Now delete the second maneuver
fmIter = fmSet.invoke('FindByName', 'FMTest2');
if fmIter.invoke('IsSafeToDereference').invoke('Value')
fprintf('Found second maneuver\n');
fmSet.invoke('RemoveByName', 'FMTest2');
end
% Verify that the second maneuver is gone.invoke(
fmIter = fmSet.invoke('FindByName', 'FMTest2');
if not(fmIter.invoke('IsSafeToDereference').invoke('Value'))
fprintf('Second maneuver was deleted\n');
end
%-------------------------------------------------------
% Impulsive maneuver example
%-------------------------------------------------------
% Clear out any existing impulsive maneuvers and add a new
% one in.invoke(
imSet = sat.invoke('ForceModel').invoke('ImpulsiveManeuvers');
imSet.invoke('clear');
% Create a new maneuver to model an in-track Delta-V
imIter = imSet.invoke('InsertNew', 'ImpulsiveManDeltaV');
if imIter.invoke('IsSafeToDereference').invoke('Value')
im = imIter.invoke('Dereference');
im.set('Name', 'IMTest1');
im.set('Enabled', true);
im.set('Frame', 'Gaussian (RIC)');
% Configure the burn time (assumes the actual burn is
% 4 minutes long but is modeled as an impulsive burn)
im.invoke('Epoch').invoke('Set', '1 Jan 2009 01:23:45', 'UTCG');
im.invoke('TimeAfterStart').invoke('Set', 2, 'min');
im.invoke('TimeBeforeEnd').invoke('Set', 2, 'min');
% Configure the burn parameters
im.invoke('DeltaV').set('Specification', 'ByComponent');
im.invoke('DeltaV').invoke('DeltaVX').invoke('Set', 0.0, 'm/sec');
im.invoke('DeltaV').invoke('DeltaVY').invoke('Set', 0.1, 'm/sec');
im.invoke('DeltaV').invoke('DeltaVZ').invoke('Set', 0.0, 'm/sec');
% Configure the mass loss
im.invoke('Mass').set('LossMethod', 'Explicit');
im.invoke('Mass').invoke('MassLoss').invoke('Set', 1,'kg');
% Configure the burn uncertainty
im.invoke('Uncertainty').set('Type', 'ByComponent');
im.invoke('Uncertainty').invoke('XSigma').invoke('Set', 0.01, 'm/sec');
im.invoke('Uncertainty').invoke('YSigma').invoke('Set', 0.02, 'm/sec');
im.invoke('Uncertainty').invoke('ZSigma').invoke('Set', 0.01, 'm/sec');
end
% Add in a second maneuver as a dummy maneuver just
% to prove that we can find the right maneuver
imIter = imSet.invoke('InsertNew', 'ImpulsiveManDeltaV');
if imIter.invoke('IsSafeToDereference').invoke('Value')
im = imIter.invoke('Dereference');
% We'll set the name and accept the defaults for all the
% other parameters.
im.set('Name', 'IMTest2');
end
% Now try to find the first maneuver and report the Delta-V
imIter = imSet.invoke('FindByName', 'IMTest1');
if imIter.invoke('IsSafeToDereference').invoke('Value')
im = imIter.invoke('Dereference');
fprintf('Found maneuver %s\nDelta-V is %f m/sec\n', im.invoke('Name').invoke('Value'), im.invoke('DeltaV').invoke('DeltaVY').invoke('GetIn', 'm/sec').invoke('Value'));
end
% Now delete the second maneuver
imIter = imSet.invoke('FindByName', 'IMTest2');
if imIter.invoke('IsSafeToDereference').invoke('Value')
fprintf('Found second maneuver\n');
imSet.invoke('RemoveByName', 'IMTest2');
end
% Verify that it is gone
imIter = imSet.invoke('FindByName', 'IMTest2');
if not(imIter.invoke('IsSafeToDereference').invoke('Value'))
fprintf('Second maneuver was deleted\n');
end
% At this point the only maneuvers left on the satellite should be
% FMTest1 and IMTest1.
Cross-Platform API
Copy
# -------------------------------------------------------
# Finite maneuver example
# -------------------------------------------------------
# Clear out any existing finite maneuvers and add a new
# one in.
finite_maneuvers = satellite.ForceModel.FiniteManeuvers
finite_maneuvers.clear()
# Create a new maneuver to model a cross-track delta-I
fm_iter = finite_maneuvers.InsertNew('FiniteManConstThrust')
if fm_iter.IsSafeToDereference():
fm = fm_iter.Dereference()
fm.Name = 'FMTest1'
fm.Enabled = True
fm.Frame = 'Gaussian (RIC)'
fm.Estimate = 'MagnitudeAndPointing'
# Configure the burn time
fm.Time.StopMode = 'TimeSpan'
fm.Time.StartTime.Set('1 Jun 2009 00:00:00', 'UTCG')
fm.Time.TimeSpan.Set('45', 'min')
# Configure the burn parameters
fm.Thrust.Specification = 'ByComponent'
fm.Thrust.ThrustX.Set(0, 'N')
fm.Thrust.ThrustY.Set(0, 'N')
fm.Thrust.ThrustZ.Set(2, 'lbf')
# Configure the mass loss
fm.Mass.LossMethod = 'BasedOnIsp'
fm.Mass.Isp.Set(325.0, 'sec')
# Configure the burn uncertainty
fm.Uncertainty.Type = '%MagnitudeAndPointing'
fm.Uncertainty.PercentMagnitudeSigma.Set(3.0, '%')
fm.Uncertainty.PointingSigma.Set(1.5, 'deg')
fm.Uncertainty.MagnitudeHalfLife.Set(1, 'hr')
fm.Uncertainty.PointingHalfLife.Set(1, 'hr')
# Add in a second maneuver as a dummy maneuver just
# to prove that we can find the right maneuver
fm_iter = finite_maneuvers.InsertNew('FiniteManConstThrust')
if fm_iter.IsSafeToDereference():
fm = fm_iter.Dereference()
# We'll set the name and accept the defaults for all the
# other parameters.
fm.Name = 'FMTest2'
# Now try to find the first maneuver and report the
# thrust.
fm_iter = finite_maneuvers.FindByName('FMTest1')
if fm_iter.IsSafeToDereference():
fm = fm_iter.Dereference()
print(f'Found maneuver {str(fm.Name.eval())}\nThrust is {fm.Thrust.ThrustZ.GetIn("lbf")} lbf')
# Now delete the second maneuver
fm_iter = finite_maneuvers.FindByName('FMTest2')
if fm_iter.IsSafeToDereference():
fm = fm_iter.Dereference()
print(f'Found maneuver {fm.Name.eval()}\nThrust is {fm.Thrust.ThrustZ.GetIn("lbf")} lbf')
finite_maneuvers.RemoveByName('FMTest2')
# Verify that the second maneuver is gone.
fm_iter = finite_maneuvers.FindByName('FMTest2')
if not fm_iter.IsSafeToDereference():
print('Second maneuver was deleted')
# -------------------------------------------------------
# Impulsive maneuver example
# -------------------------------------------------------
# Clear out any existing impulsive maneuvers and add a new
# one in.
impulsive_maneuvers = satellite.ForceModel.ImpulsiveManeuvers
impulsive_maneuvers.clear()
# Create a new maneuver to model an in-track Delta-V
im_iter = impulsive_maneuvers.InsertNew('ImpulsiveManDeltaV')
if im_iter.IsSafeToDereference():
im = im_iter.Dereference()
im.Name = 'IMTest1'
im.Enabled = True
im.Frame = 'Gaussian (RIC)'
# Configure the burn time (assumes the actual burn is
# 4 minutes long but is modeled as an impulsive burn)
im.Epoch.Set('1 Jan 2009 01:23:45', 'UTCG')
im.TimeAfterStart.Set(2, 'min')
im.TimeBeforeEnd.Set(2, 'min')
# Configure the burn parameters
im.DeltaV.Specification = 'ByComponent'
im.DeltaV.DeltaVX.Set(0.0, 'm/sec')
im.DeltaV.DeltaVY.Set(0.1, 'm/sec')
im.DeltaV.DeltaVZ.Set(0.0, 'm/sec')
# Configure the mass loss
im.Mass.LossMethod = 'Explicit'
im.Mass.MassLoss.Set(1, 'kg')
# Configure the burn uncertainty
im.Uncertainty.Type = 'ByComponent'
im.Uncertainty.XSigma.Set(0.01, 'm/sec')
im.Uncertainty.YSigma.Set(0.02, 'm/sec')
im.Uncertainty.ZSigma.Set(0.01, 'm/sec')
# Add in a second maneuver as a dummy maneuver just
# to prove that we can find the right maneuver
im_iter = impulsive_maneuvers.InsertNew('ImpulsiveManDeltaV')
if im_iter.IsSafeToDereference():
im = im_iter.Dereference()
# We'll set the name and accept the defaults for all the
# other parameters.
im.Name = 'IMTest2'
# Now try to find the first maneuver and report the Delta-V
im_iter = impulsive_maneuvers.FindByName('IMTest1')
if im_iter.IsSafeToDereference():
im = im_iter.Dereference()
print(f'Found maneuver {im.Name.eval()}\nDelta-V is {im.DeltaV.DeltaVY.GetIn("m/sec")}m/sec')
# Now delete the second maneuver
im_iter = impulsive_maneuvers.FindByName('IMTest2')
if im_iter.IsSafeToDereference():
print('Found second maneuver')
impulsive_maneuvers.RemoveByName('IMTest2')
# Verify that it is gone.
im_iter = impulsive_maneuvers.FindByName('IMTest2')
if not im_iter.IsSafeToDereference():
print('Second maneuver was deleted')
Copy
% -------------------------------------------------------
% Finite maneuver example
% -------------------------------------------------------
% Clear out any existing finite maneuvers and add a new
% one in.
finiteManeuvers = satellite.ForceModel.FiniteManeuvers;
finiteManeuvers.clear();
% Create a new maneuver to model a cross-track delta-I
fmIter = finiteManeuvers.InsertNew("FiniteManConstThrust");
if fmIter.IsSafeToDereference()
fm = fmIter.Dereference();
fm.Name = "FMTest1";
fm.Enabled = true;
fm.Frame = "Gaussian (RIC)";
fm.Estimate = "MagnitudeAndPointing";
% Configure the burn time
fm.Time.StopMode = "TimeSpan";
fm.Time.StartTime.Set("1 Jun 2009 00:00:00", "UTCG");
fm.Time.TimeSpan.Set("45", "min");
% Configure the burn parameters
fm.Thrust.Specification = "ByComponent";
fm.Thrust.ThrustX.Set(0, "N");
fm.Thrust.ThrustY.Set(0, "N");
fm.Thrust.ThrustZ.Set(2, "lbf");
% Configure the mass loss
fm.Mass.LossMethod = "BasedOnIsp";
fm.Mass.Isp.Set(325.0, "sec");
% Configure the burn uncertainty
fm.Uncertainty.Type = "%MagnitudeAndPointing";
fm.Uncertainty.PercentMagnitudeSigma.Set(3.0, "%");
fm.Uncertainty.PointingSigma.Set(1.5, "deg");
fm.Uncertainty.MagnitudeHalfLife.Set(1, "hr");
fm.Uncertainty.PointingHalfLife.Set(1, "hr");
end
% Add in a second maneuver as a dummy maneuver just
% to prove that we can find the right maneuver
fmIter = finiteManeuvers.InsertNew("FiniteManConstThrust");
if fmIter.IsSafeToDereference()
fm = fmIter.Dereference();
% We'll set the name and accept the defaults for all the
% other parameters.
fm.Name = "FMTest2";
end
% Now try to find the first maneuver and report the
% thrust.
fmIter = finiteManeuvers.FindByName("FMTest1");
if fmIter.IsSafeToDereference()
fm = fmIter.Dereference();
fprintf("Found maneuver %s\nThrust is %f lbf\n", fm.Name, fm.Thrust.ThrustZ.GetIn("lbf"));
end
% Now delete the second maneuver
fmIter = finiteManeuvers.FindByName("FMTest2");
if fmIter.IsSafeToDereference()
fm = fmIter.Dereference();
fprintf("Found maneuver %s\nThrust is %f lbf\n", fm.Name, fm.Thrust.ThrustZ.GetIn("lbf"));
finiteManeuvers.RemoveByName("FMTest2");
end
% Verify that the second maneuver is gone.
fmIter = finiteManeuvers.FindByName("FMTest2");
if ~fmIter.IsSafeToDereference()
fprintf("Second maneuver was deleted\n");
end
% -------------------------------------------------------
% Impulsive maneuver example
% -------------------------------------------------------
% Clear out any existing impulsive maneuvers and add a new
% one in.
impulsiveManeuvers = satellite.ForceModel.ImpulsiveManeuvers;
impulsiveManeuvers.clear();
% Create a new maneuver to model an in-track Delta-V
imIter = impulsiveManeuvers.InsertNew("ImpulsiveManDeltaV");
if imIter.IsSafeToDereference()
im = imIter.Dereference();
im.Name = "IMTest1";
im.Enabled = true;
im.Frame = "Gaussian (RIC)";
% Configure the burn time (assumes the actual burn is
% 4 minutes long but is modeled as an impulsive burn)
im.Epoch.Set("1 Jan 2009 01:23:45", "UTCG");
im.TimeAfterStart.Set(2, "min");
im.TimeBeforeEnd.Set(2, "min");
% Configure the burn parameters
im.DeltaV.Specification = "ByComponent";
im.DeltaV.DeltaVX.Set(0.0, "m/sec");
im.DeltaV.DeltaVY.Set(0.1, "m/sec");
im.DeltaV.DeltaVZ.Set(0.0, "m/sec");
% Configure the mass loss
im.Mass.LossMethod = "Explicit";
im.Mass.MassLoss.Set(1, "kg");
% Configure the burn uncertainty
im.Uncertainty.Type = "ByComponent";
im.Uncertainty.XSigma.Set(0.01, "m/sec");
im.Uncertainty.YSigma.Set(0.02, "m/sec");
im.Uncertainty.ZSigma.Set(0.01, "m/sec");
end
% Add in a second maneuver as a dummy maneuver just
% to prove that we can find the right maneuver
imIter = impulsiveManeuvers.InsertNew("ImpulsiveManDeltaV");
if imIter.IsSafeToDereference()
im = imIter.Dereference();
% We'll set the name and accept the defaults for all the
% other parameters.
im.Name = "IMTest2";
end
% Now try to find the first maneuver and report the Delta-V
imIter = impulsiveManeuvers.FindByName("IMTest1");
if imIter.IsSafeToDereference()
im = imIter.Dereference();
fprintf("Found maneuver %s\nDelta-V is %f m/sec\n", im.Name, im.DeltaV.DeltaVY.GetIn("m/sec"));
end
% Now delete the second maneuver
imIter = impulsiveManeuvers.FindByName("IMTest2");
if imIter.IsSafeToDereference()
fprintf("Found second maneuver\n");
impulsiveManeuvers.RemoveByName("IMTest2");
end
% Verify that it is gone.
imIter = impulsiveManeuvers.FindByName("IMTest2");
if ~imIter.IsSafeToDereference()
fprintf("Second maneuver was deleted\n");
end
Copy
// ------------------------------------------------------ -
// Finite maneuver example
// ------------------------------------------------------ -
// Clear out any existing finite maneuvers and add a new
// one in.
const agi::odtk::AttrProxy finiteManeuvers = satellite("ForceModel")("FiniteManeuvers");
finiteManeuvers("clear").Invoke();
// Create a new maneuver to model a cross - track delta - I
const agi::odtk::AttrProxy fmIter = finiteManeuvers("InsertNew").InvokeAttrProxy("FiniteManConstThrust");
if (fmIter("IsSafeToDereference").InvokeBool())
{
const auto fm = fmIter("Dereference").InvokeAttrProxy();
fm("Name").Assign("FMTest1");
fm("Enabled").Assign(true);
fm("Frame").Assign("Gaussian(RIC)");
fm("Estimate").Assign("MagnitudeAndPointing");
// Configure the burn time
fm("Time")("StopMode").Assign("TimeSpan");
fm("Time")("StartTime")("Set").Invoke("1 Jun 2009 00:00 : 00", "UTCG");
fm("Time")("TimeSpan")("Set").Invoke("45", "min");
// Configure the burn parameters
fm("Thrust")("Specification").Assign("ByComponent");
fm("Thrust")("ThrustX")("Set").Invoke(0, "N");
fm("Thrust")("ThrustY")("Set").Invoke(0, "N");
fm("Thrust")("ThrustZ")("Set").Invoke(2, "lbf");
// Configure the mass loss
fm("Mass")("LossMethod").Assign("BasedOnIsp");
fm("Mass")("Isp")("Set").Invoke(325.0, "sec");
// Configure the burn uncertainty
fm("Uncertainty")("Type").Assign("%MagnitudeAndPointing");
fm("Uncertainty")("PercentMagnitudeSigma")("Set").Invoke(3.0, "%");
fm("Uncertainty")("PointingSigma")("Set").Invoke(1.5, "deg");
fm("Uncertainty")("MagnitudeHalfLife")("Set").Invoke(1, "hr");
fm("Uncertainty")("PointingHalfLife")("Set").Invoke(1, "hr");
}
// Add in a second maneuver as a dummy maneuver just
// to prove that we can find the right maneuver
const auto fmIter2 = finiteManeuvers("InsertNew").InvokeAttrProxy("FiniteManConstThrust");
if (fmIter2("IsSafeToDereference").InvokeBool())
{
const agi::odtk::AttrProxy fm = fmIter2("Dereference").InvokeAttrProxy();
// We'll set the name and accept the defaults for all the
// other parameters.
fm("Name").Assign("FMTest2");
}
// Now try to find the first maneuver and report the
// thrust.
const agi::odtk::AttrProxy fmIter3 = finiteManeuvers("FindByName").InvokeAttrProxy("FMTest1");
if (fmIter3("IsSafeToDereference").InvokeBool())
{
const agi::odtk::AttrProxy fm = fmIter3("Dereference").InvokeAttrProxy();
std::cout << "Found maneuver " << fm("Name").AsString() << "\nThrust is " << fm("Thrust")("ThrustZ")("GetIn").InvokeDouble("lbf") << " lbf\n";
}
// Now delete the second maneuver
const agi::odtk::AttrProxy fmIter4 = finiteManeuvers("FindByName").InvokeAttrProxy("FMTest2");
if (fmIter4("IsSafeToDereference").InvokeBool())
{
const auto fm = fmIter4("Dereference").InvokeAttrProxy();
std::cout << "Found maneuver " << fm("Name").AsString() << "\nThrust is " << fm("Thrust")("ThrustZ")("GetIn").InvokeDouble("lbf") << " lbf\n";
finiteManeuvers("RemoveByName").Invoke("FMTest2");
}
// Verify that the second maneuver is gone.
const agi::odtk::AttrProxy fmIter5 = finiteManeuvers("FindByName").InvokeAttrProxy("FMTest2");
if (!fmIter5("IsSafeToDereference").InvokeBool())
{
std::cout << "Second maneuver was deleted\n";
}
// ------------------------------------------------------
// Impulsive maneuver example
// ------------------------------------------------------
// Clear out any existing impulsive maneuvers and add a new
// one in.
const agi::odtk::AttrProxy impulsiveManeuvers = satellite("ForceModel")("ImpulsiveManeuvers");
impulsiveManeuvers("clear").Invoke();
// Create a new maneuver to model an in - track delta - V
const agi::odtk::AttrProxy imIter = impulsiveManeuvers("InsertNew").InvokeAttrProxy("ImpulsiveManDeltaV");
if (imIter("IsSafeToDereference").InvokeBool())
{
const auto im = imIter("Dereference").InvokeAttrProxy();
im("Name").Assign("IMTest1");
im("Enabled").Assign(true);
im("Frame").Assign("Gaussian (RIC)");
// Configure the burn time(assumes the actual burn is
// 4 minutes long but is modeled as an impulsive burn)
im("Epoch")("Set").Invoke("1 Jan 2009 01:23:45", "UTCG");
im("TimeAfterStart")("Set").Invoke(2, "min");
im("TimeBeforeEnd")("Set").Invoke(2, "min");
// Configure the burn parameters
im("DeltaV")("Specification").Assign("ByComponent");
im("DeltaV")("DeltaVX")("Set").Invoke(0.0, "m/sec");
im("DeltaV")("DeltaVY")("Set").Invoke(0.1, "m/sec");
im("DeltaV")("DeltaVZ")("Set").Invoke(0.0, "m/sec");
// Configure the mass loss
im("Mass")("LossMethod").Assign("Explicit");
im("Mass")("MassLoss")("Set").Invoke(1, "kg");
// Configure the burn uncertainty
im("Uncertainty")("Type").Assign("ByComponent");
im("Uncertainty")("XSigma")("Set").Invoke(0.01, "m/sec");
im("Uncertainty")("YSigma")("Set").Invoke(0.02, "m/sec");
im("Uncertainty")("ZSigma")("Set").Invoke(0.01, "m/sec");
}
// Add in a second maneuver as a dummy maneuver just
// to prove that we can find the right maneuver
const agi::odtk::AttrProxy imIter2 = impulsiveManeuvers("InsertNew").InvokeAttrProxy("ImpulsiveManDeltaV");
if (imIter2("IsSafeToDereference").InvokeBool())
{
const agi::odtk::AttrProxy im = imIter2("Dereference").InvokeAttrProxy();
// We'll set the name and accept the defaults for all the
// other parameters.
im("Name").Assign("IMTest2");
}
// Now try to find the first maneuver and report the delta - V
const agi::odtk::AttrProxy imIter3 = impulsiveManeuvers("FindByName").InvokeAttrProxy("IMTest1");
if (imIter3("IsSafeToDereference").InvokeBool())
{
const auto im = imIter3("Dereference").InvokeAttrProxy();
std::cout << "Found maneuver " << im("Name").AsString() << "\nDelta-V is " << im("DeltaV")("DeltaVY")("GetIn").InvokeDouble("m/sec") << "m/sec\n";
}
// Now delete the second maneuver
const auto imIter4 = impulsiveManeuvers("FindByName").InvokeAttrProxy("IMTest2");
if (imIter4("IsSafeToDereference").InvokeBool())
{
std::cout << "Found second maneuver\n";
impulsiveManeuvers("RemoveByName").Invoke("IMTest2");
}
// Verify that it is gone.
const agi::odtk::AttrProxy imIter5 = impulsiveManeuvers("FindByName").InvokeAttrProxy("IMTest2");
if (!imIter5("IsSafeToDereference").InvokeBool())
{
std::cout << "Second maneuver was deleted\n";
}
Copy
// ------------------------------------------------------ -
// Finite maneuver example
// ------------------------------------------------------ -
// Clear out any existing finite maneuvers and add a new
// one in.
AttrProxy finiteManeuvers = satellite.get("ForceModel.FiniteManeuvers");
finiteManeuvers.get("clear").invoke();
AttrProxy fm = null;
// Create a new maneuver to model a cross-track delta-I
AttrProxy fmIter = finiteManeuvers.get("InsertNew").invokeAttr("FiniteManConstThrust");
if (fmIter.get("IsSafeToDereference").invokeBool()) {
fm = fmIter.get("Dereference").invokeAttr();
fm.get("Name").assign("FMTest1");
fm.get("Enabled").assign(true);
fm.get("Frame").assign("Gausian(RIC)");
fm.get("Estimate").assign("MagnitudeAndPointing");
// Configure the burn time
fm.get("Time.StopMode").assign("TimeSpan");
fm.get("Time.StartTime.Set").invoke("1 Jun 2009 00:00:00", "UTCG");
fm.get("Time.TimeSpan.Set").invoke("45", "min");
// Configure the burn parameters
fm.get("Thrust.Specification").assign("ByComponent");
fm.get("Thrust.ThrustX.Set").invoke(0, "N");
fm.get("Thrust.ThrustY.Set").invoke(0, "N");
fm.get("Thrust.ThrustZ.Set").invoke(2, "lbf");
// Configure the mass loss
fm.get("Mass.LossMethod").assign("BasedOnIsp");
fm.get("Mass.Isp.Set").invoke(325.0, "sec");
// Configure the burn uncertainty
fm.get("Uncertainty.Type").assign("%MagnitudeAndPointing");
fm.get("Uncertainty.PercentMagnitudeSigma.Set").invoke(3.0, "%");
fm.get("Uncertainty.PointingSigma.Set").invoke(1.5, "deg");
fm.get("Uncertainty.MagnitudeHalfLife.Set").invoke(1, "hr");
fm.get("Uncertainty.PointingHalfLife.Set").invoke(1, "hr");
}
// Add in a second maneuver as a dummy maneuver just
// to prove that we can find the right maneuver
fmIter = finiteManeuvers.get("InsertNew").invokeAttr("FiniteManConstThrust");
if (fmIter.get("IsSafeToDereference").invokeBool()) {
fm = fmIter.get("Dereference").invokeAttr();
// We'll set the name and accept the defaults for all the other parameters.
fm.get("Name").assign("FMTest2");
}
// Now try to find the first maneuver and report the thrust.
fmIter = finiteManeuvers.get("FindByName").invokeAttr("FMTest1");
if (fmIter.get("IsSafeToDereference").invokeBool()) {
fm = fmIter.get("Dereference").invokeAttr();
System.out.println("Found maneuver " + fm.get("Name").asString());
System.out.println("Thrust is " + fm.get("Thrust.ThrustZ.GetIn").invokeString("lbf") + " lbf");
}
// Now delete the second maneuver
fmIter = finiteManeuvers.get("FindByName").invokeAttr("FMTest2");
if (fmIter.get("IsSafeToDereference").invokeBool()) {
fm = fmIter.get("Dereference").invokeAttr();
System.out.println("Found maneuver " + fm.get("Name").asString());
System.out.println("Thrust is " + fm.get("Thrust.ThrustZ.GetIn").invokeString("lbf") + " lbf");
finiteManeuvers.get("RemoveByName").invoke("FMTest2");
}
// Verify that the second maneuver is gone.
fmIter = finiteManeuvers.get("FindByName").invokeAttr("FMTest2");
if (!fmIter.get("IsSafeToDereference").invokeBool()) {
System.out.println("Second maneuver was deleted");
}
// ------------------------------------------------------
// Impulsive maneuver example
// ------------------------------------------------------
// Clear out any existing impulsive maneuvers and add a new
// one in.
AttrProxy impulsiveManeuvers = satellite.get("ForceModel.ImpulsiveManeuvers");
impulsiveManeuvers.get("clear").invoke();
// Create a new maneuver to model an in-track delta-V
AttrProxy imIter = impulsiveManeuvers.get("InsertNew").invokeAttr("ImpulsiveManDeltaV");
AttrProxy im = null;
if (imIter.get("IsSafeToDereference").invokeBool()) {
im = imIter.get("Dereference").invokeAttr();
im.get("Name").assign("IMTest1");
im.get("Enabled").assign(true);
im.get("Frame").assign("Gausian(RIC)");
// Configure the burn time (assumes the actual burn is
// 4 minutes long but is modeled as an impulsive burn);
im.get("Epoch.Set").invoke("1 Jan 2009 01:23:45", "UTCG");
im.get("TimeAfterStart.Set").invoke(2, "min");
im.get("TimeBeforeEnd.Set").invoke(2, "min");
// Configure the burn parameters
im.get("DeltaV.Specification").assign("ByComponent");
im.get("DeltaV.DeltaVX.Set").invoke(0.0, "m/sec");
im.get("DeltaV.DeltaVY.Set").invoke(0.1, "m/sec");
im.get("DeltaV.DeltaVZ.Set").invoke(0.0, "m/sec");
// Configure the mass loss
im.get("Mass.LossMethod").assign("Explicit");
im.get("Mass.MassLoss.Set").invoke(1, "kg");
// Configure the burn uncertainty
im.get("Uncertainty.Type").assign("ByComponent");
im.get("Uncertainty.XSigma.Set").invoke(0.01, "m/sec");
im.get("Uncertainty.YSigma.Set").invoke(0.02, "m/sec");
im.get("Uncertainty.ZSigma.Set").invoke(0.01, "m/sec");
}
// Add in a second maneuver as a dummy maneuver just
// to prove that we can find the right maneuver
imIter = impulsiveManeuvers.get("InsertNew").invokeAttr("ImpulsiveManDeltaV");
if (imIter.get("IsSafeToDereference").invokeBool()) {
im = imIter.get("Dereference").invokeAttr();
// We'll set the name and accept the defaults for all the
// other parameters.
im.get("Name").assign("IMTest2");
}
// Now try to find the first maneuver and report the delta-V
imIter = impulsiveManeuvers.get("FindByName").invokeAttr("IMTest1");
if (imIter.get("IsSafeToDereference").invokeBool()) {
im = imIter.get("Dereference").invokeAttr();
System.out.println("Found maneuver " + im.get("Name").asString());
System.out.printf("Delta-V is %f m/sec\n", im.get("DeltaV.DeltaVY.GetIn").invokeDouble("m/sec"));
}
// Now delete the second maneuver
imIter = impulsiveManeuvers.get("FindByName").invokeAttr("IMTest2");
if (imIter.get("IsSafeToDereference").invokeBool()) {
System.out.println("Found second maneuver");
impulsiveManeuvers.get("RemoveByName").invoke("IMTest2");
}
// Verify that it is gone.
imIter = impulsiveManeuvers.get("FindByName").invokeAttr("IMTest2");
if (!imIter.get("IsSafeToDereference").invokeBool()) {
System.out.println("Second maneuver was deleted");
}
Add Rectified Sinusoid1D model
For this case, the scripting is generally similiar to the Finite Manuevers. However, below is an example of VBS script code that adds a RevRectifiedSinusoid1D Model in the Radial Direction.
COM
Copy
Set efSet = sat.ForceModel.EmpiricalForces
efSet.clear()
set efIter = efSet.InsertNew("RevRectifiedSinusoid1D")
if efIter.IsSafeToDereference() then
set ef = efIter.Dereference()
ef.Name = "EFRadial"
ef.Enabled = true
ef.Estimate = false
ef.Frame = "Gaussian (RIC)"
ef.Direction = "Radial"
ef.A0Constant.Type = "Vasicek"
ef.A0Constant.LongTerm.Constant.Set 0,"m*sec^-2"
ef.A0Constant.LongTerm.Sigma.Set 1e-7,"m*sec^-2"
ef.A0Constant.ShortTerm.InitialEstimate.Set 0,"m*sec^-2"
ef.A0Constant.ShortTerm.Sigma.Set 1e-7,"m*sec^-2"
ef.A0Constant.ShortTerm.HalfLife.Set 200,"min"
ef.A1SinCoef.Type = "GaussMarkov"
ef.A1SinCoef.Constant.Set 0,"m*sec^-2"
ef.A1SinCoef.Sigma.Set 1e-5,"m*sec^-2"
ef.A1SinCoef.InitialEstimate.Set 0,"m*sec^-2"
ef.A1SinCoef.HalfLife.Set 360,"min"
ef.A2CosCoef.Type = "GaussMarkov"
ef.A2CosCoef.Constant.Set 0,"m*sec^-2"
ef.A2CosCoef.Sigma.Set 1e-5,"m*sec^-2"
ef.A2CosCoef.InitialEstimate.Set 0,"m*sec^-2"
ef.A2CosCoef.HalfLife.Set 360,"min"
End if