From 6f974e3af3c08711bed15ab07e7ee533fe7ad784 Mon Sep 17 00:00:00 2001 From: Matthew Dailis Date: Fri, 12 Jul 2024 23:25:58 -0700 Subject: [PATCH] Initial implementation of spawn and call for non-activity subtasks --- .../getting-started/1-gettingstarted.md | 300 ++++++++ .../getting-started/2-model-test-drive.md | 28 + .../3-enum-derived-resource.md | 65 ++ .../getting-started/4-current-value.md | 40 ++ .../getting-started/5-second-look.md | 27 + .../getting-started/6-integrating-rate.md | 284 ++++++++ .../7-integration-comparision.md | 51 ++ .../getting-started/8-simulation-config.md | 126 ++++ docs-src/1_tutorials/getting-started/index.md | 15 + docs-src/2_guides/index.md | 1 + .../pymerlin/pymerlin.model_actions.rst | 4 +- docs-src/glossary.md | 15 + docs-src/quickstart.md | 2 +- .../getting-started/1-gettingstarted.html | 652 ++++++++++++++++++ .../getting-started/2-model-test-drive.html | 386 +++++++++++ .../3-enum-derived-resource.html | 420 +++++++++++ .../getting-started/4-current-value.html | 402 +++++++++++ .../getting-started/5-second-look.html | 390 +++++++++++ .../getting-started/6-integrating-rate.html | 627 +++++++++++++++++ .../7-integration-comparision.html | 410 +++++++++++ .../getting-started/8-simulation-config.html | 473 +++++++++++++ docs/1_tutorials/getting-started/index.html | 394 +++++++++++ docs/1_tutorials/index.html | 1 + docs/1_tutorials/tutorial2.html | 1 + docs/2_guides/build-jar.html | 1 + docs/2_guides/datamodel.html | 1 + docs/2_guides/index.html | 11 +- docs/2_guides/jupyter.html | 7 +- docs/2_guides/monte-carlo.html | 1 + docs/2_guides/organization.html | 398 +++++++++++ docs/2_guides/powermodel.html | 1 + docs/2_guides/scheduling.html | 1 + docs/2_guides/spice.html | 1 + docs/2_guides/telecom.html | 1 + docs/3_explanation/co-simulation.html | 1 + docs/3_explanation/command-errors.html | 1 + docs/3_explanation/fidelity.html | 1 + docs/3_explanation/index.html | 1 + docs/3_explanation/planning.html | 1 + docs/3_explanation/simulation.html | 1 + .../getting-started/1-gettingstarted.md.txt | 300 ++++++++ .../getting-started/2-model-test-drive.md.txt | 28 + .../3-enum-derived-resource.md.txt | 65 ++ .../getting-started/4-current-value.md.txt | 40 ++ .../getting-started/5-second-look.md.txt | 27 + .../getting-started/6-integrating-rate.md.txt | 284 ++++++++ .../7-integration-comparision.md.txt | 51 ++ .../8-simulation-config.md.txt | 126 ++++ .../1_tutorials/getting-started/index.md.txt | 15 + docs/_sources/2_guides/index.md.txt | 1 + docs/_sources/2_guides/organization.md.txt | 12 + .../pymerlin/pymerlin.model_actions.rst.txt | 4 +- docs/_sources/glossary.md.txt | 15 + docs/_sources/quickstart.md.txt | 2 +- docs/apidocs/index.html | 1 + docs/apidocs/pymerlin/pymerlin.duration.html | 1 + docs/apidocs/pymerlin/pymerlin.html | 1 + .../pymerlin/pymerlin.model_actions.html | 5 +- docs/architecture.html | 1 + docs/common-errors.html | 1 + docs/contribute.html | 1 + docs/developer.html | 1 + docs/documentation.html | 1 + docs/genindex.html | 1 + docs/glossary.html | 379 ++++++++++ docs/index.html | 1 + docs/license.html | 1 + docs/publishing.html | 1 + docs/py-modindex.html | 1 + docs/quickstart.html | 3 +- docs/search.html | 1 + docs/searchindex.js | 2 +- pymerlin/_internal/_directive_type.py | 5 +- pymerlin/_internal/_model_type.py | 9 +- pymerlin/_internal/_spawn_helpers.py | 15 + pymerlin/_internal/_task.py | 32 +- pymerlin/model_actions.py | 29 +- tests/test_simulation.py | 58 +- 78 files changed, 6989 insertions(+), 75 deletions(-) create mode 100644 docs-src/1_tutorials/getting-started/1-gettingstarted.md create mode 100644 docs-src/1_tutorials/getting-started/2-model-test-drive.md create mode 100644 docs-src/1_tutorials/getting-started/3-enum-derived-resource.md create mode 100644 docs-src/1_tutorials/getting-started/4-current-value.md create mode 100644 docs-src/1_tutorials/getting-started/5-second-look.md create mode 100644 docs-src/1_tutorials/getting-started/6-integrating-rate.md create mode 100644 docs-src/1_tutorials/getting-started/7-integration-comparision.md create mode 100644 docs-src/1_tutorials/getting-started/8-simulation-config.md create mode 100644 docs-src/1_tutorials/getting-started/index.md create mode 100644 docs-src/glossary.md create mode 100644 docs/1_tutorials/getting-started/1-gettingstarted.html create mode 100644 docs/1_tutorials/getting-started/2-model-test-drive.html create mode 100644 docs/1_tutorials/getting-started/3-enum-derived-resource.html create mode 100644 docs/1_tutorials/getting-started/4-current-value.html create mode 100644 docs/1_tutorials/getting-started/5-second-look.html create mode 100644 docs/1_tutorials/getting-started/6-integrating-rate.html create mode 100644 docs/1_tutorials/getting-started/7-integration-comparision.html create mode 100644 docs/1_tutorials/getting-started/8-simulation-config.html create mode 100644 docs/1_tutorials/getting-started/index.html create mode 100644 docs/2_guides/organization.html create mode 100644 docs/_sources/1_tutorials/getting-started/1-gettingstarted.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/2-model-test-drive.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/3-enum-derived-resource.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/4-current-value.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/5-second-look.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/6-integrating-rate.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/7-integration-comparision.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/8-simulation-config.md.txt create mode 100644 docs/_sources/1_tutorials/getting-started/index.md.txt create mode 100644 docs/_sources/2_guides/organization.md.txt create mode 100644 docs/_sources/glossary.md.txt create mode 100644 docs/glossary.html create mode 100644 pymerlin/_internal/_spawn_helpers.py diff --git a/docs-src/1_tutorials/getting-started/1-gettingstarted.md b/docs-src/1_tutorials/getting-started/1-gettingstarted.md new file mode 100644 index 0000000..e95b8ae --- /dev/null +++ b/docs-src/1_tutorials/getting-started/1-gettingstarted.md @@ -0,0 +1,300 @@ +# Getting Started + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Welcome Aerie modeling padawans! For your training today, you will be learning the basics of mission modeling in Aerie +by building your own simple model of an on-board spacecraft solid state recorder (SSR). This model will track the +recording rate into the recorder from a couple instruments along with the integrated data volume over time. Through the +process of building this model, you'll learn about the fundamental objects of a model, activities and resources, and +their structure. You'll be introduced to the different categories of resources and learn how you define and implement +each along with restrictions on when you can/can't modify them. As a bonus, we will also cover how you can make your +resources "unit aware" to prevent those pesky issues that come along with performing unit conversions and how you can +test your model without having to pull your model into an Aerie deployment. + +Let the training begin! + +## Installing pymerlin + +If you haven't already, go to the [quickstart](../../quickstart.md) guide to get set up with pymerlin. + +## Creating a Mission Model + +Start by creating a `mission.py` file with the following contents: + +```python +from pymerlin import MissionModel + + +@MissionModel +class Model: + def __init__(self, registrar): + self.data_model = DataModel(registrar) + + +class DataModel: + def __init__(self, registrar): + "YOUR CODE HERE" +``` + +## Your First Resource + +We will begin building our SSR model by creating a single resource, `recording_rate`, to track the rate at which data is +being written to the SSR over time. As a reminder, a **Resource** is any measurable quantity whose behavior we want to +track over the course of a plan. Then, we will create a simple activity, `collect_data`, that updates the `recording_rate` +by a user-specified rate for a user-specified duration. This activity is intended to represent an on-board camera taking +images and writing data to the spacecraft SSR. + +Although we could define the `recording_rate` resource directly in the pre-provided top-level `Mission` class, we'd like +to keep that class as simple as possible and delegate most of model's behavior definition to other, more focused +classes. With this in mind, let's create a new class within the `missionmodel` package called `DataModel`, which we will +eventually instantiate within the `Mission` class. + +In the `DataModel` class, declare the `recording_rate` resource by replacing `"YOUR CODE HERE"` with the following line +of code: + +```python +self.recording_rate = registrar.cell(0) # Megabits/s +``` + + + +Let's tease apart this line of code and use it as an opportunity to provide a brief overview of the various types of +resources available to you as a modeler. The mission modeling framework provides two primary classes from which to +define resources: + +1. `MutableResource` - resource whose value can be explicitly updated by activities or other modeling code after it has + been defined. Updates to the resource take the form of "Effects" such as `increase`, `decrease`, or `set`. The values + of this category of resource are explicitly tracked in objects called "Cells" within Aerie, which you can read about + in detail in + the [Aerie Software Design Document](https://ammos.nasa.gov/aerie-docs/overview/software-design-document/#cells) if + you are interested. +2. `Resource` - resource whose value cannot be explicitly updated after it has been defined. In other words, these + resources cannot be updated via "Effects". The most common use of these resources are to create "derived" resources + that are fully defined by the values of other resources (we will have some examples of these later). Since these + resources get their value from other resources, they actually don't need to store their own value within a "Cell". + Interestingly, the `MutableResource` class extends the `Resource` class and includes additional logic to ensure + values are correctly stored in these "Cells". + +From these classes, there are a few different types of resources provided, which are primarily distinguished by how the +value of the resource progresses between computed points: + +- `Discrete` - resource that maintains a constant value between computed points (i.e. a step function or piecewise + constant function). Discrete resources can be defined as many different types such as `Boolean`, `Integer`, `Double`, + or an enumeration. These types of resources are what you traditionally find in discrete event simulators and are the + easiest to define and "effect". +- `Linear` - resource that has a linear profile between computed points. When computing the value of such resources you + have to specify both the value of the resource at a given time along with a rate so that the resource knows how it + should change until the next point is computed. The resource does not have to be strictly continuous. In other words, + the linear segments that are computed for the resource do not have to match up. Unlike discrete resources, a linear + resource is implicitly defined as a `Double`. +- `Polynomial` - generalized version of the linear resource that allows you to define resources that evolve over time + based on polynomial functions. +- `Clock` - special resource type to provide "stopwatch" like functionality that allows you to track the time since an + event occurred. + +TODO: Add more content on `Clock` + +:::{note} +Polynomial resources currently cannot be rendered in the Aerie UI and must be transformed to a linear resource (an +example of this is shown later in the tutorial) +::: + +Looking back at our resource declaration, you can see that `recording_rate` is a `MutableResource` (we will emit effects +on this resource in our first activity) of the type `Discrete`, so the value of the resource will stay constant +until the next time we compute effects on it. + +Next, we must define and initialize our `recording_rate` resource, which we can do in a class constructor that takes one +parameter we'll called `registrar` of type `Registrar`. You can think of the `Registrar` class as your link to what will +ultimately get exposed in the UI and in a second we will use this class to register `recording_rate`. But first, let's +add the following line to the constructor we just made to fully define our resource. + +Both the `MutableResource` and `Discrete` classes have static helper functions for initializing resources of their type. +If you included those functions via `import static` statements, you get the simple line above. The `discrete()` function +expects an initial value for the resource, which we have specified as `0.0`. + +The last thing to do is to register `recording_rate` to the UI so we can view the resource as a timeline along with our +activity plan. This is accomplished with the following line of code: + +```python +registrar.resource("recording_rate", self.recording_rate.get); +``` + +:::{note} +Notice that `self.recording_rate.get` does not have parenthesies at the end. This is because we are registering +the `get` +function itself as a resource. Resources are functions that perform computations on cells +::: + +The first argument to this `resource` function is the string name of the resource you want to appear in the simulation +results, +and the second argument is the resource itself. + +You have now declared, defined, and registered your first resource and your `DataModel` class should look something like +this: + +```python +class DataModel: + def __init__(self, registrar): + self.recording_rate = registrar.cell(0) + registrar.resource("recording_rate", self.recording_rate.get) +``` + +With our `DataModel` class built, we can now instantiate it within the top-level `Model` class as a member variable of +that class. The `Registrar` that we are passing to `DataModel` is unique in that it can log simulation errors as a +resource, so we also need to instantiate one of these special error registrars as well. After these additions, +the `Mission` class should look like this: + +```python +from pymerlin import MissionModel + + +@MissionModel +class Model: + def __init__(self, registrar): + self.data_model = DataModel(registrar) + + +class DataModel: + def __init__(self, registrar): + self.recording_rate = registrar.cell(0) + registrar.resource("recording_rate", self.recording_rate.get) +``` + +## Your First Activity + +Now that we have a resource, let's build an activity called `collect_data` that emits effects on that resource. We can +imagine this activity representing a camera on-board a spacecraft that collects data over a short period of time. +Activities in Aerie follow the general definition given in +the [CCSDS Mission Planning and Scheduling Green Book](https://public.ccsds.org/Pubs/529x0g1.pdf) + +> "An activity is a meaningful unit of what can be planned… The granularity of a Planning Activity depends on the use +> case; It can be hierarchical" + +Essentially, activities are the building blocks for generating your plan. Activities in Aerie follow a class/object +relationship +where [activity types](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/introduction/) - defined +as a class in Java - describe the structure, properties, and behavior of an object and activity instances are the actual +objects that exist within a plan. + +Since activity types are implemented by async functions in python, create a new function called `collect_data` and add the +following decorator above that function, which allows pymerlin to recognize this function as an activity type. + +```python +@Model.ActivityType +async def collect_data(model): + pass +``` + +:::{note} +The `async` keyword allows pymerlin to interleave the execution of your new activity with other activities, which is +important when activities can pause and resume at various times +::: + +Let's define +two [parameters](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/parameters/), `rate` +and `duration`, and give them default arguments. Parameters allow the behavior of an activity to be modified by an +operator without modifying its code. + +```python +@Model.ActivityType +async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")): + pass +``` + +For our activity, we will give `rate` a default value of `10.0` megabits per second and `duration` a default value of +`1` hour using pymerlin's built-in `Duration` type. + +Right now, if an activity of this type was added to a plan, an operator could alter the parameter defaults to any value +allowed by the parameter's type. Let's say that due to buffer limitations of our camera, it can only collect data at a +rate of `100.0` megabits per second, and we want to notify the operator that any rate above this range is invalid. We +can do this +with [parameter validations](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/parameters/#validations) +by adding a method to our class with a couple of annotations: + +```python +@Model.ActivityType +@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps") +async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")): + pass +``` + +The `@Validation` decorator specifies a function to validate one or more parameters, and a message to present to the +operator when the validation fails. Now, as you will see soon, when an operator specifies a data rate above `100.0`, +Aerie will show a validation error and message. + +Next, we need to tell our activity how and when to effect change on the `recording_rate` resource, which is done in +an [Activity Effect Model](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/effect-model/). We do +this by filling out the body of the `collect_data` function. + +For our activity, we simply want to model data collection at a fixed rate specified by the `rate` parameter over the +full duration of the activity. Within the `run()` method, we can add the follow code to get that behavior: + +```python +@Model.ActivityType +@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps") +async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")): + model.data_model.recording_rate += rate + await delay(duration); + model.data_model.recording_rate -= rate +``` + +Effects on resources are accomplished by using one of the many static methods available in the class associated with +your resource type. In this case, `recording_rate` is a discrete resource, and therefore we are using methods from +the `DiscreteEffects` class. If you peruse the static methods in `DiscreteEffects`, you'll see methods +like `set()`, `increase()`, `decrease()`, `consume()`, `restore()`,`using()`, etc. Since discrete resources can be of +many primitive types (e.g. `Double`,`Boolean`), there are specific methods for each type. Most of these effects change +the value of the resource at one time point instantaneously, but some, like `using()`, allow you to specify +an [action](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/effect-model/#actions) to run +like `delay()`. Prior to executing the action, the resource changes just like other effects, but once the action is +complete, the effect on the resource is reversed. These resource effects are sometimes called "renewable" in contrast to +the other style of effects, which are often called "consumable". + +In our effect model for this activity, we are using the "consumable" effects `increase()` and `decrease()`, which as you +would predict, increase and decrease the value of the `recording_rate` by the `rate` parameter. The `run()` method is +executed at the start of the activity, so the increase occurs right at the activity start time. We then perform +the `delay()` action for the user-specified activity `duration`, which moves time forward within this activity before +finally reversing the rate increase. Since there are no other actions after the rate decrease, we know we have reached +the end of the activity. + +If we wanted to save a line of code, we could have the "renewable" effect `using()` to achieve the same result: + +```python +with using(model.data_model.recording_rate, rate): + await delay(duration) +``` + +With our effect model in place, we are done coding up the `collect_data` activity and the final result should look +something like this: + +```python +from pymerlin import MissionModel, Duration +from pymerlin._internal._decorators import Validation +from pymerlin.model_actions import delay + + +@MissionModel +class Model: + def __init__(self, registrar): + self.data_model = DataModel(registrar) + registrar.resource("counter", self.counter.get) + +class DataModel: + def __init__(self, registrar): + self.recording_rate = registrar.cell(0) + registrar.resource("recording_rate", self.recording_rate.get) + +@Model.ActivityType +@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps") +async def collect_data(model, rate=0.0, duration="01:00:00"): + model.data_model.recording_rate += rate + await delay(Duration.from_string(duration)) + model.data_model.recording_rate -= rate +``` + +Ok! Now we are all set to give this a spin. + diff --git a/docs-src/1_tutorials/getting-started/2-model-test-drive.md b/docs-src/1_tutorials/getting-started/2-model-test-drive.md new file mode 100644 index 0000000..3433a04 --- /dev/null +++ b/docs-src/1_tutorials/getting-started/2-model-test-drive.md @@ -0,0 +1,28 @@ +# Model Test Drive + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +:::{warning} +This page is a stub, since python mission models cannot yet be uploaded to Aerie. +::: + +Within your IDE, compile the model (`./gradlew assemble` should do the trick) and make sure it built successfully by checking `build/lib` for a new `missionmodel.jar` file. + +Follow [these instructions](https://ammos.nasa.gov/aerie-docs/planning/upload-mission-model/) to upload your `.jar` file, and give your model a name and version number (e.g. SSR Model version 1.0). Next, you can follow [these instructions](https://ammos.nasa.gov/aerie-docs/planning/create-plan-and-simulate/#instructions) to create a new plan. Pick the model you just compiled to build your plan off of and name your plan `Mission Plan 1` and give it a duration of `1 day`. Click "Create" and click on the newly created plan to open it, which should take you to a view with the plan timeline in the center view panel. + +On the left panel, you should see your `collect_data` activity type, which you can drag and drop onto the "Activities" row in the timeline. Your `recording_rate` resource should also appear as a row in the timeline, but with no values applied yet since we haven't simulated. Put two activities in your plan and click on the second one (the first one we will leave alone and let it use default values). On the right panel, you should now see detailed information about your activity. Look for the "Parameters" section and you will see your rate and duration parameters, which you can modify. Try modifying the rate above `100.0` and you will see a warning icon appear, which you can hover over and see the message we wrote into a Validation earlier. Modify the rate back to `20` and change the default duration to `2 hours`. + +:::info + +When activity types are initially added to the plan, they are shown with a play button icon and don't have a duration. We call these "activity directives", and it is these activities that you are allowed to modify by changing parameters, timing, etc. Once a simulation has been performed, one or more activities will appear below the directive, which are the activity instances. These actually have a duration (based on their effect model) and are the result of the simulation run. + +::: + +On the top menu bar, click "Simulation" and then "Simulate". After you see a green checkmark, `recording_rate` should be populated with a value profile. The value should begin at 0.0 (since we initialized it that way in the model) and pop up to `10` for the first activity and `20` for the second. You'll also see that the activity instances below the activity directives (see note above) have durations that match the arguments we provided. At this point, your view will look similar to the screenshot below. + +![Tutorial Plan 1](assets/Tutorial_Plan_1.png) + +At this point, we could go into more detail about how you can [edit the timeline](https://nasa-ammos.github.io/aerie-docs/planning/timeline-editing/), edit your UI view, or view simulation history, but instead we will move back to our IDE and add some more complexity to our model. \ No newline at end of file diff --git a/docs-src/1_tutorials/getting-started/3-enum-derived-resource.md b/docs-src/1_tutorials/getting-started/3-enum-derived-resource.md new file mode 100644 index 0000000..4c217ed --- /dev/null +++ b/docs-src/1_tutorials/getting-started/3-enum-derived-resource.md @@ -0,0 +1,65 @@ +# Enumerated and Derived Resources + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +In addition to our on-board camera, let's imagine that we also have an instrument on-board that is continuously +collecting data, say a magnetometer, based on a data collection mode. Perhaps at especially interesting times in the +mission, the magnetometer is placed in a high rate collection mode and at other times remains in a low rate collection +mode. For our model, we want to be able to track the collection mode over time along with the associated data collection +rate of that mode. + +The first thing we'll do to accomplish this is create a Java enumeration called `MagDataCollectionMode` that gives us +the list of available collection modes along with a mapping of those modes to data collection rates +using [enum fields](https://issac88.medium.com/java-enum-fields-methods-constructors-3a19256f58b). We will also add a +getter method to get the data rate based on the mode. Let's say that we have three modes, `OFF`, `LOW_RATE`, +and `HIGH_RATE` with values `0.0`, `500.0`, and `5000.0`, respectively. After coding this up, our enum should look like +this: + +```python +from enum import Enum + + +class MagDataCollectionMode(Enum): + OFF = 0.0 # kbps + LOW_RATE = 500.0 # kbps + HIGH_RATE = 5000.0 # kbps +``` + +With our enumeration built, we can now add a couple of new resources to our `DataModel` class. The first resource, which +we'll call `MagDataMode`, will track the current data collection mode for the magnetometer. Declare this resource as a +discrete `MutableResource` of type `MagDataCollectionMode` and then add the following lines of code to the constructor +to initialize the resource to `OFF` and register it with the UI. + +```python +self.MagDataMode = registrar.cell(discrete(MagDataCollectionMode.OFF)); +registrar.resource("MagDataMode", MagDataMode.get) +``` + +As you can see, declaring and defining this resource was not much different than when we built `recording_rate` except +that the type of the resource is an Enum rather than a number. + +Another resource we can add is one to track the numerical value of the data collection rate of the magnetometer, which +is based on the collection mode. In other words, we can derive the value of the rate from the mode. Since we are +deriving this value and don't intend to emit effects directly onto this resource, we can declare it as a +discrete `Resource` of type `Double` instead of a `MutableResource`. + +When we go to define this resource in the constructor, we need to tell the resource to get its value by mapping +the `MagDataMode` to its corresponding rate. A special static method in the `DiscreteResourceMonad` class called `map()` +allows us to define a function that operates on the value of a resource to get a derived resource value. In this case, +that function is simply the getter function we added to the `MagDataCollectionMode`. The resulting definition and +registration code for `MagDataRate` then becomes + +```python +registrar.resource("MagDataRate", lambda: MagDataCollectionMode.get_data_rate(MagDataRate.get())); +``` + +:::info + +Instead of deriving a resource value from a function using `map()`, there are a number of static methods in +the `DiscreteResources` class, which you can use to `add()`, `multiply()`, `divide()`, etc. resources. For example, you +could have a `Total` resource that simple used `add()` to sum some resources together. + +::: diff --git a/docs-src/1_tutorials/getting-started/4-current-value.md b/docs-src/1_tutorials/getting-started/4-current-value.md new file mode 100644 index 0000000..bbc8f2c --- /dev/null +++ b/docs-src/1_tutorials/getting-started/4-current-value.md @@ -0,0 +1,40 @@ +# Using Current Value in an Effect Model + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Now that we have our magnetometer resources, we need to build an activity that changes the `MagDataMode` for us ( +since `MagDataRate` is a derived resource, we shouldn't have to touch it) and changes the overall SSR `recording_rate` to +reflect the magnetometer's data rate change. This activity, which we'll call `change_mag_mode`, only needs one parameter +of type `MagDataCollectionMode` to allow the user to request a change to the mode. Let's give that parameter a default +value of `LOW_RATE`. + +In the effect model for this activity (which we'll call `run()` by convention), we can use the `set()` method in +the `DiscreteEffects` class to change the `MagDataMode` to the value provided by our mode parameter. The computation of +the change to the `recording_rate` caused by the mode change is a little tricky because we need to know both the value of +the `MagDataRate` before and after the mode change. Once we know those value, we can subtract the old value from the new +value to get the net increase to the `recording_rate`. If the new value happens to be less than the old value, our answer +will be negative, but that should be ok as long as we use the `increase()` method when effecting the `recording_rate` +resource. + +We can get the current value of a resource with a static method called `currentValue()` available in the `Resources` +class. For our case here, we want to get the current value of the `MagDataRate` **before** we actually change the mode +to the requested value, so we have to be a little careful about the order of operations within our effect model. The +resulting activity type and its effect model should look something like this: + +```java +@Model.ActivityType() +async def change_mag_mode(model, mode: MagDataCollectionMode = MagDataCollectionMode.LOW_RATE): + current_rate = model.data_model.MagDataRate.get() + new_rate = mode.get_data_rate() + // Divide by 10^3 for kbps->Mbps conversion + model.data_model.recording_rate += (new_rate-current_rate)/1.0e3 + model.data_model.MagDataMode.set(mode) +``` + +Looking at our new activity definition, you can see how we use the `increase()` effect on `recording_rate` to "increase" +the data rate based on the net data change from the old rate. You may also notice a magic number where we do a unit +conversion from `kbps` to `Mbps`, which isn't ideal. Later on in this tutorial, we will introduce a "Unit Aware" +resource framework that will help a bit with conversions like these if desired. diff --git a/docs-src/1_tutorials/getting-started/5-second-look.md b/docs-src/1_tutorials/getting-started/5-second-look.md new file mode 100644 index 0000000..ac24266 --- /dev/null +++ b/docs-src/1_tutorials/getting-started/5-second-look.md @@ -0,0 +1,27 @@ +# Second Look + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +With our second activity and corresponding resources built, let's compile the model again and upload it into Aerie (if +you forget how to do this, refer to the [Model Test Drive Page](2-model-test-drive) for simple instructions and +references). Build a new plan off of the model you just uploaded, name your plan `Mission Plan 2`, and give it a +duration of `1 day`. When you open this plan, you will see your two activity types appear in the left panel, which you +can drag and drop onto the plan. Add two `change_mag_mode` activities and change the parameter of the first one +to `HIGH_RATE`. Add a `collect_data` activity in between the two `change_mag_mode` activities and then simulate. + +You should now see our three resources populate with values in the timeline below. You'll notice that now +the `recording_rate` resource starts at zero until the `MagDataMode` changes to `HIGH_RATE`, which pops up the rate +to `5 Mbps`. Then, the `collect_data` activity increases the rate by another `10` to `15 Mbps`, but immediately decreases +after the end of the activity. Finally, the `MagDataMode` changes to `LOW_RATE`, which takes the rate down to `0.5 Mbps` +until the end of the plan. + +At this point, you can take the opportunity to play around with +Aerie's [Timeline Editing](https://ammos.nasa.gov/aerie-docs/planning/timeline-editing/) capability to change the colors +of activities or lines or put multiple resources onto one row. Try putting the `MagDataMode` and `MagDataRate` on the +same row so you can easily see how the mode changes align with the rate changes and change the color of `MagDataRate` to +red. With these changes you should get something similar to the screenshot below + +![Tutorial Plan 2](assets/Tutorial_Plan_2.png) diff --git a/docs-src/1_tutorials/getting-started/6-integrating-rate.md b/docs-src/1_tutorials/getting-started/6-integrating-rate.md new file mode 100644 index 0000000..df4f515 --- /dev/null +++ b/docs-src/1_tutorials/getting-started/6-integrating-rate.md @@ -0,0 +1,284 @@ +# Integrating Data Rate + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https:#nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Now is where the fun really begins! Although having the data rate in and out of our SSR is useful, we are often more +concerned with the total amount of volume we have in our SSR in order to make sure we don't over fill it and have +sufficient downlink opportunities to get all the data we collected back to Earth. In order to compute total volume, we +must figure out a way to integrate our `recording_rate`. It turns out there are many different methods in Aerie you can +choose to arrive at the total SSR volume, but each method has its own advantages and drawbacks. We will explore 4 +different options for integration with the final option, a derived `Polynomial` resource, being our recommended +approach. As we progress through the options, you'll learn about a few more features of the resource framework that you +can use for different use cases in your model including the use of `Reactions` and **daemon** tasks. + +## Method 1 - Increase volume within activity + +The simplest method for performing an "integration" of `recording_rate` is to compute the integral directly within the +effect model of the activities who change the `recording_rate`. Before we do this, let's make sure we have a data volume +resource in our `DataModel` class. For each method, we are going to build a different data volume resource so we can +eventually compare them in the Aerie UI. As this is our simplest method, let's call this resource `ssr_volume_simple` +and make it store volume in Gigabits (Gb). Since we are going to directly effect this resource in our activities, this +will need to be a `MutableResource`. The declaration looks just like `recording_rate` + +as does the definition, initialization, and registration in the constructor: + +```python +self.ssr_volume_simple = registrar.cell(0.0) +registrar.resource("ssr_volume_simple", self.ssr_volume_simple.get) +``` + +Taking a look at our `collect_data` activity, we can add the following line of code after the `await delay()` within its +body to compute the data volume resulting from the activity collecting data at a constant duration over the full +duration of the activity. + +```python +model.data_model.ssr_volume_simple += rate * duration.to_number_in(Duration.SECONDS) / 1000.0 +``` + +This line will increase `SRR_Volume_Simple` at the end of the activity by `rate` times `duration` divided by our magic +number to convert `Mb` to `Gb`. Note that the `duration` object has some helper functions like `to_number_in` to help you +convert the `duration` type to a `double` value. + +There are a few notable issues with this approach. The first issue is that when a plan is simulated, the data volume of +the SSR will only increase at the very end of the activity even though in reality, the volume is growing linearly in +time throughout the duration of the activity. If your planners only need this level of fidelity to do their work, this +may be ok. However, if your planners need a little more fidelity during the time span of the activity, you could spread +out the data volume accumulation over many steps. That would look something like this in code, + +```python +num_steps = 20 +step_size = duration / num_steps +for i in range(num_steps): + await delay(step_size) +model.data_model.ssr_volume_simple += this.rate * step_size.to_number_in(SECONDS) / 1000.0 + +``` + +which would replace the `delay()` and the single data volume increase line from above. The resulting timeline +for `ssr_volume_simple` would look like a stair step with the number of steps equal to `num_steps`. It's important to +remember we are still using a `Discrete` resource, so the resource is stored as a constant, "step-function" profile in +Aerie. We will show the use of a `Polynomial` resource in our final method to truly store and view data volume as a +linear profile. + +Another issue with this approach is that iy does not transfer well to activities like `change_mag_mode` that alter +the `recording_rate` and do not return the rate back to its original value at the end of the activity (i.e. activities +whose effects on rate are not contained within the time span of the activity). In order to compute the magnetometer's +contribution to the data volume in `change_mag_mode`, we would need to multiply the `current_rate` by the duration since +the last mode change, or if no mode change has occurred, the beginning of the plan. While this is possible by using +a `Clock` resource to track time between mode changes, the `change_mag_mode` activity would now requires additional +context about the plan that would otherwise be unnecessary. + +A third issue to note is that the computation of `recording_rate` and `ssr_volume_simple` are completely separate, and +both of them live within the activity effect model. In reality, these quantities are very much related and should be +tied together in some way. The relationship between rate and volume is activity independent, and thus it makes more +sense to define that relationship in our `DataModel` class instead of the activity itself. + +Given these issues, we will hold off on implementing this approach for `change_mag_mode` and move forward to trying out +our next approach. + +## Method 2 - Sample-based volume update + +Another method to integration we can take is a numerical approach where we compute data volume by sampling the value of +the `recording_rate` at a fixed interval across the entire plan. In order to implement this method, we can `spawn()` a +simple task from our top-level `Mission` class that runs in the background while the plan is being simulated, which is +completely independent of activities in the plan. Such tasks are known as `daemon` tasks, and your mission model can +have an arbitrary number of them. + +Before we create this task, let's add another discrete `MutableResource` of type `double` called `ssr_volume_sampled` to +the `DataModel` class. Just as with other resources we have made, the declaration will look like + +and the definition, initialization, and registration in the constructor will be + +```python +self.ssr_volume_sampled = registrar.cell(0.0) +registrar.resource("ssr_volume_sampled", self.ssr_volume_sampled.get) +``` + +In addition to the resource, let's add another member variable to specify the sampling interval we'd like for our +integration. Choosing `60` seconds will result in the follow variable definition + +```python +INTEGRATION_SAMPLE_INTERVAL = Duration.of(60, Duration.SECONDS) +``` + +Staying in the `DataModel` class, we can can create a member function called `integrate_sampled_ssr` that has no +parameters, which we will spawn from the `Mission` class shortly. For the sake of simplicity, we will define this +function to take the "right" Reimann Sum (a "rectangle" rule approximation) of the `recording_rate` over time. The +implementation of this function looks like this: + +```python +async def integrate_sampled_ssr(): + while (True): + await delay(INTEGRATION_SAMPLE_INTERVAL) + current_recording_rate = currentValue(recording_rate) + ssr_volume_sampled += ( + current_recording_rate + * INTEGRATION_SAMPLE_INTERVAL.to_number_in(Duration.SECONDS) + / 1000.0) # Mbit -> Gbit +``` + +As a programmer, you may be surprised to see an infinite `while` loop, but Aerie will shut down this task, effectively +breaking the loop, once the simulation reaches the end of the plan. Within the loop, the first thing we do is `delay()` +by our sampling interval and then retrieve the current value of `recording_rate`. Finally, we sum up our rectangle by +multiplying the current rate by the sampling interval. We could have easily chosen to use other numerical methods like +the "trapezoid" rule by storing the previous recording rate in addition to the current rate, but what we did is +sufficient for now. + +The final piece we need to build into our model to get this method to work is a simple `spawn` with the `Mission` class +to our `integrate_sampled_ssr` method. + +```python +spawn(self.data_model::integrate_sampled_ssr) +``` + +The issues with this approach to integration are probably fairly apparent to you. First of all, this approach is truly +an approximation, so the resulting volume may not be the actual volume if the sampled points don't align perfectly with +the changes in `recording_rate`. Secondly, the fact we are sampling at a fixed time interval means we could be computing +many more time points than we actually need if the recording rate isn't changing between time points. If you were to try +to scale up this approach, you might run into performance issues with your model where simulation takes much longer than +it needs to. + +Despite these issues `daemon` tasks are a very effective tool in a modelers tool belt for describing "background" +behavior of your system. Examples for a spacecraft model could include the computation of geometry, battery degradation +over time, environmental effects, etc. + +## Method 3 - Update volume upon change to rate + +If you are looking for an efficient, yet accurate way to compute data volume from `recording_rate`, one method you could +take is to set up trigger that calls a function whenever `recording_rate` changes and then computes volume by +multiplying +the rate just before the latest change by the duration that has passed since the last change. Fortunately, there is a +fairly easy way to do this in Aerie's modeling framework. + +Let's begin by creating one more discrete `MutableResource` called `ssr_volume_upon_rate_change` in our `DataModel` +class (refer back to previous instances in this tutorial for how to declare and define one of these). In addition to our +volume resource, we are also going to need a `Clock` resource to help us track the time between changes +to `recording_rate`. Since this resource is more of a "helper" resource and doesn't need to be exposed to our planners, +we'll make it `private` and not register it to the UI. Declaring and defining a `Clock` resource is not much different +than declaring a `Discrete` except you don't have to specify a primitive type. The declaration looks like this + +and the definition in the constructor looks like this + +```python +self.time_since_last_rate_change = registrar.cell(Duration.ZERO, behavior=Clock.behavior) +``` + +This will start a "stopwatch" right at the start of the plan so we can track the time between the start of the plan and +the first time `recording_rate` is changed. We'll also need one more member variable of type `Double`, which we'll +call `previous_rate` to keep track of the previous value of `recording_rate` for us. + +```java +previous_recording_rate = 0.0 +``` + +Our next step is to build our trigger to react when there is a change to `recording_rate`. We can do this by leveraging +the `wheneverUpdates()` static method available within the framework's `Reactions` class + +```java +Reactions.wheneverUpdates(recording_rate, this::upon_recording_rate_update) +``` + +:::note + +The `Reactions` class has a couple more static methods that a modeler may find useful. The `every()` method allows you +to specify a duration to call a recurring action (we could have used this instead of our `spawn()` for the sampled +integration method). The `whenever()` method allows you to specify a `Condition`, which when met, would trigger an +action of your choosing. An example of a condition could be when a resource reaches a certain threshold. + +::: + +As you can see, this method takes a resource as its first argument and some `Runnable`, like a function call, as it's +second argument. We have specified that the function `upon_recording_rate_update` be called, so now we have to implement +that function within our `DataModel` class. The implementation of that function is below, which we will walk through +line by line. + +```python +upon_recording_rate_update(): +# Determine time elapsed since last update +t = time_since_last_rate_change.get() +# Update volume only if time has actually elapsed +if !t.isZero(): + ssr_volume_upon_rate_change += previous_recording_rate * t.to_number_in(Duration.SECONDS) / 1000.0) # Mbit -> Gbit + + previous_recording_rate = recording_rate.get() + # Restart clock (set back to zero) + ClockEffects.restart(time_since_last_rate_change) + +``` + +When the `recording_rate` resource changes, the first thing we do is determine how much time has passed since it last +changed (or since the beginning of the plan). If no time has passed, we don't want to re-integrate and double count +volume, but if time has passed, we do our simple integration by multiplying the previous rate by the elapsed time since +the value of rate changed. We then store the new value of rate as the previous rate and restart our stopwatch to we get +the right time next time the rate changes. + +And that's it! Now, every time `recording_rate` changes, the SSR volume will update to the correct volume. However, the +volume is still a discrete resource, so volume will only change as a step function at time points where the rate +changes. Nonetheless, since `recording_rate` is piece-wise constant, you'll get the right answer for volume with no +error +at those time points. + +## Method 4 - Derived volume from polynomial resource + +We have finally arrived at the final method we'll go through for integrating `recording_rate`, and in some ways, this +one +is the most straightforward. We will define our data volume as polynomial resource, `ssr_volume_polynomial`, which we +can build by using an `integrate()` static method provided by the `PolynomialResources` class. As a polynomial resource, +we will actually see the volume increase linearly over time as opposed to in discrete chunks. +Since `ssr_volume_polynomial` will be derived directly from `recording_rate`, we can make this a `Resource` as opposed +to +a `MutableResource`. The declaration of our new resource looks like this + +while the definition and registration in the constructor of our `DataModel` class look like this + +```java +self.ssr_volume_polynomial = scale( + PolynomialResources.integrate(as_polynomial(this.recording_rate), 0.0), 1e-3) # Gbit +registrar.resource("ssr_volume_polynomial", ssr_volume_polynomial.approx_linear) +``` + +Breaking down the definition, we see the `integrate()` function takes the resource to integrate as the first argument, +but that argument requires the resource to be polynomial as well. Fortunately, there is a function +in the `PolynomialResources` module called `as_polynomial()` that can convert discrete resources like `recording_rate` +to +polynomial ones. The second argument is the initial value for the resource, which we have been assuming is `0.0` for +data volume. The `integrate()` function is then wrapped by `scale()`, another handy static method +in `PolynomialResources` to convert our resource from `Megabit` to `Gigabit`. + +The resource registration is also slightly different than what we have seen thus far as we are using a `real()` method +as opposed to `discrete()` and we have to wrap our resource with yet another static helper method +in `PolynomialResources` called `assumeLinear()`. The reason we have to do this is that the UI currently does not have +support for `Polynomial` resources and can only render timelines as linear or constant segments. In our +case, `ssr_volume_polynomial` is actually linear anyway, so we are not "degrading" our resource by having to make this +down conversion. + +Now in reality, our on-board `SSR` is going to have a max capacity, and if data is removed from the `SSR`, we want to +make sure our model stops decreasing the `SSR` volume once it reaches `0.0`. By good fortune, the Aerie framework +includes another static method in `PolynomialResources` called `clampedIntegral()` that allows you to build a resource +that takes care of all that messy logic to make sure you are adhering to your min/max limits. + +If we wanted to build a "clamped" version of `ssr_volume_polynomial`, it would look something like this + +```python +clamped_integrate = PolynomialResources.clamped_integrate(scale( + as_polynomial(this.recording_rate), 1e-3), + PolynomialResources.constant(0.0), + PolynomialResources.constant(250.0), + 0.0) +ssr_volume_polynomial = clamped_integrate.integral() +``` + +The second and third arguments of `clamped_integrate()` are the min and max bounds for the integral and the final +argument is the starting value for the resource as it was in `integrate()`. The `clamped_integrate()` method actually +returns a `record` of three resources: + +- integral – The clamped integral value (i.e. the main resource of interest) +- overflow – The rate of overflow when the integral hits its upper bound. You can integrate this to get cumulative + overflow. +- underflow – The rate of underflow when the integral hits its lower bound. You can integrate this to get cumulative + underflow. + +As expected, the `integral()` resource is mapped to `ssr_volume_polynomial` to complete its definition. diff --git a/docs-src/1_tutorials/getting-started/7-integration-comparision.md b/docs-src/1_tutorials/getting-started/7-integration-comparision.md new file mode 100644 index 0000000..f4b5acf --- /dev/null +++ b/docs-src/1_tutorials/getting-started/7-integration-comparision.md @@ -0,0 +1,51 @@ +# Integral Method Comparison + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Now that we have explored multiple methods to implement integration in Aerie, let's compare all of the methods in the +Aerie UI. To make things more interesting, use the 2nd approach to the `Polynomial` method so we can see how that +approach enforces a data volume capacity. Compile the current version of the model (`./gradlew assemble`) and upload it +into Aerie. Build a new `1 day` plan off of that model and call it "Mission Plan 3". + +For this plan, throw a couple of `collect_data` activities near the beginning of the plan, create a `change_mag_mode` +activity after those activities in the first half of the plan and set that activity's parameter to `HIGH_RATE`. Throw +one more `collect_data` and `change_mag_mode` activity near the end of the plan to make sure we get a plan that goes over +our data capacity threshold. With our simple plan built, go ahead and simulate the plan to see the resulting resource +profiles. + +The easiest way to compare our four integration methods is to use +Aerie's [Timeline Editing](https://ammos.nasa.gov/aerie-docs/planning/timeline-editing/) capability to build a row that +includes all four of our data volume resources: + +- `ssr_volume_simple` +- `ssr_volume_sampled` +- `ssr_volume_upon_rate_change` +- `ssr_volume_polynomial` + +If you do that, you'll get a timeline view that looks something like the screenshot below + +![Tutorial Plan 3](assets/Tutorial_Plan_3.png) + +Looking at `ssr_volume_simple`, you'll see that data volume increases at the end of each `collect_data` activity, and for +the first two activities, the result at the end of the activity is consistent with the other volumes. You may recall +that we did not implement a data volume integration for the `change_mag_mode` activity for `ssr_volume_simple` (although +we could have with some work), so as soon as one of those activities is introduced into our plan, our volume is no +longer valid. + +`ssr_volume_sampled` has a nice looking profile when zoomed out at the expense of computing many points, which you can +see if you zoom into a shorter time span. If you zoom far enough, you can see the stair-step associated with computation +of each sampled point. If we were to change our sampling interval to something larger, we would lose some accuracy in +our volume calculation if the activity start/end times aren't aligned with are sample points. + +`ssr_volume_upon_rate_change` has much fewer points, but you can see that it produces the same volume as +our `ssr_volume_polynomial` resource at the time points it computes until we go above our maximum +capacity. `ssr_volume_polynomial` has same computed points as `ssr_volume_upon_rate_change`, but has linear profile +segments in between points. It also has an additional point once it reaches the capacity threshold, and then it remains +at that threshold for the remainder of the plan (we don't have any downlinks or we would see the volume decrease). + +Hopefully looking at the various methods of integrating in Aerie has given you some insight into the modeling constructs +available to you. You can do a ton with what you have learned thus far, but next we'll go over some additional +capabilities you will likely find useful as you build models with Aerie. diff --git a/docs-src/1_tutorials/getting-started/8-simulation-config.md b/docs-src/1_tutorials/getting-started/8-simulation-config.md new file mode 100644 index 0000000..4bbb3b2 --- /dev/null +++ b/docs-src/1_tutorials/getting-started/8-simulation-config.md @@ -0,0 +1,126 @@ +# Sim Configuration + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +There is often a need for certain aspects of a model to be exposed to the planner to provide flexibility to tweak and +configure the model prior to a simulation run. The Aerie modeling framework provides +a [simulation configuration](https://ammos.nasa.gov/aerie-docs/mission-modeling/configuration/) interface to satisfy +this need. In our SSR model, we will expose a couple variables that already exist in our code: the sample interval for +our `SSR_Volume_Sampled` resource and the SSR max capacity defined as part of the `ssr_volume_polynomial` resource +definition. We will also create a new model configuration for setting the initial state of the `MagDataMode`. + +Back when we initially grabbed the mission model template to give us a jumping off point for our model, you may recall +that the template provided a `Configuration` class, and that class is already passed into the top-level `Mission` class +as a parameter. Taking a look at the `Configuration` class (which is actually +a [java record](https://www.baeldung.com/java-record-vs-final-class)), you'll see there is already a static method there +called `defaultConfiguration()` that uses +the [`@Template` annotation](https://ammos.nasa.gov/aerie-docs/mission-modeling/parameters/#export-template). This type +of annotation assumes every variable within the parent class should be exposed as simulation configuration (or a +parameter if you use this within activities) with a default value. So, in our case, we will declare three member +variables and give them all default values that match the values we have for them in the `DataModel` class, which we +will soon replace with references to this configuration. + +```java +public static final Double SSR_MAX_CAPACITY = 250.0; + +public static final long INTEGRATION_SAMPLE_INTERVAL = 60; + +public static final MagDataCollectionMode STARTING_MAG_MODE = MagDataCollectionMode.OFF; +``` + +In order to hook up these member variables to our record, we need to add three constructor parameters and then update +the `defaultConfiguration()` method to pass in these default values to construct a record with default values. Once we +do this, we get a `Configuration` record that looks like this: + +```java +package missionmodel; + +import static gov.nasa.jpl.aerie.merlin.framework.annotations.Export.Template; + +public record Configuration(Double ssrMaxCapacity, + long integrationSampleInterval, + MagDataCollectionMode startingMagMode) { + + public static final Double SSR_MAX_CAPACITY = 250.0; + + public static final long INTEGRATION_SAMPLE_INTERVAL = 60; + + public static final MagDataCollectionMode STARTING_MAG_MODE = MagDataCollectionMode.OFF; + + public static @Template Configuration defaultConfiguration() { + return new Configuration(SSR_MAX_CAPACITY, + INTEGRATION_SAMPLE_INTERVAL, + STARTING_MAG_MODE); + } +} +``` + +Now, when Aerie loads in our model, the member variables above will be exposed as simulation configuration with defaults +set to the defaults defined in this record. However, at the moment, changing the values from their defaults won't +actually change the behavior of the simulation because our `DataModel` doesn't yet know about this configuration. Within +our top-level `Mission` class, we need to pass our configuration into `DataModel` via its constructor + +```java +this.dataModel = new DataModel(this.errorRegistrar, config); +``` + +and then update the `DataModel` class constructor to include `Configuration` as an argument: + +```java +public DataModel(Registrar registrar, Configuration config) { ... } +``` + +Now we must find references to our original, hard-coded values for our configuration and replace them with references to +our `config` object. + +Here is what this looks like for `ssrMaxCapacity` + +```java +var clampedIntegrate = PolynomialResources.clampedIntegrate( scale( + asPolynomial(this.recording_rate), 1e-3), + PolynomialResources.constant(0.0), + PolynomialResources.constant(config.ssrMaxCapacity()), + 0.0); +``` + +and `integrationSampleInterval` + +```java +INTEGRATION_SAMPLE_INTERVAL = Duration.duration(config.integrationSampleInterval(), Duration.SECONDS); +``` + +Note that for the sample interval, we had to move from a hardcoded definition as part of the variable declaration and +move the definition to the constructor, which you could put on the line following the registration of +the `SSR_Volume_Sampled` resource. + +Our final configuration parameter, `startingMagMode`, is not quite as straightforward as the other two because in +addition to ensuring that the initial value of `MagDataMode` is set correctly, we need to make sure that the +initial `recording_rate` also takes into account the `MagDataRate` associated with the initial `MagDataMode`. We can +achieve this by switching around the order of construction so that the `recording_rate` is defined after the mag mode and +rate. We also need to make sure the `previousrecording_rate` used to compute our `ssr_volume_upon_rate_change` resource is +set to the initial value of `recording_rate`. The resulting code will look like this + +```java +self.MagDataMode = registrar.cell(discrete(config.startingMagMode())); +registrar.discrete("MagDataMode",self.MagDataMode, new EnumValueMapper<>(MagDataCollectionMode.class)); + +self.MagDataRate = map(MagDataMode, MagDataCollectionMode::get_data_rate); +registrar.discrete("MagDataRate", self.MagDataRate, new DoubleValueMapper()); + +recording_rate = registrar.cell(discrete(currentValue(MagDataRate)/1e3)); +registrar.discrete("recording_rate", recording_rate, new DoubleValueMapper()); +previousrecording_rate = currentValue(recording_rate); +``` + +Now you should be ready to try this out in the Aerie UI. Go ahead and compile your model with simulation configuration +and upload it to Aerie. Build whatever plan you'd like and then before you simulate, in the left panel view, select " +Simulation" in the dropdown menu. You should now see your three configuration variables appear under "Arguments" + +![Simulation Config](assets/Simulation_Config.png) + +Aerie is smart enough to look at the types of the configuration variables and generate a input field in the UI that best +matches that type. So, for example, the `startingMagMode` is a simple drop down menu with the only options available +being members of the `MagDataCollectionMode` enumeration. diff --git a/docs-src/1_tutorials/getting-started/index.md b/docs-src/1_tutorials/getting-started/index.md new file mode 100644 index 0000000..7bcaf43 --- /dev/null +++ b/docs-src/1_tutorials/getting-started/index.md @@ -0,0 +1,15 @@ +# Intro Tutorial: Solid State Recorder + +In this tutorial, you'll start from scratch and write a data model to track the rate and volume of a +spacecraft's solid state recorder. This is the recommended first tutorial for new users of pymerlin! + +```{toctree} +1-gettingstarted +2-model-test-drive +3-enum-derived-resource +4-current-value +5-second-look +6-integrating-rate +7-integration-comparision +8-simulation-config +``` diff --git a/docs-src/2_guides/index.md b/docs-src/2_guides/index.md index 6e23688..d655658 100644 --- a/docs-src/2_guides/index.md +++ b/docs-src/2_guides/index.md @@ -2,6 +2,7 @@ This section contains targeted how-to guides for things you might want to do with pymerlin. ```{toctree} +organization jupyter datamodel powermodel diff --git a/docs-src/apidocs/pymerlin/pymerlin.model_actions.rst b/docs-src/apidocs/pymerlin/pymerlin.model_actions.rst index dc82197..b40c5ad 100644 --- a/docs-src/apidocs/pymerlin/pymerlin.model_actions.rst +++ b/docs-src/apidocs/pymerlin/pymerlin.model_actions.rst @@ -48,13 +48,13 @@ API .. autodoc2-docstring:: pymerlin.model_actions.delay :parser: myst -.. py:function:: spawn(child) +.. py:function:: spawn(model, child) :canonical: pymerlin.model_actions.spawn .. autodoc2-docstring:: pymerlin.model_actions.spawn :parser: myst -.. py:function:: call(child) +.. py:function:: call(model, child) :canonical: pymerlin.model_actions.call :async: diff --git a/docs-src/glossary.md b/docs-src/glossary.md new file mode 100644 index 0000000..bb850cc --- /dev/null +++ b/docs-src/glossary.md @@ -0,0 +1,15 @@ +# Glossary + +:::{glossary} +Aerie + A suite of planning and scheduling, modeling and simulation, constraint checking and sequencing tools. +Merlin + The modeling and simulation component of Aerie. +Effect Model + The body of the function describing an activity's behavior during simulation. +Validation + A predicate on the arguments to an activity. Violation of a predicate does not preclude execution of the activity, but + rather serves as a warning. +::: + +[//]: # (You can use {term}`MyST` to create glossaries.) \ No newline at end of file diff --git a/docs-src/quickstart.md b/docs-src/quickstart.md index 8d9b5e2..4b22040 100644 --- a/docs-src/quickstart.md +++ b/docs-src/quickstart.md @@ -23,4 +23,4 @@ Check that the installation succeeded by running: python3 -c "import pymerlin; pymerlin.checkout()" ``` -If you see `pymerlin checkout successful: All systems GO 🚀`, you're ready to get started with the [tutorial](1_tutorials/1-gettingstarted). \ No newline at end of file +If you see `pymerlin checkout successful: All systems GO 🚀`, you're ready to get started with the [tutorial](1_tutorials/getting-started/index.md). \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/1-gettingstarted.html b/docs/1_tutorials/getting-started/1-gettingstarted.html new file mode 100644 index 0000000..02a0012 --- /dev/null +++ b/docs/1_tutorials/getting-started/1-gettingstarted.html @@ -0,0 +1,652 @@ + + + + + + + + + Getting Started - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Getting Started

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

Welcome Aerie modeling padawans! For your training today, you will be learning the basics of mission modeling in Aerie +by building your own simple model of an on-board spacecraft solid state recorder (SSR). This model will track the +recording rate into the recorder from a couple instruments along with the integrated data volume over time. Through the +process of building this model, you’ll learn about the fundamental objects of a model, activities and resources, and +their structure. You’ll be introduced to the different categories of resources and learn how you define and implement +each along with restrictions on when you can/can’t modify them. As a bonus, we will also cover how you can make your +resources “unit aware” to prevent those pesky issues that come along with performing unit conversions and how you can +test your model without having to pull your model into an Aerie deployment.

+

Let the training begin!

+
+

Installing pymerlin

+

If you haven’t already, go to the quickstart guide to get set up with pymerlin.

+
+
+

Creating a Mission Model

+

Start by creating a mission.py file with the following contents:

+
from pymerlin import MissionModel
+
+
+@MissionModel
+class Model:
+    def __init__(self, registrar):
+        self.data_model = DataModel(registrar)
+
+
+class DataModel:
+    def __init__(self, registrar):
+        "YOUR CODE HERE"
+
+
+
+
+

Your First Resource

+

We will begin building our SSR model by creating a single resource, recording_rate, to track the rate at which data is +being written to the SSR over time. As a reminder, a Resource is any measurable quantity whose behavior we want to +track over the course of a plan. Then, we will create a simple activity, collect_data, that updates the recording_rate +by a user-specified rate for a user-specified duration. This activity is intended to represent an on-board camera taking +images and writing data to the spacecraft SSR.

+

Although we could define the recording_rate resource directly in the pre-provided top-level Mission class, we’d like +to keep that class as simple as possible and delegate most of model’s behavior definition to other, more focused +classes. With this in mind, let’s create a new class within the missionmodel package called DataModel, which we will +eventually instantiate within the Mission class.

+

In the DataModel class, declare the recording_rate resource by replacing "YOUR CODE HERE" with the following line +of code:

+
self.recording_rate = registrar.cell(0)  # Megabits/s
+
+
+ +

Let’s tease apart this line of code and use it as an opportunity to provide a brief overview of the various types of +resources available to you as a modeler. The mission modeling framework provides two primary classes from which to +define resources:

+
    +
  1. MutableResource - resource whose value can be explicitly updated by activities or other modeling code after it has +been defined. Updates to the resource take the form of “Effects” such as increase, decrease, or set. The values +of this category of resource are explicitly tracked in objects called “Cells” within Aerie, which you can read about +in detail in +the Aerie Software Design Document if +you are interested.

  2. +
  3. Resource - resource whose value cannot be explicitly updated after it has been defined. In other words, these +resources cannot be updated via “Effects”. The most common use of these resources are to create “derived” resources +that are fully defined by the values of other resources (we will have some examples of these later). Since these +resources get their value from other resources, they actually don’t need to store their own value within a “Cell”. +Interestingly, the MutableResource class extends the Resource class and includes additional logic to ensure +values are correctly stored in these “Cells”.

  4. +
+

From these classes, there are a few different types of resources provided, which are primarily distinguished by how the +value of the resource progresses between computed points:

+
    +
  • Discrete - resource that maintains a constant value between computed points (i.e. a step function or piecewise +constant function). Discrete resources can be defined as many different types such as Boolean, Integer, Double, +or an enumeration. These types of resources are what you traditionally find in discrete event simulators and are the +easiest to define and “effect”.

  • +
  • Linear - resource that has a linear profile between computed points. When computing the value of such resources you +have to specify both the value of the resource at a given time along with a rate so that the resource knows how it +should change until the next point is computed. The resource does not have to be strictly continuous. In other words, +the linear segments that are computed for the resource do not have to match up. Unlike discrete resources, a linear +resource is implicitly defined as a Double.

  • +
  • Polynomial - generalized version of the linear resource that allows you to define resources that evolve over time +based on polynomial functions.

  • +
  • Clock - special resource type to provide “stopwatch” like functionality that allows you to track the time since an +event occurred.

  • +
+

TODO: Add more content on Clock

+
+

Note

+

Polynomial resources currently cannot be rendered in the Aerie UI and must be transformed to a linear resource (an +example of this is shown later in the tutorial)

+
+

Looking back at our resource declaration, you can see that recording_rate is a MutableResource (we will emit effects +on this resource in our first activity) of the type Discrete<Double>, so the value of the resource will stay constant +until the next time we compute effects on it.

+

Next, we must define and initialize our recording_rate resource, which we can do in a class constructor that takes one +parameter we’ll called registrar of type Registrar. You can think of the Registrar class as your link to what will +ultimately get exposed in the UI and in a second we will use this class to register recording_rate. But first, let’s +add the following line to the constructor we just made to fully define our resource.

+

Both the MutableResource and Discrete classes have static helper functions for initializing resources of their type. +If you included those functions via import static statements, you get the simple line above. The discrete() function +expects an initial value for the resource, which we have specified as 0.0.

+

The last thing to do is to register recording_rate to the UI so we can view the resource as a timeline along with our +activity plan. This is accomplished with the following line of code:

+
registrar.resource("recording_rate", self.recording_rate.get);
+
+
+
+

Note

+

Notice that self.recording_rate.get does not have parenthesies at the end. This is because we are registering +the get +function itself as a resource. Resources are functions that perform computations on cells

+
+

The first argument to this resource function is the string name of the resource you want to appear in the simulation +results, +and the second argument is the resource itself.

+

You have now declared, defined, and registered your first resource and your DataModel class should look something like +this:

+
class DataModel:
+    def __init__(self, registrar):
+        self.recording_rate = registrar.cell(0)
+        registrar.resource("recording_rate", self.recording_rate.get)
+
+
+

With our DataModel class built, we can now instantiate it within the top-level Model class as a member variable of +that class. The Registrar that we are passing to DataModel is unique in that it can log simulation errors as a +resource, so we also need to instantiate one of these special error registrars as well. After these additions, +the Mission class should look like this:

+
from pymerlin import MissionModel
+
+
+@MissionModel
+class Model:
+    def __init__(self, registrar):
+        self.data_model = DataModel(registrar)
+
+
+class DataModel:
+    def __init__(self, registrar):
+        self.recording_rate = registrar.cell(0)
+        registrar.resource("recording_rate", self.recording_rate.get)
+
+
+
+
+

Your First Activity

+

Now that we have a resource, let’s build an activity called collect_data that emits effects on that resource. We can +imagine this activity representing a camera on-board a spacecraft that collects data over a short period of time. +Activities in Aerie follow the general definition given in +the CCSDS Mission Planning and Scheduling Green Book

+
+

“An activity is a meaningful unit of what can be planned… The granularity of a Planning Activity depends on the use +case; It can be hierarchical”

+
+

Essentially, activities are the building blocks for generating your plan. Activities in Aerie follow a class/object +relationship +where activity types - defined +as a class in Java - describe the structure, properties, and behavior of an object and activity instances are the actual +objects that exist within a plan.

+

Since activity types are implemented by async functions in python, create a new function called collect_data and add the +following decorator above that function, which allows pymerlin to recognize this function as an activity type.

+
@Model.ActivityType
+async def collect_data(model):
+    pass
+
+
+
+

Note

+

The async keyword allows pymerlin to interleave the execution of your new activity with other activities, which is +important when activities can pause and resume at various times

+
+

Let’s define +two parameters, rate +and duration, and give them default arguments. Parameters allow the behavior of an activity to be modified by an +operator without modifying its code.

+
@Model.ActivityType
+async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")):
+    pass
+
+
+

For our activity, we will give rate a default value of 10.0 megabits per second and duration a default value of +1 hour using pymerlin’s built-in Duration type.

+

Right now, if an activity of this type was added to a plan, an operator could alter the parameter defaults to any value +allowed by the parameter’s type. Let’s say that due to buffer limitations of our camera, it can only collect data at a +rate of 100.0 megabits per second, and we want to notify the operator that any rate above this range is invalid. We +can do this +with parameter validations +by adding a method to our class with a couple of annotations:

+
@Model.ActivityType
+@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps")
+async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")):
+    pass
+
+
+

The @Validation decorator specifies a function to validate one or more parameters, and a message to present to the +operator when the validation fails. Now, as you will see soon, when an operator specifies a data rate above 100.0, +Aerie will show a validation error and message.

+

Next, we need to tell our activity how and when to effect change on the recording_rate resource, which is done in +an Activity Effect Model. We do +this by filling out the body of the collect_data function.

+

For our activity, we simply want to model data collection at a fixed rate specified by the rate parameter over the +full duration of the activity. Within the run() method, we can add the follow code to get that behavior:

+
@Model.ActivityType
+@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps")
+async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")):
+    model.data_model.recording_rate += rate
+    await delay(duration);
+    model.data_model.recording_rate -= rate
+
+
+

Effects on resources are accomplished by using one of the many static methods available in the class associated with +your resource type. In this case, recording_rate is a discrete resource, and therefore we are using methods from +the DiscreteEffects class. If you peruse the static methods in DiscreteEffects, you’ll see methods +like set(), increase(), decrease(), consume(), restore(),using(), etc. Since discrete resources can be of +many primitive types (e.g. Double,Boolean), there are specific methods for each type. Most of these effects change +the value of the resource at one time point instantaneously, but some, like using(), allow you to specify +an action to run +like delay(). Prior to executing the action, the resource changes just like other effects, but once the action is +complete, the effect on the resource is reversed. These resource effects are sometimes called “renewable” in contrast to +the other style of effects, which are often called “consumable”.

+

In our effect model for this activity, we are using the “consumable” effects increase() and decrease(), which as you +would predict, increase and decrease the value of the recording_rate by the rate parameter. The run() method is +executed at the start of the activity, so the increase occurs right at the activity start time. We then perform +the delay() action for the user-specified activity duration, which moves time forward within this activity before +finally reversing the rate increase. Since there are no other actions after the rate decrease, we know we have reached +the end of the activity.

+

If we wanted to save a line of code, we could have the “renewable” effect using() to achieve the same result:

+
with using(model.data_model.recording_rate, rate):
+    await delay(duration)
+
+
+

With our effect model in place, we are done coding up the collect_data activity and the final result should look +something like this:

+
from pymerlin import MissionModel, Duration
+from pymerlin._internal._decorators import Validation
+from pymerlin.model_actions import delay
+
+
+@MissionModel
+class Model:
+    def __init__(self, registrar):
+        self.data_model = DataModel(registrar)
+        registrar.resource("counter", self.counter.get)
+
+class DataModel:
+    def __init__(self, registrar):
+        self.recording_rate = registrar.cell(0)
+        registrar.resource("recording_rate", self.recording_rate.get)
+
+@Model.ActivityType
+@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps")
+async def collect_data(model, rate=0.0, duration="01:00:00"):
+    model.data_model.recording_rate += rate
+    await delay(Duration.from_string(duration))
+    model.data_model.recording_rate -= rate
+
+
+

Ok! Now we are all set to give this a spin.

+
+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/2-model-test-drive.html b/docs/1_tutorials/getting-started/2-model-test-drive.html new file mode 100644 index 0000000..2fc69e5 --- /dev/null +++ b/docs/1_tutorials/getting-started/2-model-test-drive.html @@ -0,0 +1,386 @@ + + + + + + + + + Model Test Drive - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Model Test Drive

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+
+

Warning

+

This page is a stub, since python mission models cannot yet be uploaded to Aerie.

+
+

Within your IDE, compile the model (./gradlew assemble should do the trick) and make sure it built successfully by checking build/lib for a new missionmodel.jar file.

+

Follow these instructions to upload your .jar file, and give your model a name and version number (e.g. SSR Model version 1.0). Next, you can follow these instructions to create a new plan. Pick the model you just compiled to build your plan off of and name your plan Mission Plan 1 and give it a duration of 1 day. Click “Create” and click on the newly created plan to open it, which should take you to a view with the plan timeline in the center view panel.

+

On the left panel, you should see your collect_data activity type, which you can drag and drop onto the “Activities” row in the timeline. Your recording_rate resource should also appear as a row in the timeline, but with no values applied yet since we haven’t simulated. Put two activities in your plan and click on the second one (the first one we will leave alone and let it use default values). On the right panel, you should now see detailed information about your activity. Look for the “Parameters” section and you will see your rate and duration parameters, which you can modify. Try modifying the rate above 100.0 and you will see a warning icon appear, which you can hover over and see the message we wrote into a Validation earlier. Modify the rate back to 20 and change the default duration to 2 hours.

+
+

When activity types are initially added to the plan, they are shown with a play button icon and don’t have a duration. We call these “activity directives”, and it is these activities that you are allowed to modify by changing parameters, timing, etc. Once a simulation has been performed, one or more activities will appear below the directive, which are the activity instances. These actually have a duration (based on their effect model) and are the result of the simulation run.

+
+

On the top menu bar, click “Simulation” and then “Simulate”. After you see a green checkmark, recording_rate should be populated with a value profile. The value should begin at 0.0 (since we initialized it that way in the model) and pop up to 10 for the first activity and 20 for the second. You’ll also see that the activity instances below the activity directives (see note above) have durations that match the arguments we provided. At this point, your view will look similar to the screenshot below.

+

Tutorial Plan 1

+

At this point, we could go into more detail about how you can edit the timeline, edit your UI view, or view simulation history, but instead we will move back to our IDE and add some more complexity to our model.

+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/3-enum-derived-resource.html b/docs/1_tutorials/getting-started/3-enum-derived-resource.html new file mode 100644 index 0000000..31d00ad --- /dev/null +++ b/docs/1_tutorials/getting-started/3-enum-derived-resource.html @@ -0,0 +1,420 @@ + + + + + + + + + Enumerated and Derived Resources - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Enumerated and Derived Resources

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

In addition to our on-board camera, let’s imagine that we also have an instrument on-board that is continuously +collecting data, say a magnetometer, based on a data collection mode. Perhaps at especially interesting times in the +mission, the magnetometer is placed in a high rate collection mode and at other times remains in a low rate collection +mode. For our model, we want to be able to track the collection mode over time along with the associated data collection +rate of that mode.

+

The first thing we’ll do to accomplish this is create a Java enumeration called MagDataCollectionMode that gives us +the list of available collection modes along with a mapping of those modes to data collection rates +using enum fields. We will also add a +getter method to get the data rate based on the mode. Let’s say that we have three modes, OFF, LOW_RATE, +and HIGH_RATE with values 0.0, 500.0, and 5000.0, respectively. After coding this up, our enum should look like +this:

+
from enum import Enum
+
+
+class MagDataCollectionMode(Enum):
+    OFF = 0.0  # kbps
+    LOW_RATE = 500.0  # kbps
+    HIGH_RATE = 5000.0  # kbps
+
+
+

With our enumeration built, we can now add a couple of new resources to our DataModel class. The first resource, which +we’ll call MagDataMode, will track the current data collection mode for the magnetometer. Declare this resource as a +discrete MutableResource of type MagDataCollectionMode and then add the following lines of code to the constructor +to initialize the resource to OFF and register it with the UI.

+
self.MagDataMode = registrar.cell(discrete(MagDataCollectionMode.OFF));
+registrar.resource("MagDataMode", MagDataMode.get)
+
+
+

As you can see, declaring and defining this resource was not much different than when we built recording_rate except +that the type of the resource is an Enum rather than a number.

+

Another resource we can add is one to track the numerical value of the data collection rate of the magnetometer, which +is based on the collection mode. In other words, we can derive the value of the rate from the mode. Since we are +deriving this value and don’t intend to emit effects directly onto this resource, we can declare it as a +discrete Resource of type Double instead of a MutableResource.

+

When we go to define this resource in the constructor, we need to tell the resource to get its value by mapping +the MagDataMode to its corresponding rate. A special static method in the DiscreteResourceMonad class called map() +allows us to define a function that operates on the value of a resource to get a derived resource value. In this case, +that function is simply the getter function we added to the MagDataCollectionMode. The resulting definition and +registration code for MagDataRate then becomes

+
registrar.resource("MagDataRate", lambda: MagDataCollectionMode.get_data_rate(MagDataRate.get()));
+
+
+
+

Instead of deriving a resource value from a function using map(), there are a number of static methods in +the DiscreteResources class, which you can use to add(), multiply(), divide(), etc. resources. For example, you +could have a Total resource that simple used add() to sum some resources together.

+
+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/4-current-value.html b/docs/1_tutorials/getting-started/4-current-value.html new file mode 100644 index 0000000..a46b369 --- /dev/null +++ b/docs/1_tutorials/getting-started/4-current-value.html @@ -0,0 +1,402 @@ + + + + + + + + + Using Current Value in an Effect Model - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Using Current Value in an Effect Model

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

Now that we have our magnetometer resources, we need to build an activity that changes the MagDataMode for us ( +since MagDataRate is a derived resource, we shouldn’t have to touch it) and changes the overall SSR recording_rate to +reflect the magnetometer’s data rate change. This activity, which we’ll call change_mag_mode, only needs one parameter +of type MagDataCollectionMode to allow the user to request a change to the mode. Let’s give that parameter a default +value of LOW_RATE.

+

In the effect model for this activity (which we’ll call run() by convention), we can use the set() method in +the DiscreteEffects class to change the MagDataMode to the value provided by our mode parameter. The computation of +the change to the recording_rate caused by the mode change is a little tricky because we need to know both the value of +the MagDataRate before and after the mode change. Once we know those value, we can subtract the old value from the new +value to get the net increase to the recording_rate. If the new value happens to be less than the old value, our answer +will be negative, but that should be ok as long as we use the increase() method when effecting the recording_rate +resource.

+

We can get the current value of a resource with a static method called currentValue() available in the Resources +class. For our case here, we want to get the current value of the MagDataRate before we actually change the mode +to the requested value, so we have to be a little careful about the order of operations within our effect model. The +resulting activity type and its effect model should look something like this:

+
@Model.ActivityType()
+async def change_mag_mode(model, mode: MagDataCollectionMode = MagDataCollectionMode.LOW_RATE):
+    current_rate = model.data_model.MagDataRate.get()
+    new_rate = mode.get_data_rate()
+    // Divide by 10^3 for kbps->Mbps conversion
+    model.data_model.recording_rate += (new_rate-current_rate)/1.0e3
+    model.data_model.MagDataMode.set(mode)
+
+
+

Looking at our new activity definition, you can see how we use the increase() effect on recording_rate to “increase” +the data rate based on the net data change from the old rate. You may also notice a magic number where we do a unit +conversion from kbps to Mbps, which isn’t ideal. Later on in this tutorial, we will introduce a “Unit Aware” +resource framework that will help a bit with conversions like these if desired.

+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/5-second-look.html b/docs/1_tutorials/getting-started/5-second-look.html new file mode 100644 index 0000000..b04a92e --- /dev/null +++ b/docs/1_tutorials/getting-started/5-second-look.html @@ -0,0 +1,390 @@ + + + + + + + + + Second Look - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Second Look

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

With our second activity and corresponding resources built, let’s compile the model again and upload it into Aerie (if +you forget how to do this, refer to the Model Test Drive Page for simple instructions and +references). Build a new plan off of the model you just uploaded, name your plan Mission Plan 2, and give it a +duration of 1 day. When you open this plan, you will see your two activity types appear in the left panel, which you +can drag and drop onto the plan. Add two change_mag_mode activities and change the parameter of the first one +to HIGH_RATE. Add a collect_data activity in between the two change_mag_mode activities and then simulate.

+

You should now see our three resources populate with values in the timeline below. You’ll notice that now +the recording_rate resource starts at zero until the MagDataMode changes to HIGH_RATE, which pops up the rate +to 5 Mbps. Then, the collect_data activity increases the rate by another 10 to 15 Mbps, but immediately decreases +after the end of the activity. Finally, the MagDataMode changes to LOW_RATE, which takes the rate down to 0.5 Mbps +until the end of the plan.

+

At this point, you can take the opportunity to play around with +Aerie’s Timeline Editing capability to change the colors +of activities or lines or put multiple resources onto one row. Try putting the MagDataMode and MagDataRate on the +same row so you can easily see how the mode changes align with the rate changes and change the color of MagDataRate to +red. With these changes you should get something similar to the screenshot below

+

Tutorial Plan 2

+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/6-integrating-rate.html b/docs/1_tutorials/getting-started/6-integrating-rate.html new file mode 100644 index 0000000..db97cf7 --- /dev/null +++ b/docs/1_tutorials/getting-started/6-integrating-rate.html @@ -0,0 +1,627 @@ + + + + + + + + + Integrating Data Rate - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Integrating Data Rate

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

Now is where the fun really begins! Although having the data rate in and out of our SSR is useful, we are often more +concerned with the total amount of volume we have in our SSR in order to make sure we don’t over fill it and have +sufficient downlink opportunities to get all the data we collected back to Earth. In order to compute total volume, we +must figure out a way to integrate our recording_rate. It turns out there are many different methods in Aerie you can +choose to arrive at the total SSR volume, but each method has its own advantages and drawbacks. We will explore 4 +different options for integration with the final option, a derived Polynomial resource, being our recommended +approach. As we progress through the options, you’ll learn about a few more features of the resource framework that you +can use for different use cases in your model including the use of Reactions and daemon tasks.

+
+

Method 1 - Increase volume within activity

+

The simplest method for performing an “integration” of recording_rate is to compute the integral directly within the +effect model of the activities who change the recording_rate. Before we do this, let’s make sure we have a data volume +resource in our DataModel class. For each method, we are going to build a different data volume resource so we can +eventually compare them in the Aerie UI. As this is our simplest method, let’s call this resource ssr_volume_simple +and make it store volume in Gigabits (Gb). Since we are going to directly effect this resource in our activities, this +will need to be a MutableResource. The declaration looks just like recording_rate

+

as does the definition, initialization, and registration in the constructor:

+
self.ssr_volume_simple = registrar.cell(0.0)
+registrar.resource("ssr_volume_simple", self.ssr_volume_simple.get)
+
+
+

Taking a look at our collect_data activity, we can add the following line of code after the await delay() within its +body to compute the data volume resulting from the activity collecting data at a constant duration over the full +duration of the activity.

+
model.data_model.ssr_volume_simple += rate * duration.to_number_in(Duration.SECONDS) / 1000.0
+
+
+

This line will increase SRR_Volume_Simple at the end of the activity by rate times duration divided by our magic +number to convert Mb to Gb. Note that the duration object has some helper functions like to_number_in to help you +convert the duration type to a double value.

+

There are a few notable issues with this approach. The first issue is that when a plan is simulated, the data volume of +the SSR will only increase at the very end of the activity even though in reality, the volume is growing linearly in +time throughout the duration of the activity. If your planners only need this level of fidelity to do their work, this +may be ok. However, if your planners need a little more fidelity during the time span of the activity, you could spread +out the data volume accumulation over many steps. That would look something like this in code,

+
num_steps = 20
+step_size = duration / num_steps
+for i in range(num_steps):
+    await delay(step_size)
+model.data_model.ssr_volume_simple += this.rate * step_size.to_number_in(SECONDS) / 1000.0
+
+
+
+

which would replace the delay() and the single data volume increase line from above. The resulting timeline +for ssr_volume_simple would look like a stair step with the number of steps equal to num_steps. It’s important to +remember we are still using a Discrete resource, so the resource is stored as a constant, “step-function” profile in +Aerie. We will show the use of a Polynomial resource in our final method to truly store and view data volume as a +linear profile.

+

Another issue with this approach is that iy does not transfer well to activities like change_mag_mode that alter +the recording_rate and do not return the rate back to its original value at the end of the activity (i.e. activities +whose effects on rate are not contained within the time span of the activity). In order to compute the magnetometer’s +contribution to the data volume in change_mag_mode, we would need to multiply the current_rate by the duration since +the last mode change, or if no mode change has occurred, the beginning of the plan. While this is possible by using +a Clock resource to track time between mode changes, the change_mag_mode activity would now requires additional +context about the plan that would otherwise be unnecessary.

+

A third issue to note is that the computation of recording_rate and ssr_volume_simple are completely separate, and +both of them live within the activity effect model. In reality, these quantities are very much related and should be +tied together in some way. The relationship between rate and volume is activity independent, and thus it makes more +sense to define that relationship in our DataModel class instead of the activity itself.

+

Given these issues, we will hold off on implementing this approach for change_mag_mode and move forward to trying out +our next approach.

+
+
+

Method 2 - Sample-based volume update

+

Another method to integration we can take is a numerical approach where we compute data volume by sampling the value of +the recording_rate at a fixed interval across the entire plan. In order to implement this method, we can spawn() a +simple task from our top-level Mission class that runs in the background while the plan is being simulated, which is +completely independent of activities in the plan. Such tasks are known as daemon tasks, and your mission model can +have an arbitrary number of them.

+

Before we create this task, let’s add another discrete MutableResource of type double called ssr_volume_sampled to +the DataModel class. Just as with other resources we have made, the declaration will look like

+

and the definition, initialization, and registration in the constructor will be

+
self.ssr_volume_sampled = registrar.cell(0.0)
+registrar.resource("ssr_volume_sampled", self.ssr_volume_sampled.get)
+
+
+

In addition to the resource, let’s add another member variable to specify the sampling interval we’d like for our +integration. Choosing 60 seconds will result in the follow variable definition

+
INTEGRATION_SAMPLE_INTERVAL = Duration.of(60, Duration.SECONDS)
+
+
+

Staying in the DataModel class, we can can create a member function called integrate_sampled_ssr that has no +parameters, which we will spawn from the Mission class shortly. For the sake of simplicity, we will define this +function to take the “right” Reimann Sum (a “rectangle” rule approximation) of the recording_rate over time. The +implementation of this function looks like this:

+
async def integrate_sampled_ssr():
+    while (True):
+        await delay(INTEGRATION_SAMPLE_INTERVAL)
+        current_recording_rate = currentValue(recording_rate)
+        ssr_volume_sampled += (
+                current_recording_rate 
+                * INTEGRATION_SAMPLE_INTERVAL.to_number_in(Duration.SECONDS) 
+                / 1000.0)  # Mbit -> Gbit
+
+
+

As a programmer, you may be surprised to see an infinite while loop, but Aerie will shut down this task, effectively +breaking the loop, once the simulation reaches the end of the plan. Within the loop, the first thing we do is delay() +by our sampling interval and then retrieve the current value of recording_rate. Finally, we sum up our rectangle by +multiplying the current rate by the sampling interval. We could have easily chosen to use other numerical methods like +the “trapezoid” rule by storing the previous recording rate in addition to the current rate, but what we did is +sufficient for now.

+

The final piece we need to build into our model to get this method to work is a simple spawn with the Mission class +to our integrate_sampled_ssr method.

+
spawn(self.data_model::integrate_sampled_ssr)
+
+
+

The issues with this approach to integration are probably fairly apparent to you. First of all, this approach is truly +an approximation, so the resulting volume may not be the actual volume if the sampled points don’t align perfectly with +the changes in recording_rate. Secondly, the fact we are sampling at a fixed time interval means we could be computing +many more time points than we actually need if the recording rate isn’t changing between time points. If you were to try +to scale up this approach, you might run into performance issues with your model where simulation takes much longer than +it needs to.

+

Despite these issues daemon tasks are a very effective tool in a modelers tool belt for describing “background” +behavior of your system. Examples for a spacecraft model could include the computation of geometry, battery degradation +over time, environmental effects, etc.

+
+
+

Method 3 - Update volume upon change to rate

+

If you are looking for an efficient, yet accurate way to compute data volume from recording_rate, one method you could +take is to set up trigger that calls a function whenever recording_rate changes and then computes volume by +multiplying +the rate just before the latest change by the duration that has passed since the last change. Fortunately, there is a +fairly easy way to do this in Aerie’s modeling framework.

+

Let’s begin by creating one more discrete MutableResource called ssr_volume_upon_rate_change in our DataModel +class (refer back to previous instances in this tutorial for how to declare and define one of these). In addition to our +volume resource, we are also going to need a Clock resource to help us track the time between changes +to recording_rate. Since this resource is more of a “helper” resource and doesn’t need to be exposed to our planners, +we’ll make it private and not register it to the UI. Declaring and defining a Clock resource is not much different +than declaring a Discrete except you don’t have to specify a primitive type. The declaration looks like this

+

and the definition in the constructor looks like this

+
self.time_since_last_rate_change = registrar.cell(Duration.ZERO, behavior=Clock.behavior)
+
+
+

This will start a “stopwatch” right at the start of the plan so we can track the time between the start of the plan and +the first time recording_rate is changed. We’ll also need one more member variable of type Double, which we’ll +call previous_rate to keep track of the previous value of recording_rate for us.

+
previous_recording_rate = 0.0
+
+
+

Our next step is to build our trigger to react when there is a change to recording_rate. We can do this by leveraging +the wheneverUpdates() static method available within the framework’s Reactions class

+
Reactions.wheneverUpdates(recording_rate, this::upon_recording_rate_update)
+
+
+
+

The Reactions class has a couple more static methods that a modeler may find useful. The every() method allows you +to specify a duration to call a recurring action (we could have used this instead of our spawn() for the sampled +integration method). The whenever() method allows you to specify a Condition, which when met, would trigger an +action of your choosing. An example of a condition could be when a resource reaches a certain threshold.

+
+

As you can see, this method takes a resource as its first argument and some Runnable, like a function call, as it’s +second argument. We have specified that the function upon_recording_rate_update be called, so now we have to implement +that function within our DataModel class. The implementation of that function is below, which we will walk through +line by line.

+
upon_recording_rate_update():
+# Determine time elapsed since last update
+t = time_since_last_rate_change.get()
+# Update volume only if time has actually elapsed
+if !t.isZero():
+    ssr_volume_upon_rate_change += previous_recording_rate * t.to_number_in(Duration.SECONDS) / 1000.0)  # Mbit -> Gbit
+
+    previous_recording_rate = recording_rate.get()
+    # Restart clock (set back to zero)
+    ClockEffects.restart(time_since_last_rate_change)
+
+
+
+

When the recording_rate resource changes, the first thing we do is determine how much time has passed since it last +changed (or since the beginning of the plan). If no time has passed, we don’t want to re-integrate and double count +volume, but if time has passed, we do our simple integration by multiplying the previous rate by the elapsed time since +the value of rate changed. We then store the new value of rate as the previous rate and restart our stopwatch to we get +the right time next time the rate changes.

+

And that’s it! Now, every time recording_rate changes, the SSR volume will update to the correct volume. However, the +volume is still a discrete resource, so volume will only change as a step function at time points where the rate +changes. Nonetheless, since recording_rate is piece-wise constant, you’ll get the right answer for volume with no +error +at those time points.

+
+
+

Method 4 - Derived volume from polynomial resource

+

We have finally arrived at the final method we’ll go through for integrating recording_rate, and in some ways, this +one +is the most straightforward. We will define our data volume as polynomial resource, ssr_volume_polynomial, which we +can build by using an integrate() static method provided by the PolynomialResources class. As a polynomial resource, +we will actually see the volume increase linearly over time as opposed to in discrete chunks. +Since ssr_volume_polynomial will be derived directly from recording_rate, we can make this a Resource as opposed +to +a MutableResource. The declaration of our new resource looks like this

+

while the definition and registration in the constructor of our DataModel class look like this

+
self.ssr_volume_polynomial = scale(
+    PolynomialResources.integrate(as_polynomial(this.recording_rate), 0.0), 1e-3) # Gbit
+registrar.resource("ssr_volume_polynomial", ssr_volume_polynomial.approx_linear)
+
+
+

Breaking down the definition, we see the integrate() function takes the resource to integrate as the first argument, +but that argument requires the resource to be polynomial as well. Fortunately, there is a function +in the PolynomialResources module called as_polynomial() that can convert discrete resources like recording_rate +to +polynomial ones. The second argument is the initial value for the resource, which we have been assuming is 0.0 for +data volume. The integrate() function is then wrapped by scale(), another handy static method +in PolynomialResources to convert our resource from Megabit to Gigabit.

+

The resource registration is also slightly different than what we have seen thus far as we are using a real() method +as opposed to discrete() and we have to wrap our resource with yet another static helper method +in PolynomialResources called assumeLinear(). The reason we have to do this is that the UI currently does not have +support for Polynomial resources and can only render timelines as linear or constant segments. In our +case, ssr_volume_polynomial is actually linear anyway, so we are not “degrading” our resource by having to make this +down conversion.

+

Now in reality, our on-board SSR is going to have a max capacity, and if data is removed from the SSR, we want to +make sure our model stops decreasing the SSR volume once it reaches 0.0. By good fortune, the Aerie framework +includes another static method in PolynomialResources called clampedIntegral() that allows you to build a resource +that takes care of all that messy logic to make sure you are adhering to your min/max limits.

+

If we wanted to build a “clamped” version of ssr_volume_polynomial, it would look something like this

+
clamped_integrate = PolynomialResources.clamped_integrate(scale(
+    as_polynomial(this.recording_rate), 1e-3),
+    PolynomialResources.constant(0.0),
+    PolynomialResources.constant(250.0),
+    0.0)
+ssr_volume_polynomial = clamped_integrate.integral()
+
+
+

The second and third arguments of clamped_integrate() are the min and max bounds for the integral and the final +argument is the starting value for the resource as it was in integrate(). The clamped_integrate() method actually +returns a record of three resources:

+
    +
  • integral – The clamped integral value (i.e. the main resource of interest)

  • +
  • overflow – The rate of overflow when the integral hits its upper bound. You can integrate this to get cumulative +overflow.

  • +
  • underflow – The rate of underflow when the integral hits its lower bound. You can integrate this to get cumulative +underflow.

  • +
+

As expected, the integral() resource is mapped to ssr_volume_polynomial to complete its definition.

+
+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/7-integration-comparision.html b/docs/1_tutorials/getting-started/7-integration-comparision.html new file mode 100644 index 0000000..3d0f012 --- /dev/null +++ b/docs/1_tutorials/getting-started/7-integration-comparision.html @@ -0,0 +1,410 @@ + + + + + + + + + Integral Method Comparison - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Integral Method Comparison

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

Now that we have explored multiple methods to implement integration in Aerie, let’s compare all of the methods in the +Aerie UI. To make things more interesting, use the 2nd approach to the Polynomial method so we can see how that +approach enforces a data volume capacity. Compile the current version of the model (./gradlew assemble) and upload it +into Aerie. Build a new 1 day plan off of that model and call it “Mission Plan 3”.

+

For this plan, throw a couple of collect_data activities near the beginning of the plan, create a change_mag_mode +activity after those activities in the first half of the plan and set that activity’s parameter to HIGH_RATE. Throw +one more collect_data and change_mag_mode activity near the end of the plan to make sure we get a plan that goes over +our data capacity threshold. With our simple plan built, go ahead and simulate the plan to see the resulting resource +profiles.

+

The easiest way to compare our four integration methods is to use +Aerie’s Timeline Editing capability to build a row that +includes all four of our data volume resources:

+
    +
  • ssr_volume_simple

  • +
  • ssr_volume_sampled

  • +
  • ssr_volume_upon_rate_change

  • +
  • ssr_volume_polynomial

  • +
+

If you do that, you’ll get a timeline view that looks something like the screenshot below

+

Tutorial Plan 3

+

Looking at ssr_volume_simple, you’ll see that data volume increases at the end of each collect_data activity, and for +the first two activities, the result at the end of the activity is consistent with the other volumes. You may recall +that we did not implement a data volume integration for the change_mag_mode activity for ssr_volume_simple (although +we could have with some work), so as soon as one of those activities is introduced into our plan, our volume is no +longer valid.

+

ssr_volume_sampled has a nice looking profile when zoomed out at the expense of computing many points, which you can +see if you zoom into a shorter time span. If you zoom far enough, you can see the stair-step associated with computation +of each sampled point. If we were to change our sampling interval to something larger, we would lose some accuracy in +our volume calculation if the activity start/end times aren’t aligned with are sample points.

+

ssr_volume_upon_rate_change has much fewer points, but you can see that it produces the same volume as +our ssr_volume_polynomial resource at the time points it computes until we go above our maximum +capacity. ssr_volume_polynomial has same computed points as ssr_volume_upon_rate_change, but has linear profile +segments in between points. It also has an additional point once it reaches the capacity threshold, and then it remains +at that threshold for the remainder of the plan (we don’t have any downlinks or we would see the volume decrease).

+

Hopefully looking at the various methods of integrating in Aerie has given you some insight into the modeling constructs +available to you. You can do a ton with what you have learned thus far, but next we’ll go over some additional +capabilities you will likely find useful as you build models with Aerie.

+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/8-simulation-config.html b/docs/1_tutorials/getting-started/8-simulation-config.html new file mode 100644 index 0000000..1f89909 --- /dev/null +++ b/docs/1_tutorials/getting-started/8-simulation-config.html @@ -0,0 +1,473 @@ + + + + + + + + + Sim Configuration - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Sim Configuration

+
+

Warning

+

This page is under construction. Please bear with us as we port +our Java tutorial to python.

+
+

There is often a need for certain aspects of a model to be exposed to the planner to provide flexibility to tweak and +configure the model prior to a simulation run. The Aerie modeling framework provides +a simulation configuration interface to satisfy +this need. In our SSR model, we will expose a couple variables that already exist in our code: the sample interval for +our SSR_Volume_Sampled resource and the SSR max capacity defined as part of the ssr_volume_polynomial resource +definition. We will also create a new model configuration for setting the initial state of the MagDataMode.

+

Back when we initially grabbed the mission model template to give us a jumping off point for our model, you may recall +that the template provided a Configuration class, and that class is already passed into the top-level Mission class +as a parameter. Taking a look at the Configuration class (which is actually +a java record), you’ll see there is already a static method there +called defaultConfiguration() that uses +the @Template annotation. This type +of annotation assumes every variable within the parent class should be exposed as simulation configuration (or a +parameter if you use this within activities) with a default value. So, in our case, we will declare three member +variables and give them all default values that match the values we have for them in the DataModel class, which we +will soon replace with references to this configuration.

+
public static final Double SSR_MAX_CAPACITY = 250.0;
+
+public static final long INTEGRATION_SAMPLE_INTERVAL = 60;
+
+public static final MagDataCollectionMode STARTING_MAG_MODE = MagDataCollectionMode.OFF;
+
+
+

In order to hook up these member variables to our record, we need to add three constructor parameters and then update +the defaultConfiguration() method to pass in these default values to construct a record with default values. Once we +do this, we get a Configuration record that looks like this:

+
package missionmodel;
+
+import static gov.nasa.jpl.aerie.merlin.framework.annotations.Export.Template;
+
+public record Configuration(Double ssrMaxCapacity,
+                            long integrationSampleInterval,
+                            MagDataCollectionMode startingMagMode) {
+
+  public static final Double SSR_MAX_CAPACITY = 250.0;
+
+  public static final long INTEGRATION_SAMPLE_INTERVAL = 60;
+
+  public static final MagDataCollectionMode STARTING_MAG_MODE = MagDataCollectionMode.OFF;
+
+  public static @Template Configuration defaultConfiguration() {
+    return new Configuration(SSR_MAX_CAPACITY,
+                             INTEGRATION_SAMPLE_INTERVAL,
+                             STARTING_MAG_MODE);
+  }
+}
+
+
+

Now, when Aerie loads in our model, the member variables above will be exposed as simulation configuration with defaults +set to the defaults defined in this record. However, at the moment, changing the values from their defaults won’t +actually change the behavior of the simulation because our DataModel doesn’t yet know about this configuration. Within +our top-level Mission class, we need to pass our configuration into DataModel via its constructor

+
this.dataModel = new DataModel(this.errorRegistrar, config);
+
+
+

and then update the DataModel class constructor to include Configuration as an argument:

+
public DataModel(Registrar registrar, Configuration config) { ... }
+
+
+

Now we must find references to our original, hard-coded values for our configuration and replace them with references to +our config object.

+

Here is what this looks like for ssrMaxCapacity

+
var clampedIntegrate = PolynomialResources.clampedIntegrate( scale(
+    asPolynomial(this.recording_rate), 1e-3),
+    PolynomialResources.constant(0.0),
+    PolynomialResources.constant(config.ssrMaxCapacity()),
+    0.0);
+
+
+

and integrationSampleInterval

+
INTEGRATION_SAMPLE_INTERVAL = Duration.duration(config.integrationSampleInterval(), Duration.SECONDS);
+
+
+

Note that for the sample interval, we had to move from a hardcoded definition as part of the variable declaration and +move the definition to the constructor, which you could put on the line following the registration of +the SSR_Volume_Sampled resource.

+

Our final configuration parameter, startingMagMode, is not quite as straightforward as the other two because in +addition to ensuring that the initial value of MagDataMode is set correctly, we need to make sure that the +initial recording_rate also takes into account the MagDataRate associated with the initial MagDataMode. We can +achieve this by switching around the order of construction so that the recording_rate is defined after the mag mode and +rate. We also need to make sure the previousrecording_rate used to compute our ssr_volume_upon_rate_change resource is +set to the initial value of recording_rate. The resulting code will look like this

+
self.MagDataMode = registrar.cell(discrete(config.startingMagMode()));
+registrar.discrete("MagDataMode",self.MagDataMode, new EnumValueMapper<>(MagDataCollectionMode.class));
+
+self.MagDataRate = map(MagDataMode, MagDataCollectionMode::get_data_rate);
+registrar.discrete("MagDataRate", self.MagDataRate, new DoubleValueMapper());
+
+recording_rate = registrar.cell(discrete(currentValue(MagDataRate)/1e3));
+registrar.discrete("recording_rate", recording_rate, new DoubleValueMapper());
+previousrecording_rate = currentValue(recording_rate);
+
+
+

Now you should be ready to try this out in the Aerie UI. Go ahead and compile your model with simulation configuration +and upload it to Aerie. Build whatever plan you’d like and then before you simulate, in the left panel view, select “ +Simulation” in the dropdown menu. You should now see your three configuration variables appear under “Arguments”

+

Simulation Config

+

Aerie is smart enough to look at the types of the configuration variables and generate a input field in the UI that best +matches that type. So, for example, the startingMagMode is a simple drop down menu with the only options available +being members of the MagDataCollectionMode enumeration.

+
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/getting-started/index.html b/docs/1_tutorials/getting-started/index.html new file mode 100644 index 0000000..369f50f --- /dev/null +++ b/docs/1_tutorials/getting-started/index.html @@ -0,0 +1,394 @@ + + + + + + + + + Intro Tutorial: Solid State Recorder - pymerlin 0.0.8 documentation + + + + + + + + + + + + + + + + Contents + + + + + + Menu + + + + + + + + Expand + + + + + + Light mode + + + + + + + + + + + + + + Dark mode + + + + + + + Auto light/dark mode + + + + + + + + + + + + Auto light/dark, in light mode + + + + + + + + + + + + + + + Auto light/dark, in dark mode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Skip to content + + + +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ + + + + Back to top + +
+ +
+ +
+ +
+
+
+

Intro Tutorial: Solid State Recorder

+

In this tutorial, you’ll start from scratch and write a data model to track the rate and volume of a +spacecraft’s solid state recorder. This is the recommended first tutorial for new users of pymerlin!

+ +
+ +
+
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/docs/1_tutorials/index.html b/docs/1_tutorials/index.html index 56faf16..6dbeb18 100644 --- a/docs/1_tutorials/index.html +++ b/docs/1_tutorials/index.html @@ -229,6 +229,7 @@
  • User Guides
  • User Guides
  • User Guides
  • User Guides
  • User Guides
      +
    • How to organize your project
    • How to use pymerlin in Jupyter
    • Modeling Data Volume
    • Modeling Power
    • @@ -311,6 +312,10 @@

      User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
        +
      • How to organize your project
      • How to use pymerlin in Jupyter
      • Modeling Data Volume
      • Modeling Power
      • diff --git a/docs/_sources/1_tutorials/getting-started/1-gettingstarted.md.txt b/docs/_sources/1_tutorials/getting-started/1-gettingstarted.md.txt new file mode 100644 index 0000000..e95b8ae --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/1-gettingstarted.md.txt @@ -0,0 +1,300 @@ +# Getting Started + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Welcome Aerie modeling padawans! For your training today, you will be learning the basics of mission modeling in Aerie +by building your own simple model of an on-board spacecraft solid state recorder (SSR). This model will track the +recording rate into the recorder from a couple instruments along with the integrated data volume over time. Through the +process of building this model, you'll learn about the fundamental objects of a model, activities and resources, and +their structure. You'll be introduced to the different categories of resources and learn how you define and implement +each along with restrictions on when you can/can't modify them. As a bonus, we will also cover how you can make your +resources "unit aware" to prevent those pesky issues that come along with performing unit conversions and how you can +test your model without having to pull your model into an Aerie deployment. + +Let the training begin! + +## Installing pymerlin + +If you haven't already, go to the [quickstart](../../quickstart.md) guide to get set up with pymerlin. + +## Creating a Mission Model + +Start by creating a `mission.py` file with the following contents: + +```python +from pymerlin import MissionModel + + +@MissionModel +class Model: + def __init__(self, registrar): + self.data_model = DataModel(registrar) + + +class DataModel: + def __init__(self, registrar): + "YOUR CODE HERE" +``` + +## Your First Resource + +We will begin building our SSR model by creating a single resource, `recording_rate`, to track the rate at which data is +being written to the SSR over time. As a reminder, a **Resource** is any measurable quantity whose behavior we want to +track over the course of a plan. Then, we will create a simple activity, `collect_data`, that updates the `recording_rate` +by a user-specified rate for a user-specified duration. This activity is intended to represent an on-board camera taking +images and writing data to the spacecraft SSR. + +Although we could define the `recording_rate` resource directly in the pre-provided top-level `Mission` class, we'd like +to keep that class as simple as possible and delegate most of model's behavior definition to other, more focused +classes. With this in mind, let's create a new class within the `missionmodel` package called `DataModel`, which we will +eventually instantiate within the `Mission` class. + +In the `DataModel` class, declare the `recording_rate` resource by replacing `"YOUR CODE HERE"` with the following line +of code: + +```python +self.recording_rate = registrar.cell(0) # Megabits/s +``` + + + +Let's tease apart this line of code and use it as an opportunity to provide a brief overview of the various types of +resources available to you as a modeler. The mission modeling framework provides two primary classes from which to +define resources: + +1. `MutableResource` - resource whose value can be explicitly updated by activities or other modeling code after it has + been defined. Updates to the resource take the form of "Effects" such as `increase`, `decrease`, or `set`. The values + of this category of resource are explicitly tracked in objects called "Cells" within Aerie, which you can read about + in detail in + the [Aerie Software Design Document](https://ammos.nasa.gov/aerie-docs/overview/software-design-document/#cells) if + you are interested. +2. `Resource` - resource whose value cannot be explicitly updated after it has been defined. In other words, these + resources cannot be updated via "Effects". The most common use of these resources are to create "derived" resources + that are fully defined by the values of other resources (we will have some examples of these later). Since these + resources get their value from other resources, they actually don't need to store their own value within a "Cell". + Interestingly, the `MutableResource` class extends the `Resource` class and includes additional logic to ensure + values are correctly stored in these "Cells". + +From these classes, there are a few different types of resources provided, which are primarily distinguished by how the +value of the resource progresses between computed points: + +- `Discrete` - resource that maintains a constant value between computed points (i.e. a step function or piecewise + constant function). Discrete resources can be defined as many different types such as `Boolean`, `Integer`, `Double`, + or an enumeration. These types of resources are what you traditionally find in discrete event simulators and are the + easiest to define and "effect". +- `Linear` - resource that has a linear profile between computed points. When computing the value of such resources you + have to specify both the value of the resource at a given time along with a rate so that the resource knows how it + should change until the next point is computed. The resource does not have to be strictly continuous. In other words, + the linear segments that are computed for the resource do not have to match up. Unlike discrete resources, a linear + resource is implicitly defined as a `Double`. +- `Polynomial` - generalized version of the linear resource that allows you to define resources that evolve over time + based on polynomial functions. +- `Clock` - special resource type to provide "stopwatch" like functionality that allows you to track the time since an + event occurred. + +TODO: Add more content on `Clock` + +:::{note} +Polynomial resources currently cannot be rendered in the Aerie UI and must be transformed to a linear resource (an +example of this is shown later in the tutorial) +::: + +Looking back at our resource declaration, you can see that `recording_rate` is a `MutableResource` (we will emit effects +on this resource in our first activity) of the type `Discrete`, so the value of the resource will stay constant +until the next time we compute effects on it. + +Next, we must define and initialize our `recording_rate` resource, which we can do in a class constructor that takes one +parameter we'll called `registrar` of type `Registrar`. You can think of the `Registrar` class as your link to what will +ultimately get exposed in the UI and in a second we will use this class to register `recording_rate`. But first, let's +add the following line to the constructor we just made to fully define our resource. + +Both the `MutableResource` and `Discrete` classes have static helper functions for initializing resources of their type. +If you included those functions via `import static` statements, you get the simple line above. The `discrete()` function +expects an initial value for the resource, which we have specified as `0.0`. + +The last thing to do is to register `recording_rate` to the UI so we can view the resource as a timeline along with our +activity plan. This is accomplished with the following line of code: + +```python +registrar.resource("recording_rate", self.recording_rate.get); +``` + +:::{note} +Notice that `self.recording_rate.get` does not have parenthesies at the end. This is because we are registering +the `get` +function itself as a resource. Resources are functions that perform computations on cells +::: + +The first argument to this `resource` function is the string name of the resource you want to appear in the simulation +results, +and the second argument is the resource itself. + +You have now declared, defined, and registered your first resource and your `DataModel` class should look something like +this: + +```python +class DataModel: + def __init__(self, registrar): + self.recording_rate = registrar.cell(0) + registrar.resource("recording_rate", self.recording_rate.get) +``` + +With our `DataModel` class built, we can now instantiate it within the top-level `Model` class as a member variable of +that class. The `Registrar` that we are passing to `DataModel` is unique in that it can log simulation errors as a +resource, so we also need to instantiate one of these special error registrars as well. After these additions, +the `Mission` class should look like this: + +```python +from pymerlin import MissionModel + + +@MissionModel +class Model: + def __init__(self, registrar): + self.data_model = DataModel(registrar) + + +class DataModel: + def __init__(self, registrar): + self.recording_rate = registrar.cell(0) + registrar.resource("recording_rate", self.recording_rate.get) +``` + +## Your First Activity + +Now that we have a resource, let's build an activity called `collect_data` that emits effects on that resource. We can +imagine this activity representing a camera on-board a spacecraft that collects data over a short period of time. +Activities in Aerie follow the general definition given in +the [CCSDS Mission Planning and Scheduling Green Book](https://public.ccsds.org/Pubs/529x0g1.pdf) + +> "An activity is a meaningful unit of what can be planned… The granularity of a Planning Activity depends on the use +> case; It can be hierarchical" + +Essentially, activities are the building blocks for generating your plan. Activities in Aerie follow a class/object +relationship +where [activity types](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/introduction/) - defined +as a class in Java - describe the structure, properties, and behavior of an object and activity instances are the actual +objects that exist within a plan. + +Since activity types are implemented by async functions in python, create a new function called `collect_data` and add the +following decorator above that function, which allows pymerlin to recognize this function as an activity type. + +```python +@Model.ActivityType +async def collect_data(model): + pass +``` + +:::{note} +The `async` keyword allows pymerlin to interleave the execution of your new activity with other activities, which is +important when activities can pause and resume at various times +::: + +Let's define +two [parameters](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/parameters/), `rate` +and `duration`, and give them default arguments. Parameters allow the behavior of an activity to be modified by an +operator without modifying its code. + +```python +@Model.ActivityType +async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")): + pass +``` + +For our activity, we will give `rate` a default value of `10.0` megabits per second and `duration` a default value of +`1` hour using pymerlin's built-in `Duration` type. + +Right now, if an activity of this type was added to a plan, an operator could alter the parameter defaults to any value +allowed by the parameter's type. Let's say that due to buffer limitations of our camera, it can only collect data at a +rate of `100.0` megabits per second, and we want to notify the operator that any rate above this range is invalid. We +can do this +with [parameter validations](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/parameters/#validations) +by adding a method to our class with a couple of annotations: + +```python +@Model.ActivityType +@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps") +async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")): + pass +``` + +The `@Validation` decorator specifies a function to validate one or more parameters, and a message to present to the +operator when the validation fails. Now, as you will see soon, when an operator specifies a data rate above `100.0`, +Aerie will show a validation error and message. + +Next, we need to tell our activity how and when to effect change on the `recording_rate` resource, which is done in +an [Activity Effect Model](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/effect-model/). We do +this by filling out the body of the `collect_data` function. + +For our activity, we simply want to model data collection at a fixed rate specified by the `rate` parameter over the +full duration of the activity. Within the `run()` method, we can add the follow code to get that behavior: + +```python +@Model.ActivityType +@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps") +async def collect_data(model, rate=0.0, duration=Duration.from_string("01:00:00")): + model.data_model.recording_rate += rate + await delay(duration); + model.data_model.recording_rate -= rate +``` + +Effects on resources are accomplished by using one of the many static methods available in the class associated with +your resource type. In this case, `recording_rate` is a discrete resource, and therefore we are using methods from +the `DiscreteEffects` class. If you peruse the static methods in `DiscreteEffects`, you'll see methods +like `set()`, `increase()`, `decrease()`, `consume()`, `restore()`,`using()`, etc. Since discrete resources can be of +many primitive types (e.g. `Double`,`Boolean`), there are specific methods for each type. Most of these effects change +the value of the resource at one time point instantaneously, but some, like `using()`, allow you to specify +an [action](https://nasa-ammos.github.io/aerie-docs/mission-modeling/activity-types/effect-model/#actions) to run +like `delay()`. Prior to executing the action, the resource changes just like other effects, but once the action is +complete, the effect on the resource is reversed. These resource effects are sometimes called "renewable" in contrast to +the other style of effects, which are often called "consumable". + +In our effect model for this activity, we are using the "consumable" effects `increase()` and `decrease()`, which as you +would predict, increase and decrease the value of the `recording_rate` by the `rate` parameter. The `run()` method is +executed at the start of the activity, so the increase occurs right at the activity start time. We then perform +the `delay()` action for the user-specified activity `duration`, which moves time forward within this activity before +finally reversing the rate increase. Since there are no other actions after the rate decrease, we know we have reached +the end of the activity. + +If we wanted to save a line of code, we could have the "renewable" effect `using()` to achieve the same result: + +```python +with using(model.data_model.recording_rate, rate): + await delay(duration) +``` + +With our effect model in place, we are done coding up the `collect_data` activity and the final result should look +something like this: + +```python +from pymerlin import MissionModel, Duration +from pymerlin._internal._decorators import Validation +from pymerlin.model_actions import delay + + +@MissionModel +class Model: + def __init__(self, registrar): + self.data_model = DataModel(registrar) + registrar.resource("counter", self.counter.get) + +class DataModel: + def __init__(self, registrar): + self.recording_rate = registrar.cell(0) + registrar.resource("recording_rate", self.recording_rate.get) + +@Model.ActivityType +@Validation(lambda rate: rate < 100.0, "Collection rate is beyond buffer limit of 100.0 Mbps") +async def collect_data(model, rate=0.0, duration="01:00:00"): + model.data_model.recording_rate += rate + await delay(Duration.from_string(duration)) + model.data_model.recording_rate -= rate +``` + +Ok! Now we are all set to give this a spin. + diff --git a/docs/_sources/1_tutorials/getting-started/2-model-test-drive.md.txt b/docs/_sources/1_tutorials/getting-started/2-model-test-drive.md.txt new file mode 100644 index 0000000..3433a04 --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/2-model-test-drive.md.txt @@ -0,0 +1,28 @@ +# Model Test Drive + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +:::{warning} +This page is a stub, since python mission models cannot yet be uploaded to Aerie. +::: + +Within your IDE, compile the model (`./gradlew assemble` should do the trick) and make sure it built successfully by checking `build/lib` for a new `missionmodel.jar` file. + +Follow [these instructions](https://ammos.nasa.gov/aerie-docs/planning/upload-mission-model/) to upload your `.jar` file, and give your model a name and version number (e.g. SSR Model version 1.0). Next, you can follow [these instructions](https://ammos.nasa.gov/aerie-docs/planning/create-plan-and-simulate/#instructions) to create a new plan. Pick the model you just compiled to build your plan off of and name your plan `Mission Plan 1` and give it a duration of `1 day`. Click "Create" and click on the newly created plan to open it, which should take you to a view with the plan timeline in the center view panel. + +On the left panel, you should see your `collect_data` activity type, which you can drag and drop onto the "Activities" row in the timeline. Your `recording_rate` resource should also appear as a row in the timeline, but with no values applied yet since we haven't simulated. Put two activities in your plan and click on the second one (the first one we will leave alone and let it use default values). On the right panel, you should now see detailed information about your activity. Look for the "Parameters" section and you will see your rate and duration parameters, which you can modify. Try modifying the rate above `100.0` and you will see a warning icon appear, which you can hover over and see the message we wrote into a Validation earlier. Modify the rate back to `20` and change the default duration to `2 hours`. + +:::info + +When activity types are initially added to the plan, they are shown with a play button icon and don't have a duration. We call these "activity directives", and it is these activities that you are allowed to modify by changing parameters, timing, etc. Once a simulation has been performed, one or more activities will appear below the directive, which are the activity instances. These actually have a duration (based on their effect model) and are the result of the simulation run. + +::: + +On the top menu bar, click "Simulation" and then "Simulate". After you see a green checkmark, `recording_rate` should be populated with a value profile. The value should begin at 0.0 (since we initialized it that way in the model) and pop up to `10` for the first activity and `20` for the second. You'll also see that the activity instances below the activity directives (see note above) have durations that match the arguments we provided. At this point, your view will look similar to the screenshot below. + +![Tutorial Plan 1](assets/Tutorial_Plan_1.png) + +At this point, we could go into more detail about how you can [edit the timeline](https://nasa-ammos.github.io/aerie-docs/planning/timeline-editing/), edit your UI view, or view simulation history, but instead we will move back to our IDE and add some more complexity to our model. \ No newline at end of file diff --git a/docs/_sources/1_tutorials/getting-started/3-enum-derived-resource.md.txt b/docs/_sources/1_tutorials/getting-started/3-enum-derived-resource.md.txt new file mode 100644 index 0000000..4c217ed --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/3-enum-derived-resource.md.txt @@ -0,0 +1,65 @@ +# Enumerated and Derived Resources + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +In addition to our on-board camera, let's imagine that we also have an instrument on-board that is continuously +collecting data, say a magnetometer, based on a data collection mode. Perhaps at especially interesting times in the +mission, the magnetometer is placed in a high rate collection mode and at other times remains in a low rate collection +mode. For our model, we want to be able to track the collection mode over time along with the associated data collection +rate of that mode. + +The first thing we'll do to accomplish this is create a Java enumeration called `MagDataCollectionMode` that gives us +the list of available collection modes along with a mapping of those modes to data collection rates +using [enum fields](https://issac88.medium.com/java-enum-fields-methods-constructors-3a19256f58b). We will also add a +getter method to get the data rate based on the mode. Let's say that we have three modes, `OFF`, `LOW_RATE`, +and `HIGH_RATE` with values `0.0`, `500.0`, and `5000.0`, respectively. After coding this up, our enum should look like +this: + +```python +from enum import Enum + + +class MagDataCollectionMode(Enum): + OFF = 0.0 # kbps + LOW_RATE = 500.0 # kbps + HIGH_RATE = 5000.0 # kbps +``` + +With our enumeration built, we can now add a couple of new resources to our `DataModel` class. The first resource, which +we'll call `MagDataMode`, will track the current data collection mode for the magnetometer. Declare this resource as a +discrete `MutableResource` of type `MagDataCollectionMode` and then add the following lines of code to the constructor +to initialize the resource to `OFF` and register it with the UI. + +```python +self.MagDataMode = registrar.cell(discrete(MagDataCollectionMode.OFF)); +registrar.resource("MagDataMode", MagDataMode.get) +``` + +As you can see, declaring and defining this resource was not much different than when we built `recording_rate` except +that the type of the resource is an Enum rather than a number. + +Another resource we can add is one to track the numerical value of the data collection rate of the magnetometer, which +is based on the collection mode. In other words, we can derive the value of the rate from the mode. Since we are +deriving this value and don't intend to emit effects directly onto this resource, we can declare it as a +discrete `Resource` of type `Double` instead of a `MutableResource`. + +When we go to define this resource in the constructor, we need to tell the resource to get its value by mapping +the `MagDataMode` to its corresponding rate. A special static method in the `DiscreteResourceMonad` class called `map()` +allows us to define a function that operates on the value of a resource to get a derived resource value. In this case, +that function is simply the getter function we added to the `MagDataCollectionMode`. The resulting definition and +registration code for `MagDataRate` then becomes + +```python +registrar.resource("MagDataRate", lambda: MagDataCollectionMode.get_data_rate(MagDataRate.get())); +``` + +:::info + +Instead of deriving a resource value from a function using `map()`, there are a number of static methods in +the `DiscreteResources` class, which you can use to `add()`, `multiply()`, `divide()`, etc. resources. For example, you +could have a `Total` resource that simple used `add()` to sum some resources together. + +::: diff --git a/docs/_sources/1_tutorials/getting-started/4-current-value.md.txt b/docs/_sources/1_tutorials/getting-started/4-current-value.md.txt new file mode 100644 index 0000000..bbc8f2c --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/4-current-value.md.txt @@ -0,0 +1,40 @@ +# Using Current Value in an Effect Model + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Now that we have our magnetometer resources, we need to build an activity that changes the `MagDataMode` for us ( +since `MagDataRate` is a derived resource, we shouldn't have to touch it) and changes the overall SSR `recording_rate` to +reflect the magnetometer's data rate change. This activity, which we'll call `change_mag_mode`, only needs one parameter +of type `MagDataCollectionMode` to allow the user to request a change to the mode. Let's give that parameter a default +value of `LOW_RATE`. + +In the effect model for this activity (which we'll call `run()` by convention), we can use the `set()` method in +the `DiscreteEffects` class to change the `MagDataMode` to the value provided by our mode parameter. The computation of +the change to the `recording_rate` caused by the mode change is a little tricky because we need to know both the value of +the `MagDataRate` before and after the mode change. Once we know those value, we can subtract the old value from the new +value to get the net increase to the `recording_rate`. If the new value happens to be less than the old value, our answer +will be negative, but that should be ok as long as we use the `increase()` method when effecting the `recording_rate` +resource. + +We can get the current value of a resource with a static method called `currentValue()` available in the `Resources` +class. For our case here, we want to get the current value of the `MagDataRate` **before** we actually change the mode +to the requested value, so we have to be a little careful about the order of operations within our effect model. The +resulting activity type and its effect model should look something like this: + +```java +@Model.ActivityType() +async def change_mag_mode(model, mode: MagDataCollectionMode = MagDataCollectionMode.LOW_RATE): + current_rate = model.data_model.MagDataRate.get() + new_rate = mode.get_data_rate() + // Divide by 10^3 for kbps->Mbps conversion + model.data_model.recording_rate += (new_rate-current_rate)/1.0e3 + model.data_model.MagDataMode.set(mode) +``` + +Looking at our new activity definition, you can see how we use the `increase()` effect on `recording_rate` to "increase" +the data rate based on the net data change from the old rate. You may also notice a magic number where we do a unit +conversion from `kbps` to `Mbps`, which isn't ideal. Later on in this tutorial, we will introduce a "Unit Aware" +resource framework that will help a bit with conversions like these if desired. diff --git a/docs/_sources/1_tutorials/getting-started/5-second-look.md.txt b/docs/_sources/1_tutorials/getting-started/5-second-look.md.txt new file mode 100644 index 0000000..ac24266 --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/5-second-look.md.txt @@ -0,0 +1,27 @@ +# Second Look + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +With our second activity and corresponding resources built, let's compile the model again and upload it into Aerie (if +you forget how to do this, refer to the [Model Test Drive Page](2-model-test-drive) for simple instructions and +references). Build a new plan off of the model you just uploaded, name your plan `Mission Plan 2`, and give it a +duration of `1 day`. When you open this plan, you will see your two activity types appear in the left panel, which you +can drag and drop onto the plan. Add two `change_mag_mode` activities and change the parameter of the first one +to `HIGH_RATE`. Add a `collect_data` activity in between the two `change_mag_mode` activities and then simulate. + +You should now see our three resources populate with values in the timeline below. You'll notice that now +the `recording_rate` resource starts at zero until the `MagDataMode` changes to `HIGH_RATE`, which pops up the rate +to `5 Mbps`. Then, the `collect_data` activity increases the rate by another `10` to `15 Mbps`, but immediately decreases +after the end of the activity. Finally, the `MagDataMode` changes to `LOW_RATE`, which takes the rate down to `0.5 Mbps` +until the end of the plan. + +At this point, you can take the opportunity to play around with +Aerie's [Timeline Editing](https://ammos.nasa.gov/aerie-docs/planning/timeline-editing/) capability to change the colors +of activities or lines or put multiple resources onto one row. Try putting the `MagDataMode` and `MagDataRate` on the +same row so you can easily see how the mode changes align with the rate changes and change the color of `MagDataRate` to +red. With these changes you should get something similar to the screenshot below + +![Tutorial Plan 2](assets/Tutorial_Plan_2.png) diff --git a/docs/_sources/1_tutorials/getting-started/6-integrating-rate.md.txt b/docs/_sources/1_tutorials/getting-started/6-integrating-rate.md.txt new file mode 100644 index 0000000..df4f515 --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/6-integrating-rate.md.txt @@ -0,0 +1,284 @@ +# Integrating Data Rate + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https:#nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Now is where the fun really begins! Although having the data rate in and out of our SSR is useful, we are often more +concerned with the total amount of volume we have in our SSR in order to make sure we don't over fill it and have +sufficient downlink opportunities to get all the data we collected back to Earth. In order to compute total volume, we +must figure out a way to integrate our `recording_rate`. It turns out there are many different methods in Aerie you can +choose to arrive at the total SSR volume, but each method has its own advantages and drawbacks. We will explore 4 +different options for integration with the final option, a derived `Polynomial` resource, being our recommended +approach. As we progress through the options, you'll learn about a few more features of the resource framework that you +can use for different use cases in your model including the use of `Reactions` and **daemon** tasks. + +## Method 1 - Increase volume within activity + +The simplest method for performing an "integration" of `recording_rate` is to compute the integral directly within the +effect model of the activities who change the `recording_rate`. Before we do this, let's make sure we have a data volume +resource in our `DataModel` class. For each method, we are going to build a different data volume resource so we can +eventually compare them in the Aerie UI. As this is our simplest method, let's call this resource `ssr_volume_simple` +and make it store volume in Gigabits (Gb). Since we are going to directly effect this resource in our activities, this +will need to be a `MutableResource`. The declaration looks just like `recording_rate` + +as does the definition, initialization, and registration in the constructor: + +```python +self.ssr_volume_simple = registrar.cell(0.0) +registrar.resource("ssr_volume_simple", self.ssr_volume_simple.get) +``` + +Taking a look at our `collect_data` activity, we can add the following line of code after the `await delay()` within its +body to compute the data volume resulting from the activity collecting data at a constant duration over the full +duration of the activity. + +```python +model.data_model.ssr_volume_simple += rate * duration.to_number_in(Duration.SECONDS) / 1000.0 +``` + +This line will increase `SRR_Volume_Simple` at the end of the activity by `rate` times `duration` divided by our magic +number to convert `Mb` to `Gb`. Note that the `duration` object has some helper functions like `to_number_in` to help you +convert the `duration` type to a `double` value. + +There are a few notable issues with this approach. The first issue is that when a plan is simulated, the data volume of +the SSR will only increase at the very end of the activity even though in reality, the volume is growing linearly in +time throughout the duration of the activity. If your planners only need this level of fidelity to do their work, this +may be ok. However, if your planners need a little more fidelity during the time span of the activity, you could spread +out the data volume accumulation over many steps. That would look something like this in code, + +```python +num_steps = 20 +step_size = duration / num_steps +for i in range(num_steps): + await delay(step_size) +model.data_model.ssr_volume_simple += this.rate * step_size.to_number_in(SECONDS) / 1000.0 + +``` + +which would replace the `delay()` and the single data volume increase line from above. The resulting timeline +for `ssr_volume_simple` would look like a stair step with the number of steps equal to `num_steps`. It's important to +remember we are still using a `Discrete` resource, so the resource is stored as a constant, "step-function" profile in +Aerie. We will show the use of a `Polynomial` resource in our final method to truly store and view data volume as a +linear profile. + +Another issue with this approach is that iy does not transfer well to activities like `change_mag_mode` that alter +the `recording_rate` and do not return the rate back to its original value at the end of the activity (i.e. activities +whose effects on rate are not contained within the time span of the activity). In order to compute the magnetometer's +contribution to the data volume in `change_mag_mode`, we would need to multiply the `current_rate` by the duration since +the last mode change, or if no mode change has occurred, the beginning of the plan. While this is possible by using +a `Clock` resource to track time between mode changes, the `change_mag_mode` activity would now requires additional +context about the plan that would otherwise be unnecessary. + +A third issue to note is that the computation of `recording_rate` and `ssr_volume_simple` are completely separate, and +both of them live within the activity effect model. In reality, these quantities are very much related and should be +tied together in some way. The relationship between rate and volume is activity independent, and thus it makes more +sense to define that relationship in our `DataModel` class instead of the activity itself. + +Given these issues, we will hold off on implementing this approach for `change_mag_mode` and move forward to trying out +our next approach. + +## Method 2 - Sample-based volume update + +Another method to integration we can take is a numerical approach where we compute data volume by sampling the value of +the `recording_rate` at a fixed interval across the entire plan. In order to implement this method, we can `spawn()` a +simple task from our top-level `Mission` class that runs in the background while the plan is being simulated, which is +completely independent of activities in the plan. Such tasks are known as `daemon` tasks, and your mission model can +have an arbitrary number of them. + +Before we create this task, let's add another discrete `MutableResource` of type `double` called `ssr_volume_sampled` to +the `DataModel` class. Just as with other resources we have made, the declaration will look like + +and the definition, initialization, and registration in the constructor will be + +```python +self.ssr_volume_sampled = registrar.cell(0.0) +registrar.resource("ssr_volume_sampled", self.ssr_volume_sampled.get) +``` + +In addition to the resource, let's add another member variable to specify the sampling interval we'd like for our +integration. Choosing `60` seconds will result in the follow variable definition + +```python +INTEGRATION_SAMPLE_INTERVAL = Duration.of(60, Duration.SECONDS) +``` + +Staying in the `DataModel` class, we can can create a member function called `integrate_sampled_ssr` that has no +parameters, which we will spawn from the `Mission` class shortly. For the sake of simplicity, we will define this +function to take the "right" Reimann Sum (a "rectangle" rule approximation) of the `recording_rate` over time. The +implementation of this function looks like this: + +```python +async def integrate_sampled_ssr(): + while (True): + await delay(INTEGRATION_SAMPLE_INTERVAL) + current_recording_rate = currentValue(recording_rate) + ssr_volume_sampled += ( + current_recording_rate + * INTEGRATION_SAMPLE_INTERVAL.to_number_in(Duration.SECONDS) + / 1000.0) # Mbit -> Gbit +``` + +As a programmer, you may be surprised to see an infinite `while` loop, but Aerie will shut down this task, effectively +breaking the loop, once the simulation reaches the end of the plan. Within the loop, the first thing we do is `delay()` +by our sampling interval and then retrieve the current value of `recording_rate`. Finally, we sum up our rectangle by +multiplying the current rate by the sampling interval. We could have easily chosen to use other numerical methods like +the "trapezoid" rule by storing the previous recording rate in addition to the current rate, but what we did is +sufficient for now. + +The final piece we need to build into our model to get this method to work is a simple `spawn` with the `Mission` class +to our `integrate_sampled_ssr` method. + +```python +spawn(self.data_model::integrate_sampled_ssr) +``` + +The issues with this approach to integration are probably fairly apparent to you. First of all, this approach is truly +an approximation, so the resulting volume may not be the actual volume if the sampled points don't align perfectly with +the changes in `recording_rate`. Secondly, the fact we are sampling at a fixed time interval means we could be computing +many more time points than we actually need if the recording rate isn't changing between time points. If you were to try +to scale up this approach, you might run into performance issues with your model where simulation takes much longer than +it needs to. + +Despite these issues `daemon` tasks are a very effective tool in a modelers tool belt for describing "background" +behavior of your system. Examples for a spacecraft model could include the computation of geometry, battery degradation +over time, environmental effects, etc. + +## Method 3 - Update volume upon change to rate + +If you are looking for an efficient, yet accurate way to compute data volume from `recording_rate`, one method you could +take is to set up trigger that calls a function whenever `recording_rate` changes and then computes volume by +multiplying +the rate just before the latest change by the duration that has passed since the last change. Fortunately, there is a +fairly easy way to do this in Aerie's modeling framework. + +Let's begin by creating one more discrete `MutableResource` called `ssr_volume_upon_rate_change` in our `DataModel` +class (refer back to previous instances in this tutorial for how to declare and define one of these). In addition to our +volume resource, we are also going to need a `Clock` resource to help us track the time between changes +to `recording_rate`. Since this resource is more of a "helper" resource and doesn't need to be exposed to our planners, +we'll make it `private` and not register it to the UI. Declaring and defining a `Clock` resource is not much different +than declaring a `Discrete` except you don't have to specify a primitive type. The declaration looks like this + +and the definition in the constructor looks like this + +```python +self.time_since_last_rate_change = registrar.cell(Duration.ZERO, behavior=Clock.behavior) +``` + +This will start a "stopwatch" right at the start of the plan so we can track the time between the start of the plan and +the first time `recording_rate` is changed. We'll also need one more member variable of type `Double`, which we'll +call `previous_rate` to keep track of the previous value of `recording_rate` for us. + +```java +previous_recording_rate = 0.0 +``` + +Our next step is to build our trigger to react when there is a change to `recording_rate`. We can do this by leveraging +the `wheneverUpdates()` static method available within the framework's `Reactions` class + +```java +Reactions.wheneverUpdates(recording_rate, this::upon_recording_rate_update) +``` + +:::note + +The `Reactions` class has a couple more static methods that a modeler may find useful. The `every()` method allows you +to specify a duration to call a recurring action (we could have used this instead of our `spawn()` for the sampled +integration method). The `whenever()` method allows you to specify a `Condition`, which when met, would trigger an +action of your choosing. An example of a condition could be when a resource reaches a certain threshold. + +::: + +As you can see, this method takes a resource as its first argument and some `Runnable`, like a function call, as it's +second argument. We have specified that the function `upon_recording_rate_update` be called, so now we have to implement +that function within our `DataModel` class. The implementation of that function is below, which we will walk through +line by line. + +```python +upon_recording_rate_update(): +# Determine time elapsed since last update +t = time_since_last_rate_change.get() +# Update volume only if time has actually elapsed +if !t.isZero(): + ssr_volume_upon_rate_change += previous_recording_rate * t.to_number_in(Duration.SECONDS) / 1000.0) # Mbit -> Gbit + + previous_recording_rate = recording_rate.get() + # Restart clock (set back to zero) + ClockEffects.restart(time_since_last_rate_change) + +``` + +When the `recording_rate` resource changes, the first thing we do is determine how much time has passed since it last +changed (or since the beginning of the plan). If no time has passed, we don't want to re-integrate and double count +volume, but if time has passed, we do our simple integration by multiplying the previous rate by the elapsed time since +the value of rate changed. We then store the new value of rate as the previous rate and restart our stopwatch to we get +the right time next time the rate changes. + +And that's it! Now, every time `recording_rate` changes, the SSR volume will update to the correct volume. However, the +volume is still a discrete resource, so volume will only change as a step function at time points where the rate +changes. Nonetheless, since `recording_rate` is piece-wise constant, you'll get the right answer for volume with no +error +at those time points. + +## Method 4 - Derived volume from polynomial resource + +We have finally arrived at the final method we'll go through for integrating `recording_rate`, and in some ways, this +one +is the most straightforward. We will define our data volume as polynomial resource, `ssr_volume_polynomial`, which we +can build by using an `integrate()` static method provided by the `PolynomialResources` class. As a polynomial resource, +we will actually see the volume increase linearly over time as opposed to in discrete chunks. +Since `ssr_volume_polynomial` will be derived directly from `recording_rate`, we can make this a `Resource` as opposed +to +a `MutableResource`. The declaration of our new resource looks like this + +while the definition and registration in the constructor of our `DataModel` class look like this + +```java +self.ssr_volume_polynomial = scale( + PolynomialResources.integrate(as_polynomial(this.recording_rate), 0.0), 1e-3) # Gbit +registrar.resource("ssr_volume_polynomial", ssr_volume_polynomial.approx_linear) +``` + +Breaking down the definition, we see the `integrate()` function takes the resource to integrate as the first argument, +but that argument requires the resource to be polynomial as well. Fortunately, there is a function +in the `PolynomialResources` module called `as_polynomial()` that can convert discrete resources like `recording_rate` +to +polynomial ones. The second argument is the initial value for the resource, which we have been assuming is `0.0` for +data volume. The `integrate()` function is then wrapped by `scale()`, another handy static method +in `PolynomialResources` to convert our resource from `Megabit` to `Gigabit`. + +The resource registration is also slightly different than what we have seen thus far as we are using a `real()` method +as opposed to `discrete()` and we have to wrap our resource with yet another static helper method +in `PolynomialResources` called `assumeLinear()`. The reason we have to do this is that the UI currently does not have +support for `Polynomial` resources and can only render timelines as linear or constant segments. In our +case, `ssr_volume_polynomial` is actually linear anyway, so we are not "degrading" our resource by having to make this +down conversion. + +Now in reality, our on-board `SSR` is going to have a max capacity, and if data is removed from the `SSR`, we want to +make sure our model stops decreasing the `SSR` volume once it reaches `0.0`. By good fortune, the Aerie framework +includes another static method in `PolynomialResources` called `clampedIntegral()` that allows you to build a resource +that takes care of all that messy logic to make sure you are adhering to your min/max limits. + +If we wanted to build a "clamped" version of `ssr_volume_polynomial`, it would look something like this + +```python +clamped_integrate = PolynomialResources.clamped_integrate(scale( + as_polynomial(this.recording_rate), 1e-3), + PolynomialResources.constant(0.0), + PolynomialResources.constant(250.0), + 0.0) +ssr_volume_polynomial = clamped_integrate.integral() +``` + +The second and third arguments of `clamped_integrate()` are the min and max bounds for the integral and the final +argument is the starting value for the resource as it was in `integrate()`. The `clamped_integrate()` method actually +returns a `record` of three resources: + +- integral – The clamped integral value (i.e. the main resource of interest) +- overflow – The rate of overflow when the integral hits its upper bound. You can integrate this to get cumulative + overflow. +- underflow – The rate of underflow when the integral hits its lower bound. You can integrate this to get cumulative + underflow. + +As expected, the `integral()` resource is mapped to `ssr_volume_polynomial` to complete its definition. diff --git a/docs/_sources/1_tutorials/getting-started/7-integration-comparision.md.txt b/docs/_sources/1_tutorials/getting-started/7-integration-comparision.md.txt new file mode 100644 index 0000000..f4b5acf --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/7-integration-comparision.md.txt @@ -0,0 +1,51 @@ +# Integral Method Comparison + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +Now that we have explored multiple methods to implement integration in Aerie, let's compare all of the methods in the +Aerie UI. To make things more interesting, use the 2nd approach to the `Polynomial` method so we can see how that +approach enforces a data volume capacity. Compile the current version of the model (`./gradlew assemble`) and upload it +into Aerie. Build a new `1 day` plan off of that model and call it "Mission Plan 3". + +For this plan, throw a couple of `collect_data` activities near the beginning of the plan, create a `change_mag_mode` +activity after those activities in the first half of the plan and set that activity's parameter to `HIGH_RATE`. Throw +one more `collect_data` and `change_mag_mode` activity near the end of the plan to make sure we get a plan that goes over +our data capacity threshold. With our simple plan built, go ahead and simulate the plan to see the resulting resource +profiles. + +The easiest way to compare our four integration methods is to use +Aerie's [Timeline Editing](https://ammos.nasa.gov/aerie-docs/planning/timeline-editing/) capability to build a row that +includes all four of our data volume resources: + +- `ssr_volume_simple` +- `ssr_volume_sampled` +- `ssr_volume_upon_rate_change` +- `ssr_volume_polynomial` + +If you do that, you'll get a timeline view that looks something like the screenshot below + +![Tutorial Plan 3](assets/Tutorial_Plan_3.png) + +Looking at `ssr_volume_simple`, you'll see that data volume increases at the end of each `collect_data` activity, and for +the first two activities, the result at the end of the activity is consistent with the other volumes. You may recall +that we did not implement a data volume integration for the `change_mag_mode` activity for `ssr_volume_simple` (although +we could have with some work), so as soon as one of those activities is introduced into our plan, our volume is no +longer valid. + +`ssr_volume_sampled` has a nice looking profile when zoomed out at the expense of computing many points, which you can +see if you zoom into a shorter time span. If you zoom far enough, you can see the stair-step associated with computation +of each sampled point. If we were to change our sampling interval to something larger, we would lose some accuracy in +our volume calculation if the activity start/end times aren't aligned with are sample points. + +`ssr_volume_upon_rate_change` has much fewer points, but you can see that it produces the same volume as +our `ssr_volume_polynomial` resource at the time points it computes until we go above our maximum +capacity. `ssr_volume_polynomial` has same computed points as `ssr_volume_upon_rate_change`, but has linear profile +segments in between points. It also has an additional point once it reaches the capacity threshold, and then it remains +at that threshold for the remainder of the plan (we don't have any downlinks or we would see the volume decrease). + +Hopefully looking at the various methods of integrating in Aerie has given you some insight into the modeling constructs +available to you. You can do a ton with what you have learned thus far, but next we'll go over some additional +capabilities you will likely find useful as you build models with Aerie. diff --git a/docs/_sources/1_tutorials/getting-started/8-simulation-config.md.txt b/docs/_sources/1_tutorials/getting-started/8-simulation-config.md.txt new file mode 100644 index 0000000..4bbb3b2 --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/8-simulation-config.md.txt @@ -0,0 +1,126 @@ +# Sim Configuration + +:::{warning} +This page is under construction. Please bear with us as we port +our [Java tutorial](https://nasa-ammos.github.io/aerie-docs/tutorials/mission-modeling/introduction/) to python. +::: + +There is often a need for certain aspects of a model to be exposed to the planner to provide flexibility to tweak and +configure the model prior to a simulation run. The Aerie modeling framework provides +a [simulation configuration](https://ammos.nasa.gov/aerie-docs/mission-modeling/configuration/) interface to satisfy +this need. In our SSR model, we will expose a couple variables that already exist in our code: the sample interval for +our `SSR_Volume_Sampled` resource and the SSR max capacity defined as part of the `ssr_volume_polynomial` resource +definition. We will also create a new model configuration for setting the initial state of the `MagDataMode`. + +Back when we initially grabbed the mission model template to give us a jumping off point for our model, you may recall +that the template provided a `Configuration` class, and that class is already passed into the top-level `Mission` class +as a parameter. Taking a look at the `Configuration` class (which is actually +a [java record](https://www.baeldung.com/java-record-vs-final-class)), you'll see there is already a static method there +called `defaultConfiguration()` that uses +the [`@Template` annotation](https://ammos.nasa.gov/aerie-docs/mission-modeling/parameters/#export-template). This type +of annotation assumes every variable within the parent class should be exposed as simulation configuration (or a +parameter if you use this within activities) with a default value. So, in our case, we will declare three member +variables and give them all default values that match the values we have for them in the `DataModel` class, which we +will soon replace with references to this configuration. + +```java +public static final Double SSR_MAX_CAPACITY = 250.0; + +public static final long INTEGRATION_SAMPLE_INTERVAL = 60; + +public static final MagDataCollectionMode STARTING_MAG_MODE = MagDataCollectionMode.OFF; +``` + +In order to hook up these member variables to our record, we need to add three constructor parameters and then update +the `defaultConfiguration()` method to pass in these default values to construct a record with default values. Once we +do this, we get a `Configuration` record that looks like this: + +```java +package missionmodel; + +import static gov.nasa.jpl.aerie.merlin.framework.annotations.Export.Template; + +public record Configuration(Double ssrMaxCapacity, + long integrationSampleInterval, + MagDataCollectionMode startingMagMode) { + + public static final Double SSR_MAX_CAPACITY = 250.0; + + public static final long INTEGRATION_SAMPLE_INTERVAL = 60; + + public static final MagDataCollectionMode STARTING_MAG_MODE = MagDataCollectionMode.OFF; + + public static @Template Configuration defaultConfiguration() { + return new Configuration(SSR_MAX_CAPACITY, + INTEGRATION_SAMPLE_INTERVAL, + STARTING_MAG_MODE); + } +} +``` + +Now, when Aerie loads in our model, the member variables above will be exposed as simulation configuration with defaults +set to the defaults defined in this record. However, at the moment, changing the values from their defaults won't +actually change the behavior of the simulation because our `DataModel` doesn't yet know about this configuration. Within +our top-level `Mission` class, we need to pass our configuration into `DataModel` via its constructor + +```java +this.dataModel = new DataModel(this.errorRegistrar, config); +``` + +and then update the `DataModel` class constructor to include `Configuration` as an argument: + +```java +public DataModel(Registrar registrar, Configuration config) { ... } +``` + +Now we must find references to our original, hard-coded values for our configuration and replace them with references to +our `config` object. + +Here is what this looks like for `ssrMaxCapacity` + +```java +var clampedIntegrate = PolynomialResources.clampedIntegrate( scale( + asPolynomial(this.recording_rate), 1e-3), + PolynomialResources.constant(0.0), + PolynomialResources.constant(config.ssrMaxCapacity()), + 0.0); +``` + +and `integrationSampleInterval` + +```java +INTEGRATION_SAMPLE_INTERVAL = Duration.duration(config.integrationSampleInterval(), Duration.SECONDS); +``` + +Note that for the sample interval, we had to move from a hardcoded definition as part of the variable declaration and +move the definition to the constructor, which you could put on the line following the registration of +the `SSR_Volume_Sampled` resource. + +Our final configuration parameter, `startingMagMode`, is not quite as straightforward as the other two because in +addition to ensuring that the initial value of `MagDataMode` is set correctly, we need to make sure that the +initial `recording_rate` also takes into account the `MagDataRate` associated with the initial `MagDataMode`. We can +achieve this by switching around the order of construction so that the `recording_rate` is defined after the mag mode and +rate. We also need to make sure the `previousrecording_rate` used to compute our `ssr_volume_upon_rate_change` resource is +set to the initial value of `recording_rate`. The resulting code will look like this + +```java +self.MagDataMode = registrar.cell(discrete(config.startingMagMode())); +registrar.discrete("MagDataMode",self.MagDataMode, new EnumValueMapper<>(MagDataCollectionMode.class)); + +self.MagDataRate = map(MagDataMode, MagDataCollectionMode::get_data_rate); +registrar.discrete("MagDataRate", self.MagDataRate, new DoubleValueMapper()); + +recording_rate = registrar.cell(discrete(currentValue(MagDataRate)/1e3)); +registrar.discrete("recording_rate", recording_rate, new DoubleValueMapper()); +previousrecording_rate = currentValue(recording_rate); +``` + +Now you should be ready to try this out in the Aerie UI. Go ahead and compile your model with simulation configuration +and upload it to Aerie. Build whatever plan you'd like and then before you simulate, in the left panel view, select " +Simulation" in the dropdown menu. You should now see your three configuration variables appear under "Arguments" + +![Simulation Config](assets/Simulation_Config.png) + +Aerie is smart enough to look at the types of the configuration variables and generate a input field in the UI that best +matches that type. So, for example, the `startingMagMode` is a simple drop down menu with the only options available +being members of the `MagDataCollectionMode` enumeration. diff --git a/docs/_sources/1_tutorials/getting-started/index.md.txt b/docs/_sources/1_tutorials/getting-started/index.md.txt new file mode 100644 index 0000000..7bcaf43 --- /dev/null +++ b/docs/_sources/1_tutorials/getting-started/index.md.txt @@ -0,0 +1,15 @@ +# Intro Tutorial: Solid State Recorder + +In this tutorial, you'll start from scratch and write a data model to track the rate and volume of a +spacecraft's solid state recorder. This is the recommended first tutorial for new users of pymerlin! + +```{toctree} +1-gettingstarted +2-model-test-drive +3-enum-derived-resource +4-current-value +5-second-look +6-integrating-rate +7-integration-comparision +8-simulation-config +``` diff --git a/docs/_sources/2_guides/index.md.txt b/docs/_sources/2_guides/index.md.txt index 6e23688..d655658 100644 --- a/docs/_sources/2_guides/index.md.txt +++ b/docs/_sources/2_guides/index.md.txt @@ -2,6 +2,7 @@ This section contains targeted how-to guides for things you might want to do with pymerlin. ```{toctree} +organization jupyter datamodel powermodel diff --git a/docs/_sources/2_guides/organization.md.txt b/docs/_sources/2_guides/organization.md.txt new file mode 100644 index 0000000..6af8599 --- /dev/null +++ b/docs/_sources/2_guides/organization.md.txt @@ -0,0 +1,12 @@ +# How to organize your project + +The intro tutorial has you build your whole mission model and activities in one file. As you write more and more lines +of code for your model, this may become intractable. This guide is intended to describe some considerations when +choosing how to break up your project. + +## File-by-subsystem +The most natural way to divide a mission model is by subsystem. One way to achieve this is to.. + +:::{warning} +But how do we avoid a circular import here? +::: \ No newline at end of file diff --git a/docs/_sources/apidocs/pymerlin/pymerlin.model_actions.rst.txt b/docs/_sources/apidocs/pymerlin/pymerlin.model_actions.rst.txt index dc82197..b40c5ad 100644 --- a/docs/_sources/apidocs/pymerlin/pymerlin.model_actions.rst.txt +++ b/docs/_sources/apidocs/pymerlin/pymerlin.model_actions.rst.txt @@ -48,13 +48,13 @@ API .. autodoc2-docstring:: pymerlin.model_actions.delay :parser: myst -.. py:function:: spawn(child) +.. py:function:: spawn(model, child) :canonical: pymerlin.model_actions.spawn .. autodoc2-docstring:: pymerlin.model_actions.spawn :parser: myst -.. py:function:: call(child) +.. py:function:: call(model, child) :canonical: pymerlin.model_actions.call :async: diff --git a/docs/_sources/glossary.md.txt b/docs/_sources/glossary.md.txt new file mode 100644 index 0000000..bb850cc --- /dev/null +++ b/docs/_sources/glossary.md.txt @@ -0,0 +1,15 @@ +# Glossary + +:::{glossary} +Aerie + A suite of planning and scheduling, modeling and simulation, constraint checking and sequencing tools. +Merlin + The modeling and simulation component of Aerie. +Effect Model + The body of the function describing an activity's behavior during simulation. +Validation + A predicate on the arguments to an activity. Violation of a predicate does not preclude execution of the activity, but + rather serves as a warning. +::: + +[//]: # (You can use {term}`MyST` to create glossaries.) \ No newline at end of file diff --git a/docs/_sources/quickstart.md.txt b/docs/_sources/quickstart.md.txt index 8d9b5e2..4b22040 100644 --- a/docs/_sources/quickstart.md.txt +++ b/docs/_sources/quickstart.md.txt @@ -23,4 +23,4 @@ Check that the installation succeeded by running: python3 -c "import pymerlin; pymerlin.checkout()" ``` -If you see `pymerlin checkout successful: All systems GO 🚀`, you're ready to get started with the [tutorial](1_tutorials/1-gettingstarted). \ No newline at end of file +If you see `pymerlin checkout successful: All systems GO 🚀`, you're ready to get started with the [tutorial](1_tutorials/getting-started/index.md). \ No newline at end of file diff --git a/docs/apidocs/index.html b/docs/apidocs/index.html index b801602..19a843a 100644 --- a/docs/apidocs/index.html +++ b/docs/apidocs/index.html @@ -229,6 +229,7 @@
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
    • User Guides
        +
      • How to organize your project
      • How to use pymerlin in Jupyter
      • Modeling Data Volume
      • Modeling Power
      • diff --git a/docs/searchindex.js b/docs/searchindex.js index 6a4b902..38ba4a5 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles": {"API": [[28, "api"], [29, "api"], [30, "api"]], "API Reference": [[27, "api-reference"]], "Activity Planning": [[22, "activity-planning"]], "Approachability over performance": [[31, "approachability-over-performance"]], "Architecture": [[31, "architecture"]], "Assumed Aerospace knowledge": [[35, "assumed-aerospace-knowledge"]], "Assumed programming knowledge": [[35, "assumed-programming-knowledge"]], "Async/await vs threads": [[31, "async-await-vs-threads"]], "Avoiding Command Errors": [[22, "avoiding-command-errors"]], "Background": [[24, "background"]], "Build an Aerie-compatible JAR file": [[11, "build-an-aerie-compatible-jar-file"]], "Building pymerlin": [[33, "building-pymerlin"]], "Building pymerlin.jar": [[34, "building-pymerlin-jar"]], "But what about Aerie idioms?": [[31, "but-what-about-aerie-idioms"]], "Classes": [[29, "classes"]], "Co-Simulation": [[21, "co-simulation"]], "Command Errors": [[22, "command-errors"]], "Common Errors": [[32, "common-errors"]], "Contributing": [[33, "contributing"]], "Creating a Mission Model": [[0, "creating-a-mission-model"]], "Data": [[28, "data"], [29, "data"]], "Developing pymerlin": [[34, "developing-pymerlin"]], "Discrete Event Simulation": [[26, "discrete-event-simulation"]], "Documentation": [[35, "documentation"]], "Enumerated and Derived Resources": [[2, "enumerated-and-derived-resources"]], "File-by-subsystem": [[16, "file-by-subsystem"]], "Functions": [[28, "functions"], [30, "functions"]], "Further Reading": [[21, "further-reading"]], "Getting Started": [[0, "getting-started"]], "Glossary": [[35, "glossary"], [36, "glossary"]], "Going further": [[10, "going-further"]], "Good Commit, PR, and Code Review Practices": [[33, "good-commit-pr-and-code-review-practices"]], "Got a Question or Problem?": [[33, "got-a-question-or-problem"]], "How do you guarantee the safety of an autonomous spacecraft?": [[22, "how-do-you-guarantee-the-safety-of-an-autonomous-spacecraft"]], "How to get help, contribute, or provide feedback": [[37, "how-to-get-help-contribute-or-provide-feedback"]], "How to organize your project": [[16, "how-to-organize-your-project"]], "How to use pymerlin in Jupyter": [[14, "how-to-use-pymerlin-in-jupyter"]], "ImportError - circular import": [[32, "importerror-circular-import"]], "Installation": [[40, "installation"]], "Installing pymerlin": [[0, "installing-pymerlin"]], "Integral Method Comparison": [[6, "integral-method-comparison"]], "Integrated vs Partial validation": [[22, "integrated-vs-partial-validation"]], "Integrating Data Rate": [[5, "integrating-data-rate"]], "Intro Tutorial: Solid State Recorder": [[8, "intro-tutorial-solid-state-recorder"]], "License": [[38, "license"]], "Making changes to command files": [[22, "making-changes-to-command-files"]], "Method 1 - Increase volume within activity": [[5, "method-1-increase-volume-within-activity"]], "Method 2 - Sample-based volume update": [[5, "method-2-sample-based-volume-update"]], "Method 3 - Update volume upon change to rate": [[5, "method-3-update-volume-upon-change-to-rate"]], "Method 4 - Derived volume from polynomial resource": [[5, "method-4-derived-volume-from-polynomial-resource"]], "Methods of Validation": [[22, "methods-of-validation"]], "Model Test Drive": [[1, "model-test-drive"]], "Modeling Data Volume": [[12, "modeling-data-volume"]], "Modeling Power": [[17, "modeling-power"]], "Modeling Telecom": [[20, "modeling-telecom"]], "Module Contents": [[29, "module-contents"], [30, "module-contents"]], "Monte-Carlo analyses": [[15, "monte-carlo-analyses"]], "Package Contents": [[28, "package-contents"]], "Planning and Scheduling": [[25, "planning-and-scheduling"]], "Publishing to pypi": [[39, "publishing-to-pypi"]], "Pull Request Guidelines": [[33, "pull-request-guidelines"]], "Quickstart": [[40, "quickstart"]], "Re-usable command files": [[22, "re-usable-command-files"]], "Referencing Aerie": [[35, "referencing-aerie"]], "Round trips": [[31, "round-trips"]], "Scheduling": [[18, "scheduling"]], "Second Look": [[4, "second-look"]], "Sim Configuration": [[7, "sim-configuration"]], "Source code": [[37, "source-code"]], "Stack traces": [[32, "stack-traces"]], "Style": [[35, "style"]], "Submitting a Pull Request": [[33, "submitting-a-pull-request"]], "Submodules": [[28, "submodules"]], "Target Audience": [[35, "target-audience"]], "Testing": [[34, "testing"]], "The Theory": [[26, "the-theory"]], "Tuning Fidelity": [[23, "tuning-fidelity"]], "Tutorials": [[9, "tutorials"]], "Use pythonic idioms": [[31, "use-pythonic-idioms"]], "User Guides": [[13, "user-guides"]], "Using Current Value in an Effect Model": [[3, "using-current-value-in-an-effect-model"]], "Using spice for geometry": [[19, "using-spice-for-geometry"]], "Your First Activity": [[0, "your-first-activity"]], "Your First Resource": [[0, "your-first-resource"]], "pymerlin": [[28, "module-pymerlin"], [37, "pymerlin"]], "pymerlin.duration": [[29, "module-pymerlin.duration"]], "pymerlin.model_actions": [[30, "module-pymerlin.model_actions"]]}, "docnames": ["1_tutorials/getting-started/1-gettingstarted", "1_tutorials/getting-started/2-model-test-drive", "1_tutorials/getting-started/3-enum-derived-resource", "1_tutorials/getting-started/4-current-value", "1_tutorials/getting-started/5-second-look", "1_tutorials/getting-started/6-integrating-rate", "1_tutorials/getting-started/7-integration-comparision", "1_tutorials/getting-started/8-simulation-config", "1_tutorials/getting-started/index", "1_tutorials/index", "1_tutorials/tutorial2", "2_guides/build-jar", "2_guides/datamodel", "2_guides/index", "2_guides/jupyter", "2_guides/monte-carlo", "2_guides/organization", "2_guides/powermodel", "2_guides/scheduling", "2_guides/spice", "2_guides/telecom", "3_explanation/co-simulation", "3_explanation/command-errors", "3_explanation/fidelity", "3_explanation/index", "3_explanation/planning", "3_explanation/simulation", "apidocs/index", "apidocs/pymerlin/pymerlin", "apidocs/pymerlin/pymerlin.duration", "apidocs/pymerlin/pymerlin.model_actions", "architecture", "common-errors", "contribute", "developer", "documentation", "glossary", "index", "license", "publishing", "quickstart"], "envversion": {"sphinx": 61, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["1_tutorials/getting-started/1-gettingstarted.md", "1_tutorials/getting-started/2-model-test-drive.md", "1_tutorials/getting-started/3-enum-derived-resource.md", "1_tutorials/getting-started/4-current-value.md", "1_tutorials/getting-started/5-second-look.md", "1_tutorials/getting-started/6-integrating-rate.md", "1_tutorials/getting-started/7-integration-comparision.md", "1_tutorials/getting-started/8-simulation-config.md", "1_tutorials/getting-started/index.md", "1_tutorials/index.md", "1_tutorials/tutorial2.md", "2_guides/build-jar.md", "2_guides/datamodel.md", "2_guides/index.md", "2_guides/jupyter.md", "2_guides/monte-carlo.md", "2_guides/organization.md", "2_guides/powermodel.md", "2_guides/scheduling.md", "2_guides/spice.md", "2_guides/telecom.md", "3_explanation/co-simulation.md", "3_explanation/command-errors.md", "3_explanation/fidelity.md", "3_explanation/index.md", "3_explanation/planning.md", "3_explanation/simulation.md", "apidocs/index.rst", "apidocs/pymerlin/pymerlin.rst", "apidocs/pymerlin/pymerlin.duration.rst", "apidocs/pymerlin/pymerlin.model_actions.rst", "architecture.md", "common-errors.md", "contribute.md", "developer.md", "documentation.md", "glossary.md", "index.md", "license.md", "publishing.md", "quickstart.md"], "indexentries": {"__all__ (in module pymerlin)": [[28, "pymerlin.__all__", false]], "__eq__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__eq__", false]], "__ge__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__ge__", false]], "__gt__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__gt__", false]], "__le__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__le__", false]], "__lt__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__lt__", false]], "__repr__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__repr__", false]], "_yield_with() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions._yield_with", false]], "aerie": [[36, "term-Aerie", true]], "call() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.call", false]], "checkout() (in module pymerlin)": [[28, "pymerlin.checkout", false]], "delay() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.delay", false]], "duration (class in pymerlin.duration)": [[29, "pymerlin.duration.Duration", false]], "effect model": [[36, "term-Effect-Model", true]], "from_string() (pymerlin.duration.duration static method)": [[29, "pymerlin.duration.Duration.from_string", false]], "hour (in module pymerlin.duration)": [[29, "pymerlin.duration.HOUR", false]], "hours (in module pymerlin.duration)": [[29, "pymerlin.duration.HOURS", false]], "merlin": [[36, "term-Merlin", true]], "microsecond (in module pymerlin.duration)": [[29, "pymerlin.duration.MICROSECOND", false]], "microseconds (in module pymerlin.duration)": [[29, "pymerlin.duration.MICROSECONDS", false]], "millisecond (in module pymerlin.duration)": [[29, "pymerlin.duration.MILLISECOND", false]], "milliseconds (in module pymerlin.duration)": [[29, "pymerlin.duration.MILLISECONDS", false]], "minute (in module pymerlin.duration)": [[29, "pymerlin.duration.MINUTE", false]], "minutes (in module pymerlin.duration)": [[29, "pymerlin.duration.MINUTES", false]], "module": [[28, "module-pymerlin", false], [29, "module-pymerlin.duration", false], [30, "module-pymerlin.model_actions", false]], "negate() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.negate", false]], "of() (pymerlin.duration.duration static method)": [[29, "pymerlin.duration.Duration.of", false]], "plus() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.plus", false]], "pymerlin": [[28, "module-pymerlin", false]], "pymerlin.duration": [[29, "module-pymerlin.duration", false]], "pymerlin.model_actions": [[30, "module-pymerlin.model_actions", false]], "second (in module pymerlin.duration)": [[29, "pymerlin.duration.SECOND", false]], "seconds (in module pymerlin.duration)": [[29, "pymerlin.duration.SECONDS", false]], "spawn() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.spawn", false]], "times() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.times", false]], "to_number_in() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.to_number_in", false]], "validation": [[36, "term-Validation", true]], "wait_until() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.wait_until", false]], "zero (in module pymerlin.duration)": [[29, "pymerlin.duration.ZERO", false]]}, "objects": {"": [[28, 0, 0, "-", "pymerlin"]], "pymerlin": [[28, 1, 1, "", "__all__"], [28, 2, 1, "", "checkout"], [29, 0, 0, "-", "duration"], [30, 0, 0, "-", "model_actions"]], "pymerlin.duration": [[29, 3, 1, "", "Duration"], [29, 1, 1, "", "HOUR"], [29, 1, 1, "", "HOURS"], [29, 1, 1, "", "MICROSECOND"], [29, 1, 1, "", "MICROSECONDS"], [29, 1, 1, "", "MILLISECOND"], [29, 1, 1, "", "MILLISECONDS"], [29, 1, 1, "", "MINUTE"], [29, 1, 1, "", "MINUTES"], [29, 1, 1, "", "SECOND"], [29, 1, 1, "", "SECONDS"], [29, 1, 1, "", "ZERO"]], "pymerlin.duration.Duration": [[29, 4, 1, "", "__eq__"], [29, 4, 1, "", "__ge__"], [29, 4, 1, "", "__gt__"], [29, 4, 1, "", "__le__"], [29, 4, 1, "", "__lt__"], [29, 4, 1, "", "__repr__"], [29, 4, 1, "", "from_string"], [29, 4, 1, "", "negate"], [29, 4, 1, "", "of"], [29, 4, 1, "", "plus"], [29, 4, 1, "", "times"], [29, 4, 1, "", "to_number_in"]], "pymerlin.model_actions": [[30, 2, 1, "", "_yield_with"], [30, 2, 1, "", "call"], [30, 2, 1, "", "delay"], [30, 2, 1, "", "spawn"], [30, 2, 1, "", "wait_until"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "data", "Python data"], "2": ["py", "function", "Python function"], "3": ["py", "class", "Python class"], "4": ["py", "method", "Python method"]}, "objtypes": {"0": "py:module", "1": "py:data", "2": "py:function", "3": "py:class", "4": "py:method"}, "terms": {"": [0, 2, 3, 4, 5, 6, 8, 15, 19, 22, 23, 29, 31, 33, 35, 36], "0": [0, 1, 2, 4, 5, 7, 29], "00": [0, 29, 30], "000": 29, "000000": 29, "01": [0, 30], "01pre": 26, "03": 26, "0e3": 3, "1": [0, 1, 3, 4, 6, 8, 9, 29], "10": [0, 1, 3, 4], "100": [0, 1], "1000": 5, "11": 40, "15": 4, "170215": 26, "1e": [5, 7], "1e3": 7, "2": [1, 4, 8, 9, 20, 22, 29], "20": [1, 5], "2017": 26, "2018": 26, "2021": 38, "21": [34, 40], "24": 29, "250": [5, 7], "2ab": 20, "2nd": 6, "3": [3, 6, 7, 8, 9, 26, 34, 40], "30": 29, "3120": 40, "3rd": 26, "4": [8, 9], "5": [4, 29], "500": 2, "5000": 2, "60": [5, 7], "600": 29, "63": 29, "7": 29, "8601": 29, "9": 34, "A": [2, 5, 18, 22, 26, 29, 30, 36, 38], "AND": 38, "AS": 38, "And": 5, "As": [0, 2, 5, 16, 22, 29, 31, 33, 34, 35], "At": [1, 4, 33], "BE": 38, "BUT": 38, "Be": 33, "But": [0, 11, 16], "By": 5, "FOR": 38, "For": [0, 2, 3, 5, 6, 22, 29, 31, 33, 34], "IN": 38, "If": [0, 3, 5, 6, 22, 29, 33, 40], "In": [0, 2, 3, 5, 7, 8, 22, 26, 29, 33, 35], "It": [0, 5, 6, 15, 21, 22, 23, 31, 35], "NO": 38, "NOT": 38, "No": 33, "Not": 22, "OF": 38, "OR": 38, "On": 1, "One": [16, 22], "Such": 5, "THE": 38, "TO": 38, "That": [5, 22], "The": [0, 1, 2, 3, 5, 6, 7, 16, 19, 20, 22, 24, 29, 31, 32, 33, 35, 36, 38], "Then": [0, 4], "There": [5, 7, 21, 22, 23, 26, 35], "These": [0, 1, 22, 31, 33], "To": [6, 22, 26, 29, 31, 33, 37], "WITH": 38, "With": [0, 2, 4, 6], "__all__": 28, "__eq__": 29, "__ge__": 29, "__gt__": 29, "__init__": 0, "__le__": 29, "__lt__": 29, "__repr__": 29, "_decor": 0, "_global": 31, "_intern": [0, 34], "_yield_with": 30, "abil": [22, 23, 33], "abl": [2, 20, 21, 22, 26], "about": [0, 1, 3, 5, 7, 22, 24, 32, 33, 37], "abov": [0, 1, 5, 6, 7, 22, 33, 38], "absenc": [22, 26], "absolut": 22, "abstract": 22, "accept": 33, "access": 37, "accomplish": [0, 2, 22], "account": 7, "accumul": 5, "accur": 5, "accuraci": [6, 29], "achiev": [0, 7, 16, 22], "across": [5, 22, 23, 35], "act": 26, "action": [0, 5, 22, 26, 30, 31, 38], "activ": [1, 3, 4, 6, 7, 8, 9, 16, 23, 24, 31, 32, 36, 40], "activitytyp": [0, 3], "actual": [0, 1, 3, 5, 7, 22, 33], "ad": [0, 1, 2, 22, 33], "add": [0, 1, 2, 4, 5, 7, 26, 33], "addit": [0, 2, 5, 6, 7, 23, 26, 31, 34], "address": 22, "adher": [5, 22], "adoptium": 40, "advanc": 26, "advantag": 5, "advers": 22, "advic": 32, "aeri": [0, 1, 4, 5, 6, 7, 13, 23, 26, 33, 36, 37], "affect": 22, "after": [0, 1, 2, 3, 4, 5, 6, 7, 22, 33, 40], "again": [4, 26], "against": [22, 29], "ahead": [6, 7], "aid": 33, "aim": 31, "align": [4, 5, 6], "all": [0, 5, 6, 7, 22, 26, 31, 33, 34, 38, 40], "alloc": [20, 22, 26], "allow": [0, 1, 2, 3, 5, 22, 26, 31, 33], "almost": 29, "alon": 1, "along": [0, 2], "alreadi": [0, 7, 35], "also": [0, 1, 2, 3, 5, 6, 7, 22, 23], "alter": [0, 5], "altern": 31, "although": [0, 5, 6], "altogeth": 29, "alwai": [29, 33, 35], "ammo": 26, "amount": 5, "an": [0, 2, 5, 6, 7, 8, 9, 13, 20, 24, 26, 29, 32, 33, 35, 36, 38], "an9804": 20, "analys": 13, "analysi": 22, "analyz": 31, "ani": [0, 6, 20, 22, 26, 29, 33, 35, 38], "annot": [0, 7, 31], "anoth": [2, 4, 5, 22, 26, 32], "answer": [3, 5], "anticip": 22, "anywai": 5, "apach": 32, "apart": 0, "api": [31, 32, 39], "appar": 5, "appear": [0, 1, 4, 7, 33], "appli": [1, 22, 26], "approach": [5, 6], "appropri": [31, 35], "approv": [22, 33], "approx_linear": 5, "approxim": [5, 23, 29], "ar": [0, 1, 2, 5, 6, 21, 22, 23, 26, 29, 30, 31, 33, 34, 35, 40], "arbitrari": [5, 26], "arbitrarili": 26, "aren": [6, 22], "argument": [0, 1, 5, 7, 22, 31, 36], "aris": [15, 21, 22, 38], "arithmet": 29, "around": [4, 7, 29, 32], "arriv": 5, "as_polynomi": 5, "aspect": [7, 35], "aspir": 34, "aspolynomi": 7, "assembl": [1, 6, 34], "assess": 22, "assign": 29, "associ": [0, 2, 6, 7, 38], "assum": [5, 7, 22], "assumelinear": 5, "astronom": 29, "async": [0, 3, 5, 30, 35], "attain": 35, "attent": [22, 33], "attribut": [26, 31], "author": [22, 38], "autodoc2": 35, "autom": [22, 34], "automat": [22, 23, 33, 35], "autonom": 24, "autonomi": 22, "avail": [0, 2, 3, 5, 6, 7, 20], "avoid": [16, 24, 26], "await": [0, 5, 30, 35], "awar": [0, 3, 22], "b": [18, 20, 33], "back": [0, 1, 5, 7], "background": [5, 35], "bandwidth": 20, "bar": 1, "base": [0, 1, 2, 3, 8, 9, 29], "basi": 29, "basic": [0, 35], "batteri": [5, 22], "bear": [0, 1, 2, 3, 4, 5, 6, 7], "becam": 22, "becaus": [0, 3, 7, 29], "becom": [2, 16, 29, 33], "been": [0, 1, 5, 20, 22, 31, 33], "befor": [0, 3, 5, 7, 22, 26, 33], "begin": [0, 1, 5, 6], "behavior": [0, 5, 7, 15, 22, 23, 36], "being": [0, 5, 7, 29], "below": [1, 4, 5, 6], "belt": 5, "benefit": 31, "best": [7, 22, 23, 35], "better": [22, 33], "between": [0, 4, 5, 6, 20, 22, 23, 26, 29, 31, 33], "beyond": 0, "bind": 19, "bisect": 33, "bit": [3, 35], "block": [0, 35], "board": [0, 2, 5, 22], "bodi": [0, 5, 20, 29, 36], "bonu": 0, "book": 0, "boolean": 0, "borrow": [26, 32], "both": [0, 3, 5, 22, 26, 32, 35], "bottom": 35, "bound": [5, 22], "bracket": 33, "branch": 33, "break": [5, 16], "bridg": 31, "brief": [0, 35], "budget": 20, "buffer": 0, "build": [0, 1, 3, 4, 5, 6, 7, 13, 16, 31, 39], "built": [0, 1, 2, 4, 6, 35, 37], "bulletproof": 22, "burden": 22, "busi": 20, "button": [1, 33], "c": [38, 40], "cach": 31, "calcul": [6, 19], "calendar": 29, "calendr": 29, "california": 38, "call": [0, 1, 2, 3, 5, 6, 7, 22, 23, 26, 29, 30, 31], "camera": [0, 2], "can": [0, 1, 2, 3, 4, 5, 6, 7, 22, 23, 24, 26, 27, 29, 30, 31, 32, 33, 34, 35, 37], "cannot": [0, 1, 22, 32], "capabl": [4, 6, 22], "capac": [5, 6, 7], "capital_snake_cas": 31, "cardin": 22, "care": [3, 5, 31], "carlo": [13, 23], "carol": 22, "carri": 22, "case": [0, 2, 3, 5, 7, 22, 29, 31], "catch": 23, "categori": [0, 22], "caus": [3, 22], "causal": 29, "caution": 22, "ccsd": 0, "cd": [34, 35], "celesti": 29, "cell": [0, 2, 5, 7, 26], "center": 1, "certain": [5, 7, 22, 26, 30, 31], "cfdp": 22, "challeng": 21, "chang": [0, 1, 3, 4, 6, 7, 8, 9, 24, 26, 33], "change_mag_mod": [3, 4, 5, 6], "channel": 33, "character": 31, "characterist": 22, "charg": 38, "chat": 33, "check": [1, 22, 28, 33, 36, 37, 40], "checkmark": 1, "checkout": [28, 33, 40], "child": [26, 30], "china": 29, "choic": [26, 29], "choos": [5, 16, 22], "chosen": 5, "chunk": 5, "circular": 16, "cite": 22, "claim": [29, 38], "clamp": 5, "clamped_integr": 5, "clampedintegr": [5, 7], "class": [0, 2, 3, 5, 7, 27, 31], "clean": [33, 35], "cleanup": 31, "clear": [22, 33], "click": 1, "clock": [0, 5, 29], "clockeffect": 5, "clone": 33, "close": [22, 33], "co": 24, "code": [0, 2, 5, 7, 16, 29, 31, 35], "collect": [0, 2, 5], "collect_data": [0, 1, 4, 5, 6], "collinear": 29, "color": 4, "com": [20, 26, 35, 37], "combin": [22, 29, 33], "come": [0, 21, 22, 23], "command": [23, 24, 33, 39, 40], "comment": [33, 35], "commit": 35, "common": 0, "commun": [20, 22, 23, 31], "compani": 35, "compar": [5, 6, 22], "comparison": [8, 9], "compat": [13, 31], "compil": [1, 4, 6, 7], "complac": 22, "complet": [0, 5, 22], "complex": 1, "complic": [29, 33], "compon": [22, 36], "compos": 23, "comput": [0, 3, 5, 6, 7, 22, 26], "concept": [23, 26, 29, 35], "concern": 5, "concurr": [22, 26], "condit": [5, 22, 26, 30, 38], "config": 7, "configur": [8, 9, 23, 29], "conflict": [22, 26, 33], "connect": 38, "consensu": 22, "consequ": 22, "consid": 31, "consider": 16, "consist": [6, 35], "constant": [0, 5, 7, 31], "constel": 22, "constitu": 22, "constrain": 22, "constraint": [22, 36], "construct": [0, 1, 2, 3, 4, 5, 6, 7, 29], "constructor": [0, 2, 5, 7], "consult": 31, "consum": 0, "contain": [5, 13, 22, 35], "content": [0, 22, 26], "context": [5, 31, 35], "continu": [0, 2, 26, 33], "contract": 38, "contrast": 0, "contribut": [5, 35], "contributor": 33, "control": 22, "conveni": 32, "convent": [3, 33], "convers": [0, 3, 5], "convert": [5, 29, 31], "coordin": 22, "copi": [33, 38], "copyright": 38, "coro": 30, "coroutin": 31, "correct": [5, 22], "correctli": [0, 7, 22], "correspond": [2, 4, 22], "cost": 22, "could": [0, 1, 2, 5, 6, 7, 22, 31], "count": 5, "counter": 0, "coupl": [0, 2, 5, 6, 7, 29], "cours": 0, "cover": [0, 29], "creat": [1, 2, 5, 6, 7, 8, 9, 29, 33], "cross": 31, "cumul": 5, "current": [0, 2, 5, 6, 8, 9, 26, 29, 33, 34], "current_r": [3, 5], "current_recording_r": 5, "currentvalu": [3, 5, 7], "custom": 29, "cycl": 23, "d": [0, 5, 7, 26, 33], "daemon": 5, "dai": [1, 4, 6, 23, 29], "damag": 38, "danger": 22, "data": [0, 2, 3, 6, 8, 9, 13, 22, 27], "data_model": [0, 3, 5], "datamodel": [0, 2, 5, 7], "date": [29, 35], "de": 29, "deadlin": 22, "deal": [29, 33, 38], "debug": 32, "decid": 22, "decis": 22, "declar": [0, 2, 5, 7, 22], "decor": 0, "decreas": [0, 4, 5, 6], "def": [0, 3, 5], "default": [0, 1, 3, 7], "defaultconfigur": 7, "defer": 29, "defin": [0, 2, 5, 7, 22, 29, 31, 32, 34], "definit": [0, 2, 3, 5, 7, 22, 29], "degrad": 5, "degre": 35, "delai": [0, 5, 22, 30], "deleg": 0, "delet": [22, 33], "delimit": 29, "deliv": 22, "depend": [0, 20, 22, 23, 26, 29, 35], "deploy": [0, 35], "depth": 22, "deriv": [0, 3, 8, 9, 29], "describ": [0, 5, 16, 22, 26, 32, 33, 36, 40], "descript": [22, 33], "deserv": 35, "design": [0, 21, 22, 33], "desir": [3, 22, 23], "despit": 5, "detail": [0, 1, 23, 27, 35], "detect": 22, "determin": [5, 20], "develop": [32, 33, 35], "deviat": 22, "did": [5, 6, 22], "differ": [0, 2, 5, 20, 22, 23, 29], "difficult": [22, 31], "direct": 1, "directli": [0, 2, 5, 22, 29, 31], "directori": [34, 35], "discoveri": 20, "discret": [0, 2, 5, 7, 24, 29, 37], "discreteeffect": [0, 3], "discreteresourc": 2, "discreteresourcemonad": 2, "discuss": 33, "disposit": 22, "dist": 39, "distanc": [20, 29], "distinct": 29, "distinguish": [0, 29], "distribut": [26, 38], "divid": [2, 3, 5, 16], "do": [0, 1, 2, 3, 4, 5, 6, 7, 13, 16, 24, 28, 31, 32, 38], "doc": [26, 32, 34, 35, 37], "docstr": [31, 35], "document": [0, 33, 38], "doe": [0, 5, 22, 33, 36], "doesn": [5, 7], "domain": 29, "don": [0, 1, 2, 5, 6, 22, 33], "done": [0, 22, 29, 31], "doubl": [0, 2, 5, 7, 31], "doublevaluemapp": 7, "down": [4, 5, 7], "downlink": [5, 6], "download": 40, "draft": 22, "drag": [1, 4], "drawback": 5, "drive": [4, 8, 9], "driver": 31, "drop": [1, 4, 7, 29], "dropdown": 7, "duck": 31, "due": [0, 32], "duplic": [26, 33], "durat": [0, 1, 4, 5, 7, 22, 27, 28, 30], "duration_str": 29, "dure": [5, 22, 23, 36], "duti": 23, "dynam": [22, 26], "e": [0, 1, 5, 22, 29, 31], "each": [0, 5, 6, 32, 33], "earli": 22, "earlier": 1, "earth": [5, 22, 29], "easi": [5, 22], "easier": 33, "easiest": [0, 6], "easili": [4, 5], "ecosystem": 37, "edit": [1, 4, 6, 33], "effect": [0, 1, 2, 5, 8, 9, 22, 33, 36], "effici": 5, "effort": 33, "either": [22, 33], "elaps": 5, "element": 29, "elsewher": 31, "emit": [0, 2, 26], "en": 26, "enabl": [22, 26, 31], "encount": 32, "end": [0, 4, 5, 6], "endpoint": 33, "enforc": 6, "engin": [23, 31], "enhanc": 26, "enough": [6, 7, 22, 23], "ensur": [0, 7, 29, 33], "enter": 22, "entir": 5, "entri": 31, "enum": 2, "enumer": [0, 7, 8, 9, 22, 31], "enumvaluemapp": 7, "envelop": 22, "environ": [22, 34, 40], "environment": [5, 22], "epagomen": 29, "ephemerid": 29, "equal": 5, "err": 22, "error": [0, 5, 23, 24], "errorregistrar": 7, "esoter": 35, "especi": 2, "essenti": 0, "estim": 29, "etc": [0, 1, 2, 5], "evalu": 26, "even": [5, 22, 26, 29, 33], "event": [0, 22, 24, 29, 37, 38], "eventu": [0, 5], "everi": [5, 7, 22, 26, 33], "evid": 29, "evolut": 26, "evolv": 0, "exact": 29, "exampl": [0, 2, 5, 7, 22, 29, 30], "except": [2, 5, 29], "execut": [0, 22, 36], "exhaust": 22, "exist": [0, 7, 21, 22, 26, 29, 31, 39], "expect": [0, 5, 22, 31, 35], "expens": 6, "explain": 35, "explicit": 31, "explicitli": 0, "explor": [5, 6], "export": 7, "expos": [0, 5, 7, 31], "express": [26, 38], "extend": 0, "extens": 35, "extent": 31, "extern": 23, "f": [26, 33], "face": 35, "fact": [5, 22], "factori": 29, "fail": [0, 22], "failur": 22, "fairli": 5, "fall": [22, 33], "fals": [22, 30], "familiar": [22, 35], "famous": 22, "far": [5, 6, 22, 29], "fashion": 22, "fast": 22, "fault": 22, "fdir": 22, "feasibl": 22, "featur": [5, 33, 35], "few": [0, 5, 22, 33], "fewer": [6, 22], "fidel": [5, 24], "field": [2, 7, 29], "figur": 5, "file": [0, 1, 13, 24, 32, 33, 38, 39], "fill": [0, 5], "final": [0, 4, 5, 7], "find": [0, 5, 6, 7, 27], "fine": 22, "first": [1, 2, 4, 5, 6, 8, 9, 22, 26, 34, 40], "fit": 38, "fix": [0, 5, 22, 29, 33], "flexibl": 7, "flight": 22, "float": 29, "focu": [22, 35], "focus": [0, 22], "follow": [0, 1, 2, 5, 7, 22, 26, 33, 35, 38, 40], "forc": 33, "forget": [4, 26], "form": [0, 22], "formul": 26, "fortun": 5, "forward": [0, 5, 26], "found": 22, "four": 6, "framework": [0, 3, 5, 7, 37], "free": [22, 38], "free_replicated_data_typ": 26, "frequent": 29, "from": [0, 2, 3, 7, 8, 9, 15, 22, 26, 29, 32, 33, 38, 39], "from_str": [0, 29], "front": 33, "fsw": 22, "full": [0, 5], "fulli": 0, "fun": 5, "function": [0, 2, 5, 26, 27, 29, 31, 35, 36], "fundament": [0, 29], "furnish": 38, "furo": 35, "further": [9, 22, 24, 26, 29, 35], "futur": [26, 34], "g": [0, 1, 22, 29], "gain": 15, "gb": 5, "gbit": 5, "gener": [0, 7, 23, 26, 31, 33, 35], "geometri": [5, 13], "get": [2, 3, 4, 5, 6, 7, 8, 9, 21, 35, 40], "get_data_r": [2, 3, 7], "getter": 2, "gigabit": 5, "gil": 31, "git": [33, 35], "github": [26, 33, 37], "give": [0, 1, 2, 3, 4, 7, 22, 29, 31, 33], "given": [0, 5, 6, 26, 29], "global": 31, "go": [0, 1, 2, 5, 6, 7, 9, 22, 35, 40], "goe": 6, "gold": 29, "gone": 22, "good": [5, 29], "googl": 35, "gov": 7, "grab": 7, "gradlew": [1, 6, 34], "grain": 22, "grant": 38, "granular": 0, "great": [21, 29, 35], "greatest": 22, "green": [0, 1], "gregorian": 29, "ground": 22, "grow": 5, "guarante": [24, 26], "guardrail": 22, "guid": [0, 16, 35, 37], "guidanc": 35, "guidelin": 37, "ha": [0, 1, 5, 6, 16, 20, 22, 29, 31, 33], "had": [7, 22], "half": 6, "handi": 5, "handl": 31, "happen": 3, "hard": 7, "hardcod": 7, "hardwar": 22, "have": [0, 1, 2, 3, 5, 6, 7, 22, 23, 26, 31, 32, 33, 35, 40], "haven": [0, 1], "healthi": 22, "heater": 22, "held": 29, "help": [3, 5, 31, 33], "helper": [0, 5], "here": [0, 3, 7, 16, 22, 24, 27, 29, 32, 33, 35], "herebi": 38, "hierarch": [0, 33], "high": [2, 22], "high_rat": [2, 4, 6], "higher": 34, "histori": [1, 26, 33], "hit": 5, "hold": [5, 22], "holder": 38, "hook": 7, "hopefulli": 6, "horizon": 23, "host": 26, "hour": [0, 1, 29], "hover": 1, "how": [0, 1, 3, 4, 5, 6, 13, 23, 24, 33, 35, 40], "howev": [5, 7, 22, 29], "html": [20, 32, 35], "http": [20, 26, 32, 35, 37, 40], "human": 22, "hybrid": [26, 31], "hybrid_system": 26, "i": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 33, 35, 37, 38], "icon": 1, "id": [1, 31], "idea": [31, 33], "ideal": 3, "ident": 22, "identifi": 22, "ii": [5, 21], "imag": 0, "imagin": [0, 2], "imbu": 22, "immedi": 4, "impact": 22, "imper": 22, "implement": [0, 5, 6, 21, 22, 26, 31], "impli": [22, 38], "implicitli": 0, "import": [0, 2, 5, 7, 16, 22, 31, 35, 40], "importantli": 22, "imposs": 22, "incapacit": 22, "includ": [0, 5, 6, 7, 22, 29, 31, 33, 35, 38, 39], "incorrect": 22, "increas": [0, 3, 4, 6, 8, 9, 22], "increment": 29, "indefinit": 22, "independ": [5, 22, 26], "index": 35, "indic": 22, "individu": [22, 23], "infinit": 5, "info": 33, "inform": [1, 22, 33], "inherit": 31, "init": 31, "initi": [0, 1, 2, 5, 7, 26, 29, 32], "input": [7, 15, 22, 31], "insight": [6, 15], "insignific": 31, "inspect": 22, "instal": [8, 9, 28, 34], "instanc": [0, 1, 5], "instant": 29, "instantan": 0, "instanti": 0, "instead": [1, 2, 5, 21, 29], "institut": 38, "instruct": [1, 4, 33, 35], "instrument": [0, 2, 31], "integ": [0, 29], "integr": [0, 8, 9, 23, 24, 31, 33], "integrate_sampled_ssr": 5, "integration_sample_interv": [5, 7], "integrationsampleinterv": 7, "intend": [0, 2, 16, 22], "intens": 22, "intent": 22, "intention": 29, "interact": [22, 33], "intercalari": 29, "interest": [0, 2, 5, 6, 22], "interestingli": 0, "interfac": [7, 26, 33], "interleav": 0, "intern": 29, "interpret": [22, 31], "interspers": 22, "interv": [5, 6, 7], "intract": 16, "intro": [9, 16], "introduc": [0, 3, 6, 22, 26], "invalid": [0, 22], "invok": 29, "involv": 22, "io": 26, "isn": [3, 5, 11], "iso": 29, "isol": 22, "issu": [0, 5, 33], "iszero": 5, "its": [0, 2, 3, 5, 7, 15, 22, 23, 26, 31], "itself": [0, 5, 22], "jar": [1, 13, 31], "java": [0, 1, 2, 3, 4, 5, 6, 7, 29, 31, 34, 35, 40], "jdk": 34, "jpl": [7, 19], "jre": 40, "jump": 7, "jupyt": 13, "just": [0, 1, 4, 5, 29], "justifi": 22, "k": 31, "kbp": [2, 3], "keep": [0, 5, 22, 26, 35], "kei": [20, 22, 39], "kept": 31, "kernel": 29, "keyword": [0, 30, 35], "kind": [22, 38], "know": [0, 3, 7, 22, 35], "known": [5, 29], "komputasi": 26, "label": 30, "lack": 22, "lambda": [0, 2], "languag": 22, "larg": [22, 23], "larger": [6, 31], "largest": 29, "last": [0, 5], "later": [0, 3], "latest": [5, 32, 33], "latitud": 29, "lead": 22, "leak": 31, "learn": [0, 5, 6, 24, 37], "least": 33, "leav": 1, "left": [1, 4, 7, 33], "less": [3, 22, 29, 35], "let": [0, 1, 2, 3, 4, 5, 6, 35], "level": [0, 5, 7, 22], "leverag": [5, 21, 31], "liabil": 38, "liabl": 38, "lib": [1, 34], "librari": [34, 35], "lightweight": 22, "like": [0, 2, 3, 5, 6, 7, 22, 26, 29, 32, 33, 35], "limit": [0, 5, 20, 22, 38], "line": [0, 2, 4, 5, 7, 16, 33], "linear": [0, 5, 6, 33], "linearli": 5, "link": [0, 20, 29, 35], "list": [2, 26], "littl": [3, 5, 35], "live": [5, 35], "ll": [0, 1, 2, 3, 4, 5, 6, 7, 8, 34], "load": 7, "local": 33, "locat": 34, "lock": 31, "log": 0, "logic": [0, 5], "long": [3, 7, 22, 29, 31], "longer": [5, 6], "longest": 22, "look": [0, 1, 2, 3, 5, 6, 7, 8, 9, 29, 31], "loop": [5, 31], "lose": 6, "loss": 22, "lost": [22, 33], "lot": 35, "love": 33, "low": [2, 22], "low_rat": [2, 3, 4], "lower": [5, 22], "lowercas": 35, "lowercasenospac": 31, "lunar": 29, "m": 39, "machin": 40, "made": [0, 5, 33], "mag": [7, 20], "magdatacollectionmod": [2, 3, 7], "magdatamod": [2, 3, 4, 7], "magdatar": [2, 3, 4, 7], "magic": [3, 5], "magnetomet": [2, 3, 5], "mai": [3, 5, 6, 7, 15, 16, 22, 23, 29, 31, 32, 35], "main": [5, 31, 32], "maintain": 0, "major": 22, "make": [0, 1, 5, 6, 7, 24, 31, 32, 33, 35, 39, 40], "manag": [23, 26, 31], "maneuv": 22, "mani": [0, 5, 6, 15, 21, 22, 23], "map": [2, 5, 7, 29], "mark": 22, "martian": 29, "match": [0, 1, 7, 22], "mathwork": 20, "matt": 22, "mattdaili": 37, "max": [5, 7], "maxim": 22, "maximum": [6, 29], "mayb": [22, 35], "mb": 5, "mbit": 5, "mbp": [0, 3, 4], "mean": [5, 22, 26, 30, 31, 32, 35], "meaning": 0, "measur": [0, 29], "mechan": 22, "media": 20, "megabit": [0, 5], "member": [0, 5, 7], "memori": 31, "mental": 22, "mention": 22, "menu": [1, 7], "merchant": 38, "mere": [23, 31, 33], "merg": [33, 38], "merlin": [7, 26, 29, 31, 36], "messag": [0, 1, 22, 33], "messi": 5, "met": [5, 33], "method": [0, 2, 3, 7, 8, 9, 24, 29, 31], "micro": 29, "microsecond": 29, "might": [5, 13, 32], "millisecond": 29, "min": 5, "mind": [0, 22, 35], "minim": [22, 26], "minut": 29, "mirror": 22, "miss": 22, "mission": [1, 2, 4, 5, 6, 7, 8, 9, 16, 21, 22, 23, 26, 31, 32], "missionmodel": [0, 1, 7], "mit": 38, "mitig": 22, "mode": [2, 3, 4, 5, 7, 22], "model": [2, 4, 5, 6, 7, 8, 9, 13, 16, 21, 22, 23, 26, 31, 32, 36], "model_act": [0, 27, 28], "modifi": [0, 1, 38], "modul": [5, 28, 31, 32], "moment": 7, "mont": [13, 23], "month": 29, "moon": 29, "more": [0, 1, 5, 6, 16, 22, 23, 24, 26, 31, 33, 35, 37], "most": [0, 5, 16, 22, 32], "move": [0, 1, 5, 7, 26], "msl": 22, "much": [2, 5, 6, 23], "multipl": [4, 6, 22, 29, 34], "multipli": [2, 5, 29], "must": [0, 5, 7, 22, 30, 33], "muszynski": 22, "mutabl": 26, "mutableresourc": [0, 2, 5], "mv": 34, "mvsteen": 26, "my": 33, "myst": 35, "mystmd": 35, "naif": 19, "name": [0, 1, 4, 22, 32], "nasa": [7, 19, 26], "natur": 16, "neatli": 33, "necessari": 29, "necessarili": 23, "need": [0, 2, 3, 5, 7, 22, 23, 29, 31, 32, 34, 35], "needless": 26, "neg": 3, "negat": 29, "net": [3, 40], "new": [0, 1, 2, 3, 4, 5, 6, 7, 8, 22, 33], "new_rat": 3, "newest": 22, "newli": 1, "next": [0, 1, 5, 6], "nice": [6, 21], "nomin": 22, "none": [28, 29], "nonetheless": 5, "noninfring": 38, "notabl": 5, "note": [1, 5, 7, 22, 29, 33], "notic": [0, 3, 4, 38], "notifi": 0, "notion": [23, 26, 29], "now": [0, 1, 2, 3, 4, 5, 6, 7, 22, 31], "num_step": 5, "number": [1, 2, 3, 5, 22, 29], "numer": [2, 5, 22], "object": [0, 5, 7, 31], "observ": [22, 23], "obstruct": 20, "obtain": 38, "occult": 20, "occur": [0, 5, 26, 32], "off": [1, 2, 4, 5, 6, 7, 22, 23], "often": [0, 5, 7, 22, 29], "ok": [0, 3, 5], "old": [3, 22], "onboard": 22, "onc": [0, 1, 3, 5, 6, 7, 22, 26, 33, 40], "one": [0, 1, 2, 3, 4, 5, 6, 16, 22, 29, 31, 32, 33], "ones": [5, 22], "onli": [0, 3, 5, 7, 29, 31, 34], "onto": [1, 2, 4, 33], "open": [1, 4, 33, 35], "oper": [0, 2, 3, 20, 22, 23, 26, 29, 31], "opportun": [0, 4, 5, 22], "oppos": 5, "optim": 22, "option": [5, 7, 33], "orbit": [19, 29], "order": [3, 5, 7, 22, 26, 29], "ordin": 29, "org": [26, 32, 35, 40], "origin": [5, 7, 22, 31, 33], "other": [0, 2, 5, 6, 7, 20, 22, 29, 32, 38], "otherwis": [5, 38], "our": [0, 1, 2, 3, 4, 5, 6, 7, 33, 37], "out": [0, 5, 6, 7, 33, 35, 37, 38], "outcom": 22, "output": 31, "outsid": 29, "outstand": 33, "over": [0, 1, 2, 5, 6, 33], "overal": 3, "overflow": 5, "overhead": 31, "overrid": 31, "overview": 0, "overwrit": 35, "own": [0, 5, 29], "packag": [0, 7, 27, 29, 34], "packet": 22, "padawan": 0, "page": [0, 1, 2, 3, 4, 5, 6, 7, 11, 35], "pai": 33, "pair": 22, "palat": 22, "panel": [1, 4, 7, 22], "paradigm": [22, 31], "parallel": 26, "param": [29, 30], "paramet": [0, 1, 3, 4, 5, 6, 7, 22, 23, 29], "paraphras": 26, "parent": [7, 26], "parenthesi": 0, "pars": 35, "part": [7, 22], "partial": [24, 32], "particular": [22, 29, 38], "particularli": 35, "partit": 26, "pass": [0, 5, 7, 22, 31, 33], "passag": 29, "patch": 33, "path": [20, 31], "paus": [0, 31], "pdf": [20, 26], "peopl": 35, "pep8": 31, "per": 0, "perceiv": 22, "perfectli": 5, "perform": [0, 1, 5, 20, 22, 23, 26, 29], "perhap": [2, 22, 31], "period": [0, 29], "perman": 22, "permiss": 38, "permit": 38, "persist": 22, "person": 38, "persu": 35, "perturb": 15, "perus": 0, "peski": 0, "phase": 23, "phenomena": 26, "pick": 1, "piec": [5, 22], "piecewis": 0, "pip": [34, 40], "place": [0, 2, 22], "plai": [1, 4, 20, 21, 23], "plan": [0, 1, 4, 5, 6, 7, 23, 24, 36], "planner": [5, 7], "pleas": [0, 1, 2, 3, 4, 5, 6, 7, 33], "plu": 29, "plugin": 35, "point": [0, 1, 4, 5, 6, 7, 20, 22, 29, 31, 35], "polanskei": 22, "polynomi": [0, 6, 8, 9], "polynomialresourc": [5, 7], "pop": [1, 4], "popul": [1, 4, 11], "popular": 19, "port": [0, 1, 2, 3, 4, 5, 6, 7, 31], "portion": 38, "pose": 31, "posit": 22, "possibl": [0, 5, 22, 31, 33], "power": [13, 22], "powerless": 22, "practic": [22, 32, 35], "pre": 0, "precis": [22, 23, 29], "preclud": 36, "predic": 36, "predict": [0, 22], "prefer": [31, 33], "prefix": [26, 31], "preliminari": 26, "presenc": 29, "present": [0, 33], "preserv": 29, "prevent": 0, "previou": [5, 22, 33], "previous_r": 5, "previous_recording_r": 5, "previousrecording_r": 7, "primari": 0, "primarili": 0, "primit": [0, 5], "prior": [0, 7, 32], "privat": [5, 31], "probabl": 5, "problem": 29, "process": [0, 21, 22, 23, 31], "produc": 6, "profil": [0, 1, 5, 6, 22], "programm": 5, "progress": [0, 5], "project": [33, 40], "promot": 22, "properti": [0, 20, 22, 26, 29, 31], "protect": 22, "prototyp": 31, "prove": 22, "proven": 22, "provid": [0, 1, 3, 5, 7, 19, 22, 23, 27, 29, 30, 31, 35, 38], "prudent": 22, "ptolemi": 21, "public": [7, 31], "publish": [34, 38], "pull": 0, "purpos": [20, 22, 38], "push": 33, "put": [1, 4, 7, 22, 26], "py": [0, 31, 32], "py4j": 31, "pymerlin": [8, 9, 13, 21, 23, 27, 31, 35, 40], "pypirc": 39, "pyspark": [31, 32], "pytest": 34, "python": [0, 1, 2, 3, 4, 5, 6, 7, 19, 32, 34, 35, 40], "python3": [39, 40], "qualiti": 26, "quantiti": [0, 5, 29], "queri": [26, 33], "quickli": [22, 23], "quickstart": [0, 37], "quit": 7, "rang": [0, 5, 22, 29], "rapid": 31, "rare": 22, "rate": [0, 1, 2, 3, 4, 7, 8, 9], "rather": [2, 31, 36], "re": [5, 21, 24, 29, 31, 33, 40], "reach": [0, 5, 6, 33], "react": 5, "reaction": 5, "read": [0, 24, 26, 33, 35, 37], "readabl": 33, "readi": [7, 33, 37, 40], "real": [5, 33], "realiti": 5, "realli": 5, "reason": [5, 22, 33], "rebas": 33, "recal": [6, 7, 22], "receiv": [20, 22], "recent": 22, "recharg": 22, "recogn": 0, "recommend": [5, 8, 22, 32], "record": [0, 5, 7, 9, 22], "recording_r": [0, 1, 2, 3, 4, 5, 7], "recoveri": 22, "rectangl": 5, "recur": 5, "red": 4, "reduc": 22, "refer": [4, 5, 7, 29, 32, 35], "referenc": [22, 29], "reflect": 3, "regard": 26, "regist": [0, 2, 5], "registr": [2, 5, 7], "registrar": [0, 2, 5, 7], "regular": [29, 35], "reimann": 5, "reject": 22, "rel": 23, "relat": [5, 33], "relationship": [0, 5], "releas": 40, "relev": 35, "reli": [29, 33], "reliabl": [22, 23], "remain": [2, 6], "remaind": 6, "rememb": 5, "remind": 0, "remov": [5, 31], "render": [0, 5], "renew": 0, "repeat": 35, "replac": [0, 5, 7], "repo": 33, "repositori": [33, 39], "repres": [0, 22, 29, 31, 35], "represent": [22, 29], "reproduc": 35, "request": 3, "requir": [5, 22, 23, 26, 31, 33], "resembl": 22, "resolut": 29, "resourc": [1, 3, 4, 6, 7, 8, 9, 22, 26, 31, 33], "respect": [2, 22], "respons": 22, "rest": 31, "restart": 5, "restor": 0, "restrict": [0, 22, 31, 33, 38], "result": [0, 1, 2, 3, 5, 6, 7, 22, 29], "resum": [0, 31], "retriev": 5, "retrospect": 29, "return": [5, 7, 29, 30, 31], "reusabl": 22, "revers": 0, "review": 22, "rf": 39, "right": [0, 1, 5, 38], "risk": 22, "rm": [33, 39], "role": 20, "root": 39, "rough": 29, "row": [1, 4, 6], "rule": 5, "run": [0, 1, 3, 5, 7, 15, 22, 23, 26, 31, 32, 34, 35, 39, 40], "runnabl": 5, "safe": [22, 33], "safeti": 24, "sai": [0, 2], "said": 35, "sake": 5, "salient": 35, "same": [0, 4, 6, 22, 26, 29], "sampl": [6, 7, 8, 9], "satisfi": 7, "save": 0, "scalar": 29, "scale": [5, 7], "scenario": 35, "schedul": [0, 13, 23, 24, 26, 36], "scienc": 23, "scratch": 8, "screenshot": [1, 4, 6], "scrutini": 22, "search": 33, "second": [0, 1, 5, 7, 8, 9, 29], "secondli": 5, "section": [1, 13, 22, 32, 35, 40], "see": [0, 1, 2, 3, 4, 5, 6, 7, 22, 33, 37, 40], "seem": 32, "seemingli": 29, "seen": 5, "segment": [0, 5, 6], "select": 7, "self": [0, 2, 5, 7, 35], "sell": 38, "semant": [22, 26], "send": 33, "sens": [5, 22], "sent": 22, "separ": [5, 22, 26, 29, 32, 33], "sequenc": [22, 36], "serial": 26, "serializedvalu": 31, "serious": 31, "serv": 36, "set": [0, 3, 5, 6, 7, 22, 29], "sever": 23, "shall": 38, "share": 22, "short": [0, 23], "shorter": 6, "shortli": 5, "should": [0, 1, 2, 3, 4, 5, 7, 22, 26, 29, 31, 32, 33, 35], "shouldn": 3, "show": [0, 5], "shown": [0, 1], "shut": 5, "side": [22, 31, 33], "sider": 29, "sift": 22, "sign": 29, "signal": 22, "sim": [8, 9], "similar": [1, 4, 22, 29], "simluat": 21, "simpl": [0, 2, 4, 5, 6, 7, 31], "simplest": 5, "simpli": [0, 2, 29], "simplic": 5, "simul": [0, 1, 4, 5, 6, 7, 15, 22, 23, 24, 29, 31, 32, 35, 36, 37], "sinc": [0, 1, 2, 3, 5, 29], "singl": [0, 5, 22, 26, 31, 33], "site": 35, "situat": 22, "skeleton": 22, "skew": 22, "skip": 22, "sky": 29, "slack": 33, "slightli": 5, "small": [22, 23], "smaller": 22, "smart": 7, "snake_cas": 31, "snippet": 34, "so": [0, 3, 4, 5, 6, 7, 22, 31, 34, 35, 38], "socket": 31, "softwar": [0, 22, 38], "solar": [22, 29], "solid": [0, 9], "some": [0, 1, 2, 5, 6, 16, 20, 21, 22, 24, 26, 31, 32, 33, 35], "someon": 31, "someth": [0, 3, 4, 5, 6, 22], "sometim": [0, 15, 22, 23], "somewhat": 22, "soon": [0, 6, 7, 11], "sort": 22, "sound": 22, "sourc": 31, "spacecraft": [0, 5, 8, 24, 29], "spaceflight": 35, "span": [5, 6, 23, 29], "spark": [31, 32], "spawn": [5, 26, 30], "special": [0, 2], "specif": [0, 22, 29, 35], "specifi": [0, 5, 22], "spell": 35, "sphinx": 35, "spice": [13, 29], "spiceypi": 19, "spin": 0, "spread": 5, "squash": 33, "src": 35, "srr_volume_simpl": 5, "ssr": [0, 1, 3, 5, 7], "ssr_max_capac": 7, "ssr_volume_polynomi": [5, 6, 7], "ssr_volume_sampl": [5, 6, 7], "ssr_volume_simpl": [5, 6], "ssr_volume_upon_rate_chang": [5, 6, 7], "ssrmaxcapac": 7, "sss": 20, "stai": [0, 5, 22], "stair": [5, 6], "standard": 29, "star": 29, "start": [4, 5, 6, 8, 9, 31, 37, 40], "starting_mag_mod": 7, "startingmagmod": 7, "state": [0, 7, 9, 22, 26], "statement": 0, "static": [0, 2, 3, 5, 7, 29], "statu": 30, "step": [0, 5, 6, 22, 26], "step_siz": 5, "stick": 31, "still": [5, 22, 35], "stop": 5, "stopwatch": [0, 5], "store": [0, 5], "stori": 33, "straightforward": [5, 7, 22], "strategi": 33, "strength": 23, "strict": 23, "strictli": 0, "string": 0, "strive": 22, "structur": [0, 27], "stub": 1, "style": [0, 31], "subject": [22, 38], "sublicens": 38, "submiss": [33, 37], "submit": 22, "subprocess": 31, "substanti": 38, "subsystem": [22, 23], "subtract": 3, "succeed": 40, "success": [28, 40], "successfulli": 1, "suffici": [5, 23, 31], "suffix": 26, "suggest": 33, "suit": 36, "sum": [2, 5], "summari": 33, "sun": [22, 29], "supersed": 22, "support": [5, 11, 22], "sure": [1, 5, 6, 7, 22, 33, 39, 40], "surpris": 5, "surviv": 22, "swap": 22, "switch": 7, "sygyzi": 29, "symmetri": 29, "synod": 29, "syntact": 22, "syntax": 22, "system": [5, 15, 20, 21, 22, 23, 26, 29, 31, 40], "syzygi": 29, "t": [0, 1, 2, 3, 5, 6, 7, 11, 22, 26, 33], "take": [0, 1, 4, 5, 7, 22, 29, 30], "target": [13, 33], "task": [5, 26, 30, 31], "team": 22, "teas": 0, "technic": 35, "technologi": 38, "tele": 20, "telecom": 13, "telecommun": 20, "telemetri": 22, "tell": [0, 2, 33], "temperatur": 22, "templat": 7, "tempor": 29, "temurin": 40, "tenet": 31, "term": [29, 35], "termin": 40, "tertiari": 29, "test": [0, 4, 8, 9], "text": 35, "than": [2, 3, 5, 31, 33], "thei": [0, 1, 22, 30, 31, 33, 35], "them": [0, 5, 7, 20, 21, 22, 31, 32, 33], "theme": 35, "theori": 24, "therefor": [0, 22], "thi": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 22, 25, 26, 28, 29, 30, 31, 32, 33, 35, 38, 40], "thing": [0, 2, 5, 6, 13, 22, 28, 31, 35], "think": 0, "third": 5, "those": [0, 2, 3, 5, 6, 22, 35, 40], "though": [5, 22, 31, 33], "three": [2, 4, 5, 7], "threshold": [5, 6], "through": [0, 5, 22, 31, 33], "throughout": 5, "throw": 6, "thu": [5, 6], "ti": 5, "tightli": 22, "time": [0, 1, 2, 5, 6, 22, 23, 26, 29, 31, 33], "time_since_last_rate_chang": 5, "timelin": [0, 1, 4, 5, 6], "titlecas": 31, "to_number_in": [5, 29], "todai": [0, 33], "todo": [0, 26, 32], "togeth": [2, 5, 21, 22], "ton": 6, "tool": [5, 21, 23, 36], "toolkit": [19, 29], "top": [0, 1, 5, 7], "tort": 38, "total": [2, 5], "touch": 3, "toward": [20, 22, 35], "tox": 34, "track": [0, 2, 5, 8, 26], "tractabl": 22, "trade": 23, "tradition": [0, 26, 29], "train": 0, "trajectori": 22, "transact": 26, "transaction": 26, "transfer": 5, "transform": 0, "transmit": 22, "transmitt": 20, "trapezoid": 5, "trick": 1, "tricki": 3, "trigger": [5, 22], "trivial": 22, "true": [5, 22, 30], "truli": 5, "trust": 22, "try": [1, 4, 5, 7, 21, 22, 31], "tune": 24, "turn": [5, 22], "tutori": [0, 1, 2, 3, 4, 5, 6, 7, 10, 12, 14, 16, 17, 25, 34, 35, 40], "tweak": 7, "twine": [34, 39], "two": [0, 1, 4, 6, 7, 21, 22, 26, 29, 32, 33], "ty": 22, "type": [0, 1, 2, 3, 4, 5, 7, 22, 29, 31], "typic": [22, 23], "u": [0, 1, 2, 3, 4, 5, 6, 7], "ui": [0, 1, 2, 5, 6, 7], "ultim": 0, "uncertainti": 22, "uncondition": 22, "under": [0, 1, 2, 3, 4, 5, 6, 7, 22], "underflow": 5, "underli": 29, "underscor": 31, "understand": 22, "understood": 31, "undesir": 22, "unexpect": 22, "unfortun": 29, "unintent": 22, "uniqu": 0, "unit": [0, 3, 29], "unless": 26, "unlik": [0, 29], "unnecessari": 5, "unresolv": 33, "unsaf": 22, "unsurpris": 29, "until": [0, 4, 6, 22, 26, 31], "up": [0, 1, 2, 4, 5, 7, 16, 22, 31, 33, 35], "updat": [0, 7, 8, 9, 33], "upgrad": 22, "upload": [1, 4, 6, 7, 26, 31, 39], "upon": [8, 9], "upon_recording_rate_upd": 5, "upper": 5, "us": [0, 1, 2, 5, 6, 7, 8, 9, 13, 15, 22, 29, 32, 33, 34, 35, 37, 38], "usabl": 24, "user": [0, 3, 8, 33, 35], "usual": 22, "v": [24, 33], "valid": [0, 1, 6, 24, 36], "valu": [0, 1, 2, 4, 5, 7, 8, 9, 22, 26, 29], "var": 7, "variabl": [0, 5, 7, 26, 31, 35], "varianc": 15, "variat": [15, 23], "variou": [0, 6], "ve": 26, "vector": 22, "veri": [5, 22, 35], "verif": 22, "verifi": 22, "version": [0, 1, 5, 6, 22, 26, 33, 34], "via": [0, 7, 22, 31, 33], "viabl": 31, "view": [0, 1, 5, 6, 7, 22, 35], "violat": 36, "virtual": 40, "volum": [0, 6, 8, 9, 13], "voyag": 22, "wa": [0, 2, 5, 22, 28, 29], "wai": [1, 5, 6, 16, 22, 26, 29, 32], "wait_until": 30, "walk": 5, "want": [0, 2, 3, 5, 13, 22, 31, 33], "warn": [1, 36], "warranti": 38, "wast": [22, 26], "we": [0, 1, 2, 3, 4, 5, 6, 7, 16, 22, 26, 29, 32, 33], "week": [23, 29], "welcom": [0, 35], "well": [0, 5, 20, 22, 29, 31], "went": 33, "were": [5, 6, 22], "what": [0, 5, 6, 7, 22, 26, 32, 33, 35], "whatev": 7, "when": [0, 1, 2, 3, 4, 5, 6, 7, 16, 21, 22, 31, 33, 35], "whenev": [5, 26], "wheneverupd": 5, "where": [0, 3, 5, 22, 26, 29, 31, 35], "whether": [20, 22, 38], "which": [0, 1, 2, 3, 4, 5, 6, 7, 22, 29, 30, 31, 33], "while": [5, 22, 26, 31], "who": [5, 31, 35], "whole": [16, 22], "whom": 38, "whose": [0, 5, 29], "why": 31, "wiki": 26, "wikipedia": [26, 29], "wise": 5, "within": [0, 1, 3, 7, 8, 9, 22, 29], "without": [0, 22, 31, 38], "won": 7, "word": [0, 2], "wordpress": 26, "work": [5, 6, 22, 26, 29, 33, 35], "wors": 29, "worst": 22, "worth": 31, "would": [0, 5, 6, 21, 22, 31, 33], "wp": 26, "wrap": 5, "write": [0, 8, 16, 22, 26, 31, 33, 34, 35], "written": [0, 22], "wrong": 22, "wrote": 1, "www": [20, 40], "x": [22, 26], "y": 22, "year": 29, "yet": [1, 5, 7, 11], "yield": 29, "you": [0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 16, 24, 27, 29, 32, 33, 34, 35, 37, 40], "your": [1, 4, 5, 7, 8, 9, 26, 28, 29, 32, 33, 34, 39, 40], "zero": [4, 5, 29], "zoom": 6}, "titles": ["Getting Started", "Model Test Drive", "Enumerated and Derived Resources", "Using Current Value in an Effect Model", "Second Look", "Integrating Data Rate", "Integral Method Comparison", "Sim Configuration", "Intro Tutorial: Solid State Recorder", "Tutorials", "Going further", "Build an Aerie-compatible JAR file", "Modeling Data Volume", "User Guides", "How to use pymerlin in Jupyter", "Monte-Carlo analyses", "How to organize your project", "Modeling Power", "Scheduling", "Using spice for geometry", "Modeling Telecom", "Co-Simulation", "Command Errors", "Tuning Fidelity", "Background", "Planning and Scheduling", "Discrete Event Simulation", "API Reference", "pymerlin", "pymerlin.duration", "pymerlin.model_actions", "Architecture", "Common Errors", "Contributing", "Developing pymerlin", "Documentation", "Glossary", "pymerlin", "License", "Publishing to pypi", "Quickstart"], "titleterms": {"1": 5, "2": 5, "3": 5, "4": 5, "But": 31, "The": 26, "about": 31, "activ": [0, 5, 22], "aeri": [11, 31, 35], "aerospac": 35, "an": [3, 11, 22], "analys": 15, "api": [27, 28, 29, 30], "approach": 31, "architectur": 31, "assum": 35, "async": 31, "audienc": 35, "autonom": 22, "avoid": 22, "await": 31, "background": 24, "base": 5, "build": [11, 33, 34], "carlo": 15, "chang": [5, 22], "circular": 32, "class": 29, "co": 21, "code": [33, 37], "command": 22, "commit": 33, "common": 32, "comparison": 6, "compat": 11, "configur": 7, "content": [28, 29, 30], "contribut": [33, 37], "creat": 0, "current": 3, "data": [5, 12, 28, 29], "deriv": [2, 5], "develop": 34, "discret": 26, "do": 22, "document": 35, "drive": 1, "durat": 29, "effect": 3, "enumer": 2, "error": [22, 32], "event": 26, "feedback": 37, "fidel": 23, "file": [11, 16, 22], "first": 0, "from": 5, "function": [28, 30], "further": [10, 21], "geometri": 19, "get": [0, 37], "glossari": [35, 36], "go": 10, "good": 33, "got": 33, "guarante": 22, "guid": 13, "guidelin": 33, "help": 37, "how": [14, 16, 22, 37], "idiom": 31, "import": 32, "importerror": 32, "increas": 5, "instal": [0, 40], "integr": [5, 6, 22], "intro": 8, "jar": [11, 34], "jupyt": 14, "knowledg": 35, "licens": 38, "look": 4, "make": 22, "method": [5, 6, 22], "mission": 0, "model": [0, 1, 3, 12, 17, 20], "model_act": 30, "modul": [29, 30], "mont": 15, "organ": 16, "over": 31, "packag": 28, "partial": 22, "perform": 31, "plan": [22, 25], "polynomi": 5, "power": 17, "pr": 33, "practic": 33, "problem": 33, "program": 35, "project": 16, "provid": 37, "publish": 39, "pull": 33, "pymerlin": [0, 14, 28, 29, 30, 33, 34, 37], "pypi": 39, "python": 31, "question": 33, "quickstart": 40, "rate": 5, "re": 22, "read": 21, "record": 8, "refer": 27, "referenc": 35, "request": 33, "resourc": [0, 2, 5], "review": 33, "round": 31, "safeti": 22, "sampl": 5, "schedul": [18, 25], "second": 4, "sim": 7, "simul": [21, 26], "solid": 8, "sourc": 37, "spacecraft": 22, "spice": 19, "stack": 32, "start": 0, "state": 8, "style": 35, "submit": 33, "submodul": 28, "subsystem": 16, "target": 35, "telecom": 20, "test": [1, 34], "theori": 26, "thread": 31, "trace": 32, "trip": 31, "tune": 23, "tutori": [8, 9], "updat": 5, "upon": 5, "us": [3, 14, 19, 31], "usabl": 22, "user": 13, "v": [22, 31], "valid": 22, "valu": 3, "volum": [5, 12], "what": 31, "within": 5, "you": 22, "your": [0, 16]}}) \ No newline at end of file +Search.setIndex({"alltitles": {"API": [[28, "api"], [29, "api"], [30, "api"]], "API Reference": [[27, "api-reference"]], "Activity Planning": [[22, "activity-planning"]], "Approachability over performance": [[31, "approachability-over-performance"]], "Architecture": [[31, "architecture"]], "Assumed Aerospace knowledge": [[35, "assumed-aerospace-knowledge"]], "Assumed programming knowledge": [[35, "assumed-programming-knowledge"]], "Async/await vs threads": [[31, "async-await-vs-threads"]], "Avoiding Command Errors": [[22, "avoiding-command-errors"]], "Background": [[24, "background"]], "Build an Aerie-compatible JAR file": [[11, "build-an-aerie-compatible-jar-file"]], "Building pymerlin": [[33, "building-pymerlin"]], "Building pymerlin.jar": [[34, "building-pymerlin-jar"]], "But what about Aerie idioms?": [[31, "but-what-about-aerie-idioms"]], "Classes": [[29, "classes"]], "Co-Simulation": [[21, "co-simulation"]], "Command Errors": [[22, "command-errors"]], "Common Errors": [[32, "common-errors"]], "Contributing": [[33, "contributing"]], "Creating a Mission Model": [[0, "creating-a-mission-model"]], "Data": [[28, "data"], [29, "data"]], "Developing pymerlin": [[34, "developing-pymerlin"]], "Discrete Event Simulation": [[26, "discrete-event-simulation"]], "Documentation": [[35, "documentation"]], "Enumerated and Derived Resources": [[2, "enumerated-and-derived-resources"]], "File-by-subsystem": [[16, "file-by-subsystem"]], "Functions": [[28, "functions"], [30, "functions"]], "Further Reading": [[21, "further-reading"]], "Getting Started": [[0, "getting-started"]], "Glossary": [[35, "glossary"], [36, "glossary"]], "Going further": [[10, "going-further"]], "Good Commit, PR, and Code Review Practices": [[33, "good-commit-pr-and-code-review-practices"]], "Got a Question or Problem?": [[33, "got-a-question-or-problem"]], "How do you guarantee the safety of an autonomous spacecraft?": [[22, "how-do-you-guarantee-the-safety-of-an-autonomous-spacecraft"]], "How to get help, contribute, or provide feedback": [[37, "how-to-get-help-contribute-or-provide-feedback"]], "How to organize your project": [[16, "how-to-organize-your-project"]], "How to use pymerlin in Jupyter": [[14, "how-to-use-pymerlin-in-jupyter"]], "ImportError - circular import": [[32, "importerror-circular-import"]], "Installation": [[40, "installation"]], "Installing pymerlin": [[0, "installing-pymerlin"]], "Integral Method Comparison": [[6, "integral-method-comparison"]], "Integrated vs Partial validation": [[22, "integrated-vs-partial-validation"]], "Integrating Data Rate": [[5, "integrating-data-rate"]], "Intro Tutorial: Solid State Recorder": [[8, "intro-tutorial-solid-state-recorder"]], "License": [[38, "license"]], "Making changes to command files": [[22, "making-changes-to-command-files"]], "Method 1 - Increase volume within activity": [[5, "method-1-increase-volume-within-activity"]], "Method 2 - Sample-based volume update": [[5, "method-2-sample-based-volume-update"]], "Method 3 - Update volume upon change to rate": [[5, "method-3-update-volume-upon-change-to-rate"]], "Method 4 - Derived volume from polynomial resource": [[5, "method-4-derived-volume-from-polynomial-resource"]], "Methods of Validation": [[22, "methods-of-validation"]], "Model Test Drive": [[1, "model-test-drive"]], "Modeling Data Volume": [[12, "modeling-data-volume"]], "Modeling Power": [[17, "modeling-power"]], "Modeling Telecom": [[20, "modeling-telecom"]], "Module Contents": [[29, "module-contents"], [30, "module-contents"]], "Monte-Carlo analyses": [[15, "monte-carlo-analyses"]], "Package Contents": [[28, "package-contents"]], "Planning and Scheduling": [[25, "planning-and-scheduling"]], "Publishing to pypi": [[39, "publishing-to-pypi"]], "Pull Request Guidelines": [[33, "pull-request-guidelines"]], "Quickstart": [[40, "quickstart"]], "Re-usable command files": [[22, "re-usable-command-files"]], "Referencing Aerie": [[35, "referencing-aerie"]], "Round trips": [[31, "round-trips"]], "Scheduling": [[18, "scheduling"]], "Second Look": [[4, "second-look"]], "Sim Configuration": [[7, "sim-configuration"]], "Source code": [[37, "source-code"]], "Stack traces": [[32, "stack-traces"]], "Style": [[35, "style"]], "Submitting a Pull Request": [[33, "submitting-a-pull-request"]], "Submodules": [[28, "submodules"]], "Target Audience": [[35, "target-audience"]], "Testing": [[34, "testing"]], "The Theory": [[26, "the-theory"]], "Tuning Fidelity": [[23, "tuning-fidelity"]], "Tutorials": [[9, "tutorials"]], "Use pythonic idioms": [[31, "use-pythonic-idioms"]], "User Guides": [[13, "user-guides"]], "Using Current Value in an Effect Model": [[3, "using-current-value-in-an-effect-model"]], "Using spice for geometry": [[19, "using-spice-for-geometry"]], "Your First Activity": [[0, "your-first-activity"]], "Your First Resource": [[0, "your-first-resource"]], "pymerlin": [[28, "module-pymerlin"], [37, "pymerlin"]], "pymerlin.duration": [[29, "module-pymerlin.duration"]], "pymerlin.model_actions": [[30, "module-pymerlin.model_actions"]]}, "docnames": ["1_tutorials/getting-started/1-gettingstarted", "1_tutorials/getting-started/2-model-test-drive", "1_tutorials/getting-started/3-enum-derived-resource", "1_tutorials/getting-started/4-current-value", "1_tutorials/getting-started/5-second-look", "1_tutorials/getting-started/6-integrating-rate", "1_tutorials/getting-started/7-integration-comparision", "1_tutorials/getting-started/8-simulation-config", "1_tutorials/getting-started/index", "1_tutorials/index", "1_tutorials/tutorial2", "2_guides/build-jar", "2_guides/datamodel", "2_guides/index", "2_guides/jupyter", "2_guides/monte-carlo", "2_guides/organization", "2_guides/powermodel", "2_guides/scheduling", "2_guides/spice", "2_guides/telecom", "3_explanation/co-simulation", "3_explanation/command-errors", "3_explanation/fidelity", "3_explanation/index", "3_explanation/planning", "3_explanation/simulation", "apidocs/index", "apidocs/pymerlin/pymerlin", "apidocs/pymerlin/pymerlin.duration", "apidocs/pymerlin/pymerlin.model_actions", "architecture", "common-errors", "contribute", "developer", "documentation", "glossary", "index", "license", "publishing", "quickstart"], "envversion": {"sphinx": 61, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["1_tutorials/getting-started/1-gettingstarted.md", "1_tutorials/getting-started/2-model-test-drive.md", "1_tutorials/getting-started/3-enum-derived-resource.md", "1_tutorials/getting-started/4-current-value.md", "1_tutorials/getting-started/5-second-look.md", "1_tutorials/getting-started/6-integrating-rate.md", "1_tutorials/getting-started/7-integration-comparision.md", "1_tutorials/getting-started/8-simulation-config.md", "1_tutorials/getting-started/index.md", "1_tutorials/index.md", "1_tutorials/tutorial2.md", "2_guides/build-jar.md", "2_guides/datamodel.md", "2_guides/index.md", "2_guides/jupyter.md", "2_guides/monte-carlo.md", "2_guides/organization.md", "2_guides/powermodel.md", "2_guides/scheduling.md", "2_guides/spice.md", "2_guides/telecom.md", "3_explanation/co-simulation.md", "3_explanation/command-errors.md", "3_explanation/fidelity.md", "3_explanation/index.md", "3_explanation/planning.md", "3_explanation/simulation.md", "apidocs/index.rst", "apidocs/pymerlin/pymerlin.rst", "apidocs/pymerlin/pymerlin.duration.rst", "apidocs/pymerlin/pymerlin.model_actions.rst", "architecture.md", "common-errors.md", "contribute.md", "developer.md", "documentation.md", "glossary.md", "index.md", "license.md", "publishing.md", "quickstart.md"], "indexentries": {"__all__ (in module pymerlin)": [[28, "pymerlin.__all__", false]], "__eq__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__eq__", false]], "__ge__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__ge__", false]], "__gt__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__gt__", false]], "__le__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__le__", false]], "__lt__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__lt__", false]], "__repr__() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.__repr__", false]], "_yield_with() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions._yield_with", false]], "aerie": [[36, "term-Aerie", true]], "call() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.call", false]], "checkout() (in module pymerlin)": [[28, "pymerlin.checkout", false]], "delay() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.delay", false]], "duration (class in pymerlin.duration)": [[29, "pymerlin.duration.Duration", false]], "effect model": [[36, "term-Effect-Model", true]], "from_string() (pymerlin.duration.duration static method)": [[29, "pymerlin.duration.Duration.from_string", false]], "hour (in module pymerlin.duration)": [[29, "pymerlin.duration.HOUR", false]], "hours (in module pymerlin.duration)": [[29, "pymerlin.duration.HOURS", false]], "merlin": [[36, "term-Merlin", true]], "microsecond (in module pymerlin.duration)": [[29, "pymerlin.duration.MICROSECOND", false]], "microseconds (in module pymerlin.duration)": [[29, "pymerlin.duration.MICROSECONDS", false]], "millisecond (in module pymerlin.duration)": [[29, "pymerlin.duration.MILLISECOND", false]], "milliseconds (in module pymerlin.duration)": [[29, "pymerlin.duration.MILLISECONDS", false]], "minute (in module pymerlin.duration)": [[29, "pymerlin.duration.MINUTE", false]], "minutes (in module pymerlin.duration)": [[29, "pymerlin.duration.MINUTES", false]], "module": [[28, "module-pymerlin", false], [29, "module-pymerlin.duration", false], [30, "module-pymerlin.model_actions", false]], "negate() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.negate", false]], "of() (pymerlin.duration.duration static method)": [[29, "pymerlin.duration.Duration.of", false]], "plus() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.plus", false]], "pymerlin": [[28, "module-pymerlin", false]], "pymerlin.duration": [[29, "module-pymerlin.duration", false]], "pymerlin.model_actions": [[30, "module-pymerlin.model_actions", false]], "second (in module pymerlin.duration)": [[29, "pymerlin.duration.SECOND", false]], "seconds (in module pymerlin.duration)": [[29, "pymerlin.duration.SECONDS", false]], "spawn() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.spawn", false]], "times() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.times", false]], "to_number_in() (pymerlin.duration.duration method)": [[29, "pymerlin.duration.Duration.to_number_in", false]], "validation": [[36, "term-Validation", true]], "wait_until() (in module pymerlin.model_actions)": [[30, "pymerlin.model_actions.wait_until", false]], "zero (in module pymerlin.duration)": [[29, "pymerlin.duration.ZERO", false]]}, "objects": {"": [[28, 0, 0, "-", "pymerlin"]], "pymerlin": [[28, 1, 1, "", "__all__"], [28, 2, 1, "", "checkout"], [29, 0, 0, "-", "duration"], [30, 0, 0, "-", "model_actions"]], "pymerlin.duration": [[29, 3, 1, "", "Duration"], [29, 1, 1, "", "HOUR"], [29, 1, 1, "", "HOURS"], [29, 1, 1, "", "MICROSECOND"], [29, 1, 1, "", "MICROSECONDS"], [29, 1, 1, "", "MILLISECOND"], [29, 1, 1, "", "MILLISECONDS"], [29, 1, 1, "", "MINUTE"], [29, 1, 1, "", "MINUTES"], [29, 1, 1, "", "SECOND"], [29, 1, 1, "", "SECONDS"], [29, 1, 1, "", "ZERO"]], "pymerlin.duration.Duration": [[29, 4, 1, "", "__eq__"], [29, 4, 1, "", "__ge__"], [29, 4, 1, "", "__gt__"], [29, 4, 1, "", "__le__"], [29, 4, 1, "", "__lt__"], [29, 4, 1, "", "__repr__"], [29, 4, 1, "", "from_string"], [29, 4, 1, "", "negate"], [29, 4, 1, "", "of"], [29, 4, 1, "", "plus"], [29, 4, 1, "", "times"], [29, 4, 1, "", "to_number_in"]], "pymerlin.model_actions": [[30, 2, 1, "", "_yield_with"], [30, 2, 1, "", "call"], [30, 2, 1, "", "delay"], [30, 2, 1, "", "spawn"], [30, 2, 1, "", "wait_until"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "data", "Python data"], "2": ["py", "function", "Python function"], "3": ["py", "class", "Python class"], "4": ["py", "method", "Python method"]}, "objtypes": {"0": "py:module", "1": "py:data", "2": "py:function", "3": "py:class", "4": "py:method"}, "terms": {"": [0, 2, 3, 4, 5, 6, 8, 15, 19, 22, 23, 29, 31, 33, 35, 36], "0": [0, 1, 2, 4, 5, 7, 29], "00": [0, 29, 30], "000": 29, "000000": 29, "01": [0, 30], "01pre": 26, "03": 26, "0e3": 3, "1": [0, 1, 3, 4, 6, 8, 9, 29], "10": [0, 1, 3, 4], "100": [0, 1], "1000": 5, "11": 40, "15": 4, "170215": 26, "1e": [5, 7], "1e3": 7, "2": [1, 4, 8, 9, 20, 22, 29], "20": [1, 5], "2017": 26, "2018": 26, "2021": 38, "21": [34, 40], "24": 29, "250": [5, 7], "2ab": 20, "2nd": 6, "3": [3, 6, 7, 8, 9, 26, 34, 40], "30": 29, "3120": 40, "3rd": 26, "4": [8, 9], "5": [4, 29], "500": 2, "5000": 2, "60": [5, 7], "600": 29, "63": 29, "7": 29, "8601": 29, "9": 34, "A": [2, 5, 18, 22, 26, 29, 30, 36, 38], "AND": 38, "AS": 38, "And": 5, "As": [0, 2, 5, 16, 22, 29, 31, 33, 34, 35], "At": [1, 4, 33], "BE": 38, "BUT": 38, "Be": 33, "But": [0, 11, 16], "By": 5, "FOR": 38, "For": [0, 2, 3, 5, 6, 22, 29, 31, 33, 34], "IN": 38, "If": [0, 3, 5, 6, 22, 29, 33, 40], "In": [0, 2, 3, 5, 7, 8, 22, 26, 29, 33, 35], "It": [0, 5, 6, 15, 21, 22, 23, 31, 35], "NO": 38, "NOT": 38, "No": 33, "Not": 22, "OF": 38, "OR": 38, "On": 1, "One": [16, 22], "Such": 5, "THE": 38, "TO": 38, "That": [5, 22], "The": [0, 1, 2, 3, 5, 6, 7, 16, 19, 20, 22, 24, 29, 31, 32, 33, 35, 36, 38], "Then": [0, 4], "There": [5, 7, 21, 22, 23, 26, 35], "These": [0, 1, 22, 31, 33], "To": [6, 22, 26, 29, 31, 33, 37], "WITH": 38, "With": [0, 2, 4, 6], "__all__": 28, "__eq__": 29, "__ge__": 29, "__gt__": 29, "__init__": 0, "__le__": 29, "__lt__": 29, "__repr__": 29, "_decor": 0, "_global": 31, "_intern": [0, 34], "_yield_with": 30, "abil": [22, 23, 33], "abl": [2, 20, 21, 22, 26], "about": [0, 1, 3, 5, 7, 22, 24, 32, 33, 37], "abov": [0, 1, 5, 6, 7, 22, 33, 38], "absenc": [22, 26], "absolut": 22, "abstract": 22, "accept": 33, "access": 37, "accomplish": [0, 2, 22], "account": 7, "accumul": 5, "accur": 5, "accuraci": [6, 29], "achiev": [0, 7, 16, 22], "across": [5, 22, 23, 35], "act": 26, "action": [0, 5, 22, 26, 30, 31, 38], "activ": [1, 3, 4, 6, 7, 8, 9, 16, 23, 24, 31, 32, 36, 40], "activitytyp": [0, 3], "actual": [0, 1, 3, 5, 7, 22, 33], "ad": [0, 1, 2, 22, 33], "add": [0, 1, 2, 4, 5, 7, 26, 33], "addit": [0, 2, 5, 6, 7, 23, 26, 31, 34], "address": 22, "adher": [5, 22], "adoptium": 40, "advanc": 26, "advantag": 5, "advers": 22, "advic": 32, "aeri": [0, 1, 4, 5, 6, 7, 13, 23, 26, 33, 36, 37], "affect": 22, "after": [0, 1, 2, 3, 4, 5, 6, 7, 22, 33, 40], "again": [4, 26], "against": [22, 29], "ahead": [6, 7], "aid": 33, "aim": 31, "align": [4, 5, 6], "all": [0, 5, 6, 7, 22, 26, 31, 33, 34, 38, 40], "alloc": [20, 22, 26], "allow": [0, 1, 2, 3, 5, 22, 26, 31, 33], "almost": 29, "alon": 1, "along": [0, 2], "alreadi": [0, 7, 35], "also": [0, 1, 2, 3, 5, 6, 7, 22, 23], "alter": [0, 5], "altern": 31, "although": [0, 5, 6], "altogeth": 29, "alwai": [29, 33, 35], "ammo": 26, "amount": 5, "an": [0, 2, 5, 6, 7, 8, 9, 13, 20, 24, 26, 29, 32, 33, 35, 36, 38], "an9804": 20, "analys": 13, "analysi": 22, "analyz": 31, "ani": [0, 6, 20, 22, 26, 29, 33, 35, 38], "annot": [0, 7, 31], "anoth": [2, 4, 5, 22, 26, 32], "answer": [3, 5], "anticip": 22, "anywai": 5, "apach": 32, "apart": 0, "api": [31, 32, 39], "appar": 5, "appear": [0, 1, 4, 7, 33], "appli": [1, 22, 26], "approach": [5, 6], "appropri": [31, 35], "approv": [22, 33], "approx_linear": 5, "approxim": [5, 23, 29], "ar": [0, 1, 2, 5, 6, 21, 22, 23, 26, 29, 30, 31, 33, 34, 35, 40], "arbitrari": [5, 26], "arbitrarili": 26, "aren": [6, 22], "argument": [0, 1, 5, 7, 22, 31, 36], "aris": [15, 21, 22, 38], "arithmet": 29, "around": [4, 7, 29, 32], "arriv": 5, "as_polynomi": 5, "aspect": [7, 35], "aspir": 34, "aspolynomi": 7, "assembl": [1, 6, 34], "assess": 22, "assign": 29, "associ": [0, 2, 6, 7, 38], "assum": [5, 7, 22], "assumelinear": 5, "astronom": 29, "async": [0, 3, 5, 30, 35], "attain": 35, "attent": [22, 33], "attribut": [26, 31], "author": [22, 38], "autodoc2": 35, "autom": [22, 34], "automat": [22, 23, 33, 35], "autonom": 24, "autonomi": 22, "avail": [0, 2, 3, 5, 6, 7, 20], "avoid": [16, 24, 26], "await": [0, 5, 30, 35], "awar": [0, 3, 22], "b": [18, 20, 33], "back": [0, 1, 5, 7], "background": [5, 35], "bandwidth": 20, "bar": 1, "base": [0, 1, 2, 3, 8, 9, 29], "basi": 29, "basic": [0, 35], "batteri": [5, 22], "bear": [0, 1, 2, 3, 4, 5, 6, 7], "becam": 22, "becaus": [0, 3, 7, 29], "becom": [2, 16, 29, 33], "been": [0, 1, 5, 20, 22, 31, 33], "befor": [0, 3, 5, 7, 22, 26, 33], "begin": [0, 1, 5, 6], "behavior": [0, 5, 7, 15, 22, 23, 36], "being": [0, 5, 7, 29], "below": [1, 4, 5, 6], "belt": 5, "benefit": 31, "best": [7, 22, 23, 35], "better": [22, 33], "between": [0, 4, 5, 6, 20, 22, 23, 26, 29, 31, 33], "beyond": 0, "bind": 19, "bisect": 33, "bit": [3, 35], "block": [0, 35], "board": [0, 2, 5, 22], "bodi": [0, 5, 20, 29, 36], "bonu": 0, "book": 0, "boolean": 0, "borrow": [26, 32], "both": [0, 3, 5, 22, 26, 32, 35], "bottom": 35, "bound": [5, 22], "bracket": 33, "branch": 33, "break": [5, 16], "bridg": 31, "brief": [0, 35], "budget": 20, "buffer": 0, "build": [0, 1, 3, 4, 5, 6, 7, 13, 16, 31, 39], "built": [0, 1, 2, 4, 6, 35, 37], "bulletproof": 22, "burden": 22, "busi": 20, "button": [1, 33], "c": [38, 40], "cach": 31, "calcul": [6, 19], "calendar": 29, "calendr": 29, "california": 38, "call": [0, 1, 2, 3, 5, 6, 7, 22, 23, 26, 29, 30, 31], "camera": [0, 2], "can": [0, 1, 2, 3, 4, 5, 6, 7, 22, 23, 24, 26, 27, 29, 30, 31, 32, 33, 34, 35, 37], "cannot": [0, 1, 22, 32], "capabl": [4, 6, 22], "capac": [5, 6, 7], "capital_snake_cas": 31, "cardin": 22, "care": [3, 5, 31], "carlo": [13, 23], "carol": 22, "carri": 22, "case": [0, 2, 3, 5, 7, 22, 29, 31], "catch": 23, "categori": [0, 22], "caus": [3, 22], "causal": 29, "caution": 22, "ccsd": 0, "cd": [34, 35], "celesti": 29, "cell": [0, 2, 5, 7, 26], "center": 1, "certain": [5, 7, 22, 26, 30, 31], "cfdp": 22, "challeng": 21, "chang": [0, 1, 3, 4, 6, 7, 8, 9, 24, 26, 33], "change_mag_mod": [3, 4, 5, 6], "channel": 33, "character": 31, "characterist": 22, "charg": 38, "chat": 33, "check": [1, 22, 28, 33, 36, 37, 40], "checkmark": 1, "checkout": [28, 33, 40], "child": [26, 30], "china": 29, "choic": [26, 29], "choos": [5, 16, 22], "chosen": 5, "chunk": 5, "circular": 16, "cite": 22, "claim": [29, 38], "clamp": 5, "clamped_integr": 5, "clampedintegr": [5, 7], "class": [0, 2, 3, 5, 7, 27, 31], "clean": [33, 35], "cleanup": 31, "clear": [22, 33], "click": 1, "clock": [0, 5, 29], "clockeffect": 5, "clone": 33, "close": [22, 33], "co": 24, "code": [0, 2, 5, 7, 16, 29, 31, 35], "collect": [0, 2, 5], "collect_data": [0, 1, 4, 5, 6], "collinear": 29, "color": 4, "com": [20, 26, 35, 37], "combin": [22, 29, 33], "come": [0, 21, 22, 23], "command": [23, 24, 33, 39, 40], "comment": [33, 35], "commit": 35, "common": 0, "commun": [20, 22, 23, 31], "compani": 35, "compar": [5, 6, 22], "comparison": [8, 9], "compat": [13, 31], "compil": [1, 4, 6, 7], "complac": 22, "complet": [0, 5, 22], "complex": 1, "complic": [29, 33], "compon": [22, 36], "compos": 23, "comput": [0, 3, 5, 6, 7, 22, 26], "concept": [23, 26, 29, 35], "concern": 5, "concurr": [22, 26], "condit": [5, 22, 26, 30, 38], "config": 7, "configur": [8, 9, 23, 29], "conflict": [22, 26, 33], "connect": 38, "consensu": 22, "consequ": 22, "consid": 31, "consider": 16, "consist": [6, 35], "constant": [0, 5, 7, 31], "constel": 22, "constitu": 22, "constrain": 22, "constraint": [22, 36], "construct": [0, 1, 2, 3, 4, 5, 6, 7, 29], "constructor": [0, 2, 5, 7], "consult": 31, "consum": 0, "contain": [5, 13, 22, 35], "content": [0, 22, 26], "context": [5, 31, 35], "continu": [0, 2, 26, 33], "contract": 38, "contrast": 0, "contribut": [5, 35], "contributor": 33, "control": 22, "conveni": 32, "convent": [3, 33], "convers": [0, 3, 5], "convert": [5, 29, 31], "coordin": 22, "copi": [33, 38], "copyright": 38, "coro": 30, "coroutin": 31, "correct": [5, 22], "correctli": [0, 7, 22], "correspond": [2, 4, 22], "cost": 22, "could": [0, 1, 2, 5, 6, 7, 22, 31], "count": 5, "counter": 0, "coupl": [0, 2, 5, 6, 7, 29], "cours": 0, "cover": [0, 29], "creat": [1, 2, 5, 6, 7, 8, 9, 29, 33], "cross": 31, "cumul": 5, "current": [0, 2, 5, 6, 8, 9, 26, 29, 33, 34], "current_r": [3, 5], "current_recording_r": 5, "currentvalu": [3, 5, 7], "custom": 29, "cycl": 23, "d": [0, 5, 7, 26, 33], "daemon": 5, "dai": [1, 4, 6, 23, 29], "damag": 38, "danger": 22, "data": [0, 2, 3, 6, 8, 9, 13, 22, 27], "data_model": [0, 3, 5], "datamodel": [0, 2, 5, 7], "date": [29, 35], "de": 29, "deadlin": 22, "deal": [29, 33, 38], "debug": 32, "decid": 22, "decis": 22, "declar": [0, 2, 5, 7, 22], "decor": 0, "decreas": [0, 4, 5, 6], "def": [0, 3, 5], "default": [0, 1, 3, 7], "defaultconfigur": 7, "defer": 29, "defin": [0, 2, 5, 7, 22, 29, 31, 32, 34], "definit": [0, 2, 3, 5, 7, 22, 29], "degrad": 5, "degre": 35, "delai": [0, 5, 22, 30], "deleg": 0, "delet": [22, 33], "delimit": 29, "deliv": 22, "depend": [0, 20, 22, 23, 26, 29, 35], "deploy": [0, 35], "depth": 22, "deriv": [0, 3, 8, 9, 29], "describ": [0, 5, 16, 22, 26, 32, 33, 36, 40], "descript": [22, 33], "deserv": 35, "design": [0, 21, 22, 33], "desir": [3, 22, 23], "despit": 5, "detail": [0, 1, 23, 27, 35], "detect": 22, "determin": [5, 20], "develop": [32, 33, 35], "deviat": 22, "did": [5, 6, 22], "differ": [0, 2, 5, 20, 22, 23, 29], "difficult": [22, 31], "direct": 1, "directli": [0, 2, 5, 22, 29, 31], "directori": [34, 35], "discoveri": 20, "discret": [0, 2, 5, 7, 24, 29, 37], "discreteeffect": [0, 3], "discreteresourc": 2, "discreteresourcemonad": 2, "discuss": 33, "disposit": 22, "dist": 39, "distanc": [20, 29], "distinct": 29, "distinguish": [0, 29], "distribut": [26, 38], "divid": [2, 3, 5, 16], "do": [0, 1, 2, 3, 4, 5, 6, 7, 13, 16, 24, 28, 31, 32, 38], "doc": [26, 32, 34, 35, 37], "docstr": [31, 35], "document": [0, 33, 38], "doe": [0, 5, 22, 33, 36], "doesn": [5, 7], "domain": 29, "don": [0, 1, 2, 5, 6, 22, 33], "done": [0, 22, 29, 31], "doubl": [0, 2, 5, 7, 31], "doublevaluemapp": 7, "down": [4, 5, 7], "downlink": [5, 6], "download": 40, "draft": 22, "drag": [1, 4], "drawback": 5, "drive": [4, 8, 9], "driver": 31, "drop": [1, 4, 7, 29], "dropdown": 7, "duck": 31, "due": [0, 32], "duplic": [26, 33], "durat": [0, 1, 4, 5, 7, 22, 27, 28, 30], "duration_str": 29, "dure": [5, 22, 23, 36], "duti": 23, "dynam": [22, 26], "e": [0, 1, 5, 22, 29, 31], "each": [0, 5, 6, 32, 33], "earli": 22, "earlier": 1, "earth": [5, 22, 29], "easi": [5, 22], "easier": 33, "easiest": [0, 6], "easili": [4, 5], "ecosystem": 37, "edit": [1, 4, 6, 33], "effect": [0, 1, 2, 5, 8, 9, 22, 33, 36], "effici": 5, "effort": 33, "either": [22, 33], "elaps": 5, "element": 29, "elsewher": 31, "emit": [0, 2, 26], "en": 26, "enabl": [22, 26, 31], "encount": 32, "end": [0, 4, 5, 6], "endpoint": 33, "enforc": 6, "engin": [23, 31], "enhanc": 26, "enough": [6, 7, 22, 23], "ensur": [0, 7, 29, 33], "enter": 22, "entir": 5, "entri": 31, "enum": 2, "enumer": [0, 7, 8, 9, 22, 31], "enumvaluemapp": 7, "envelop": 22, "environ": [22, 34, 40], "environment": [5, 22], "epagomen": 29, "ephemerid": 29, "equal": 5, "err": 22, "error": [0, 5, 23, 24], "errorregistrar": 7, "esoter": 35, "especi": 2, "essenti": 0, "estim": 29, "etc": [0, 1, 2, 5], "evalu": 26, "even": [5, 22, 26, 29, 33], "event": [0, 22, 24, 29, 37, 38], "eventu": [0, 5], "everi": [5, 7, 22, 26, 33], "evid": 29, "evolut": 26, "evolv": 0, "exact": 29, "exampl": [0, 2, 5, 7, 22, 29, 30], "except": [2, 5, 29], "execut": [0, 22, 36], "exhaust": 22, "exist": [0, 7, 21, 22, 26, 29, 31, 39], "expect": [0, 5, 22, 31, 35], "expens": 6, "explain": 35, "explicit": 31, "explicitli": 0, "explor": [5, 6], "export": 7, "expos": [0, 5, 7, 31], "express": [26, 38], "extend": 0, "extens": 35, "extent": 31, "extern": 23, "f": [26, 33], "face": 35, "fact": [5, 22], "factori": 29, "fail": [0, 22], "failur": 22, "fairli": 5, "fall": [22, 33], "fals": [22, 30], "familiar": [22, 35], "famous": 22, "far": [5, 6, 22, 29], "fashion": 22, "fast": 22, "fault": 22, "fdir": 22, "feasibl": 22, "featur": [5, 33, 35], "few": [0, 5, 22, 33], "fewer": [6, 22], "fidel": [5, 24], "field": [2, 7, 29], "figur": 5, "file": [0, 1, 13, 24, 32, 33, 38, 39], "fill": [0, 5], "final": [0, 4, 5, 7], "find": [0, 5, 6, 7, 27], "fine": 22, "first": [1, 2, 4, 5, 6, 8, 9, 22, 26, 34, 40], "fit": 38, "fix": [0, 5, 22, 29, 33], "flexibl": 7, "flight": 22, "float": 29, "focu": [22, 35], "focus": [0, 22], "follow": [0, 1, 2, 5, 7, 22, 26, 33, 35, 38, 40], "forc": 33, "forget": [4, 26], "form": [0, 22], "formul": 26, "fortun": 5, "forward": [0, 5, 26], "found": 22, "four": 6, "framework": [0, 3, 5, 7, 37], "free": [22, 38], "free_replicated_data_typ": 26, "frequent": 29, "from": [0, 2, 3, 7, 8, 9, 15, 22, 26, 29, 32, 33, 38, 39], "from_str": [0, 29], "front": 33, "fsw": 22, "full": [0, 5], "fulli": 0, "fun": 5, "function": [0, 2, 5, 26, 27, 29, 31, 35, 36], "fundament": [0, 29], "furnish": 38, "furo": 35, "further": [9, 22, 24, 26, 29, 35], "futur": [26, 34], "g": [0, 1, 22, 29], "gain": 15, "gb": 5, "gbit": 5, "gener": [0, 7, 23, 26, 31, 33, 35], "geometri": [5, 13], "get": [2, 3, 4, 5, 6, 7, 8, 9, 21, 35, 40], "get_data_r": [2, 3, 7], "getter": 2, "gigabit": 5, "gil": 31, "git": [33, 35], "github": [26, 33, 37], "give": [0, 1, 2, 3, 4, 7, 22, 29, 31, 33], "given": [0, 5, 6, 26, 29], "global": 31, "go": [0, 1, 2, 5, 6, 7, 9, 22, 35, 40], "goe": 6, "gold": 29, "gone": 22, "good": [5, 29], "googl": 35, "gov": 7, "grab": 7, "gradlew": [1, 6, 34], "grain": 22, "grant": 38, "granular": 0, "great": [21, 29, 35], "greatest": 22, "green": [0, 1], "gregorian": 29, "ground": 22, "grow": 5, "guarante": [24, 26], "guardrail": 22, "guid": [0, 16, 35, 37], "guidanc": 35, "guidelin": 37, "ha": [0, 1, 5, 6, 16, 20, 22, 29, 31, 33], "had": [7, 22], "half": 6, "handi": 5, "handl": 31, "happen": 3, "hard": 7, "hardcod": 7, "hardwar": 22, "have": [0, 1, 2, 3, 5, 6, 7, 22, 23, 26, 31, 32, 33, 35, 40], "haven": [0, 1], "healthi": 22, "heater": 22, "held": 29, "help": [3, 5, 31, 33], "helper": [0, 5], "here": [0, 3, 7, 16, 22, 24, 27, 29, 32, 33, 35], "herebi": 38, "hierarch": [0, 33], "high": [2, 22], "high_rat": [2, 4, 6], "higher": 34, "histori": [1, 26, 33], "hit": 5, "hold": [5, 22], "holder": 38, "hook": 7, "hopefulli": 6, "horizon": 23, "host": 26, "hour": [0, 1, 29], "hover": 1, "how": [0, 1, 3, 4, 5, 6, 13, 23, 24, 33, 35, 40], "howev": [5, 7, 22, 29], "html": [20, 32, 35], "http": [20, 26, 32, 35, 37, 40], "human": 22, "hybrid": [26, 31], "hybrid_system": 26, "i": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 33, 35, 37, 38], "icon": 1, "id": [1, 31], "idea": [31, 33], "ideal": 3, "ident": 22, "identifi": 22, "ii": [5, 21], "imag": 0, "imagin": [0, 2], "imbu": 22, "immedi": 4, "impact": 22, "imper": 22, "implement": [0, 5, 6, 21, 22, 26, 31], "impli": [22, 38], "implicitli": 0, "import": [0, 2, 5, 7, 16, 22, 31, 35, 40], "importantli": 22, "imposs": 22, "incapacit": 22, "includ": [0, 5, 6, 7, 22, 29, 31, 33, 35, 38, 39], "incorrect": 22, "increas": [0, 3, 4, 6, 8, 9, 22], "increment": 29, "indefinit": 22, "independ": [5, 22, 26], "index": 35, "indic": 22, "individu": [22, 23], "infinit": 5, "info": 33, "inform": [1, 22, 33], "inherit": 31, "init": 31, "initi": [0, 1, 2, 5, 7, 26, 29, 32], "input": [7, 15, 22, 31], "insight": [6, 15], "insignific": 31, "inspect": 22, "instal": [8, 9, 28, 34], "instanc": [0, 1, 5], "instant": 29, "instantan": 0, "instanti": 0, "instead": [1, 2, 5, 21, 29], "institut": 38, "instruct": [1, 4, 33, 35], "instrument": [0, 2, 31], "integ": [0, 29], "integr": [0, 8, 9, 23, 24, 31, 33], "integrate_sampled_ssr": 5, "integration_sample_interv": [5, 7], "integrationsampleinterv": 7, "intend": [0, 2, 16, 22], "intens": 22, "intent": 22, "intention": 29, "interact": [22, 33], "intercalari": 29, "interest": [0, 2, 5, 6, 22], "interestingli": 0, "interfac": [7, 26, 33], "interleav": 0, "intern": 29, "interpret": [22, 31], "interspers": 22, "interv": [5, 6, 7], "intract": 16, "intro": [9, 16], "introduc": [0, 3, 6, 22, 26], "invalid": [0, 22], "invok": 29, "involv": 22, "io": 26, "isn": [3, 5, 11], "iso": 29, "isol": 22, "issu": [0, 5, 33], "iszero": 5, "its": [0, 2, 3, 5, 7, 15, 22, 23, 26, 31], "itself": [0, 5, 22], "jar": [1, 13, 31], "java": [0, 1, 2, 3, 4, 5, 6, 7, 29, 31, 34, 35, 40], "jdk": 34, "jpl": [7, 19], "jre": 40, "jump": 7, "jupyt": 13, "just": [0, 1, 4, 5, 29], "justifi": 22, "k": 31, "kbp": [2, 3], "keep": [0, 5, 22, 26, 35], "kei": [20, 22, 39], "kept": 31, "kernel": 29, "keyword": [0, 30, 35], "kind": [22, 38], "know": [0, 3, 7, 22, 35], "known": [5, 29], "komputasi": 26, "label": 30, "lack": 22, "lambda": [0, 2], "languag": 22, "larg": [22, 23], "larger": [6, 31], "largest": 29, "last": [0, 5], "later": [0, 3], "latest": [5, 32, 33], "latitud": 29, "lead": 22, "leak": 31, "learn": [0, 5, 6, 24, 37], "least": 33, "leav": 1, "left": [1, 4, 7, 33], "less": [3, 22, 29, 35], "let": [0, 1, 2, 3, 4, 5, 6, 35], "level": [0, 5, 7, 22], "leverag": [5, 21, 31], "liabil": 38, "liabl": 38, "lib": [1, 34], "librari": [34, 35], "lightweight": 22, "like": [0, 2, 3, 5, 6, 7, 22, 26, 29, 32, 33, 35], "limit": [0, 5, 20, 22, 38], "line": [0, 2, 4, 5, 7, 16, 33], "linear": [0, 5, 6, 33], "linearli": 5, "link": [0, 20, 29, 35], "list": [2, 26], "littl": [3, 5, 35], "live": [5, 35], "ll": [0, 1, 2, 3, 4, 5, 6, 7, 8, 34], "load": 7, "local": 33, "locat": 34, "lock": 31, "log": 0, "logic": [0, 5], "long": [3, 7, 22, 29, 31], "longer": [5, 6], "longest": 22, "look": [0, 1, 2, 3, 5, 6, 7, 8, 9, 29, 31], "loop": [5, 31], "lose": 6, "loss": 22, "lost": [22, 33], "lot": 35, "love": 33, "low": [2, 22], "low_rat": [2, 3, 4], "lower": [5, 22], "lowercas": 35, "lowercasenospac": 31, "lunar": 29, "m": 39, "machin": 40, "made": [0, 5, 33], "mag": [7, 20], "magdatacollectionmod": [2, 3, 7], "magdatamod": [2, 3, 4, 7], "magdatar": [2, 3, 4, 7], "magic": [3, 5], "magnetomet": [2, 3, 5], "mai": [3, 5, 6, 7, 15, 16, 22, 23, 29, 31, 32, 35], "main": [5, 31, 32], "maintain": 0, "major": 22, "make": [0, 1, 5, 6, 7, 24, 31, 32, 33, 35, 39, 40], "manag": [23, 26, 31], "maneuv": 22, "mani": [0, 5, 6, 15, 21, 22, 23], "map": [2, 5, 7, 29], "mark": 22, "martian": 29, "match": [0, 1, 7, 22], "mathwork": 20, "matt": 22, "mattdaili": 37, "max": [5, 7], "maxim": 22, "maximum": [6, 29], "mayb": [22, 35], "mb": 5, "mbit": 5, "mbp": [0, 3, 4], "mean": [5, 22, 26, 30, 31, 32, 35], "meaning": 0, "measur": [0, 29], "mechan": 22, "media": 20, "megabit": [0, 5], "member": [0, 5, 7], "memori": 31, "mental": 22, "mention": 22, "menu": [1, 7], "merchant": 38, "mere": [23, 31, 33], "merg": [33, 38], "merlin": [7, 26, 29, 31, 36], "messag": [0, 1, 22, 33], "messi": 5, "met": [5, 33], "method": [0, 2, 3, 7, 8, 9, 24, 29, 31], "micro": 29, "microsecond": 29, "might": [5, 13, 32], "millisecond": 29, "min": 5, "mind": [0, 22, 35], "minim": [22, 26], "minut": 29, "mirror": 22, "miss": 22, "mission": [1, 2, 4, 5, 6, 7, 8, 9, 16, 21, 22, 23, 26, 31, 32], "missionmodel": [0, 1, 7], "mit": 38, "mitig": 22, "mode": [2, 3, 4, 5, 7, 22], "model": [2, 4, 5, 6, 7, 8, 9, 13, 16, 21, 22, 23, 26, 30, 31, 32, 36], "model_act": [0, 27, 28], "modifi": [0, 1, 38], "modul": [5, 28, 31, 32], "moment": 7, "mont": [13, 23], "month": 29, "moon": 29, "more": [0, 1, 5, 6, 16, 22, 23, 24, 26, 31, 33, 35, 37], "most": [0, 5, 16, 22, 32], "move": [0, 1, 5, 7, 26], "msl": 22, "much": [2, 5, 6, 23], "multipl": [4, 6, 22, 29, 34], "multipli": [2, 5, 29], "must": [0, 5, 7, 22, 30, 33], "muszynski": 22, "mutabl": 26, "mutableresourc": [0, 2, 5], "mv": 34, "mvsteen": 26, "my": 33, "myst": 35, "mystmd": 35, "naif": 19, "name": [0, 1, 4, 22, 32], "nasa": [7, 19, 26], "natur": 16, "neatli": 33, "necessari": 29, "necessarili": 23, "need": [0, 2, 3, 5, 7, 22, 23, 29, 31, 32, 34, 35], "needless": 26, "neg": 3, "negat": 29, "net": [3, 40], "new": [0, 1, 2, 3, 4, 5, 6, 7, 8, 22, 33], "new_rat": 3, "newest": 22, "newli": 1, "next": [0, 1, 5, 6], "nice": [6, 21], "nomin": 22, "none": [28, 29], "nonetheless": 5, "noninfring": 38, "notabl": 5, "note": [1, 5, 7, 22, 29, 33], "notic": [0, 3, 4, 38], "notifi": 0, "notion": [23, 26, 29], "now": [0, 1, 2, 3, 4, 5, 6, 7, 22, 31], "num_step": 5, "number": [1, 2, 3, 5, 22, 29], "numer": [2, 5, 22], "object": [0, 5, 7, 31], "observ": [22, 23], "obstruct": 20, "obtain": 38, "occult": 20, "occur": [0, 5, 26, 32], "off": [1, 2, 4, 5, 6, 7, 22, 23], "often": [0, 5, 7, 22, 29], "ok": [0, 3, 5], "old": [3, 22], "onboard": 22, "onc": [0, 1, 3, 5, 6, 7, 22, 26, 33, 40], "one": [0, 1, 2, 3, 4, 5, 6, 16, 22, 29, 31, 32, 33], "ones": [5, 22], "onli": [0, 3, 5, 7, 29, 31, 34], "onto": [1, 2, 4, 33], "open": [1, 4, 33, 35], "oper": [0, 2, 3, 20, 22, 23, 26, 29, 31], "opportun": [0, 4, 5, 22], "oppos": 5, "optim": 22, "option": [5, 7, 33], "orbit": [19, 29], "order": [3, 5, 7, 22, 26, 29], "ordin": 29, "org": [26, 32, 35, 40], "organ": 13, "origin": [5, 7, 22, 31, 33], "other": [0, 2, 5, 6, 7, 20, 22, 29, 32, 38], "otherwis": [5, 38], "our": [0, 1, 2, 3, 4, 5, 6, 7, 33, 37], "out": [0, 5, 6, 7, 33, 35, 37, 38], "outcom": 22, "output": 31, "outsid": 29, "outstand": 33, "over": [0, 1, 2, 5, 6, 33], "overal": 3, "overflow": 5, "overhead": 31, "overrid": 31, "overview": 0, "overwrit": 35, "own": [0, 5, 29], "packag": [0, 7, 27, 29, 34], "packet": 22, "padawan": 0, "page": [0, 1, 2, 3, 4, 5, 6, 7, 11, 35], "pai": 33, "pair": 22, "palat": 22, "panel": [1, 4, 7, 22], "paradigm": [22, 31], "parallel": 26, "param": [29, 30], "paramet": [0, 1, 3, 4, 5, 6, 7, 22, 23, 29], "paraphras": 26, "parent": [7, 26], "parenthesi": 0, "pars": 35, "part": [7, 22], "partial": [24, 32], "particular": [22, 29, 38], "particularli": 35, "partit": 26, "pass": [0, 5, 7, 22, 31, 33], "passag": 29, "patch": 33, "path": [20, 31], "paus": [0, 31], "pdf": [20, 26], "peopl": 35, "pep8": 31, "per": 0, "perceiv": 22, "perfectli": 5, "perform": [0, 1, 5, 20, 22, 23, 26, 29], "perhap": [2, 22, 31], "period": [0, 29], "perman": 22, "permiss": 38, "permit": 38, "persist": 22, "person": 38, "persu": 35, "perturb": 15, "perus": 0, "peski": 0, "phase": 23, "phenomena": 26, "pick": 1, "piec": [5, 22], "piecewis": 0, "pip": [34, 40], "place": [0, 2, 22], "plai": [1, 4, 20, 21, 23], "plan": [0, 1, 4, 5, 6, 7, 23, 24, 36], "planner": [5, 7], "pleas": [0, 1, 2, 3, 4, 5, 6, 7, 33], "plu": 29, "plugin": 35, "point": [0, 1, 4, 5, 6, 7, 20, 22, 29, 31, 35], "polanskei": 22, "polynomi": [0, 6, 8, 9], "polynomialresourc": [5, 7], "pop": [1, 4], "popul": [1, 4, 11], "popular": 19, "port": [0, 1, 2, 3, 4, 5, 6, 7, 31], "portion": 38, "pose": 31, "posit": 22, "possibl": [0, 5, 22, 31, 33], "power": [13, 22], "powerless": 22, "practic": [22, 32, 35], "pre": 0, "precis": [22, 23, 29], "preclud": 36, "predic": 36, "predict": [0, 22], "prefer": [31, 33], "prefix": [26, 31], "preliminari": 26, "presenc": 29, "present": [0, 33], "preserv": 29, "prevent": 0, "previou": [5, 22, 33], "previous_r": 5, "previous_recording_r": 5, "previousrecording_r": 7, "primari": 0, "primarili": 0, "primit": [0, 5], "prior": [0, 7, 32], "privat": [5, 31], "probabl": 5, "problem": 29, "process": [0, 21, 22, 23, 31], "produc": 6, "profil": [0, 1, 5, 6, 22], "programm": 5, "progress": [0, 5], "project": [13, 33, 40], "promot": 22, "properti": [0, 20, 22, 26, 29, 31], "protect": 22, "prototyp": 31, "prove": 22, "proven": 22, "provid": [0, 1, 3, 5, 7, 19, 22, 23, 27, 29, 30, 31, 35, 38], "prudent": 22, "ptolemi": 21, "public": [7, 31], "publish": [34, 38], "pull": 0, "purpos": [20, 22, 38], "push": 33, "put": [1, 4, 7, 22, 26], "py": [0, 31, 32], "py4j": 31, "pymerlin": [8, 9, 13, 21, 23, 27, 31, 35, 40], "pypirc": 39, "pyspark": [31, 32], "pytest": 34, "python": [0, 1, 2, 3, 4, 5, 6, 7, 19, 32, 34, 35, 40], "python3": [39, 40], "qualiti": 26, "quantiti": [0, 5, 29], "queri": [26, 33], "quickli": [22, 23], "quickstart": [0, 37], "quit": 7, "rang": [0, 5, 22, 29], "rapid": 31, "rare": 22, "rate": [0, 1, 2, 3, 4, 7, 8, 9], "rather": [2, 31, 36], "re": [5, 21, 24, 29, 31, 33, 40], "reach": [0, 5, 6, 33], "react": 5, "reaction": 5, "read": [0, 24, 26, 33, 35, 37], "readabl": 33, "readi": [7, 33, 37, 40], "real": [5, 33], "realiti": 5, "realli": 5, "reason": [5, 22, 33], "rebas": 33, "recal": [6, 7, 22], "receiv": [20, 22], "recent": 22, "recharg": 22, "recogn": 0, "recommend": [5, 8, 22, 32], "record": [0, 5, 7, 9, 22], "recording_r": [0, 1, 2, 3, 4, 5, 7], "recoveri": 22, "rectangl": 5, "recur": 5, "red": 4, "reduc": 22, "refer": [4, 5, 7, 29, 32, 35], "referenc": [22, 29], "reflect": 3, "regard": 26, "regist": [0, 2, 5], "registr": [2, 5, 7], "registrar": [0, 2, 5, 7], "regular": [29, 35], "reimann": 5, "reject": 22, "rel": 23, "relat": [5, 33], "relationship": [0, 5], "releas": 40, "relev": 35, "reli": [29, 33], "reliabl": [22, 23], "remain": [2, 6], "remaind": 6, "rememb": 5, "remind": 0, "remov": [5, 31], "render": [0, 5], "renew": 0, "repeat": 35, "replac": [0, 5, 7], "repo": 33, "repositori": [33, 39], "repres": [0, 22, 29, 31, 35], "represent": [22, 29], "reproduc": 35, "request": 3, "requir": [5, 22, 23, 26, 31, 33], "resembl": 22, "resolut": 29, "resourc": [1, 3, 4, 6, 7, 8, 9, 22, 26, 31, 33], "respect": [2, 22], "respons": 22, "rest": 31, "restart": 5, "restor": 0, "restrict": [0, 22, 31, 33, 38], "result": [0, 1, 2, 3, 5, 6, 7, 22, 29], "resum": [0, 31], "retriev": 5, "retrospect": 29, "return": [5, 7, 29, 30, 31], "reusabl": 22, "revers": 0, "review": 22, "rf": 39, "right": [0, 1, 5, 38], "risk": 22, "rm": [33, 39], "role": 20, "root": 39, "rough": 29, "row": [1, 4, 6], "rule": 5, "run": [0, 1, 3, 5, 7, 15, 22, 23, 26, 31, 32, 34, 35, 39, 40], "runnabl": 5, "safe": [22, 33], "safeti": 24, "sai": [0, 2], "said": 35, "sake": 5, "salient": 35, "same": [0, 4, 6, 22, 26, 29], "sampl": [6, 7, 8, 9], "satisfi": 7, "save": 0, "scalar": 29, "scale": [5, 7], "scenario": 35, "schedul": [0, 13, 23, 24, 26, 36], "scienc": 23, "scratch": 8, "screenshot": [1, 4, 6], "scrutini": 22, "search": 33, "second": [0, 1, 5, 7, 8, 9, 29], "secondli": 5, "section": [1, 13, 22, 32, 35, 40], "see": [0, 1, 2, 3, 4, 5, 6, 7, 22, 33, 37, 40], "seem": 32, "seemingli": 29, "seen": 5, "segment": [0, 5, 6], "select": 7, "self": [0, 2, 5, 7, 35], "sell": 38, "semant": [22, 26], "send": 33, "sens": [5, 22], "sent": 22, "separ": [5, 22, 26, 29, 32, 33], "sequenc": [22, 36], "serial": 26, "serializedvalu": 31, "serious": 31, "serv": 36, "set": [0, 3, 5, 6, 7, 22, 29], "sever": 23, "shall": 38, "share": 22, "short": [0, 23], "shorter": 6, "shortli": 5, "should": [0, 1, 2, 3, 4, 5, 7, 22, 26, 29, 31, 32, 33, 35], "shouldn": 3, "show": [0, 5], "shown": [0, 1], "shut": 5, "side": [22, 31, 33], "sider": 29, "sift": 22, "sign": 29, "signal": 22, "sim": [8, 9], "similar": [1, 4, 22, 29], "simluat": 21, "simpl": [0, 2, 4, 5, 6, 7, 31], "simplest": 5, "simpli": [0, 2, 29], "simplic": 5, "simul": [0, 1, 4, 5, 6, 7, 15, 22, 23, 24, 29, 31, 32, 35, 36, 37], "sinc": [0, 1, 2, 3, 5, 29], "singl": [0, 5, 22, 26, 31, 33], "site": 35, "situat": 22, "skeleton": 22, "skew": 22, "skip": 22, "sky": 29, "slack": 33, "slightli": 5, "small": [22, 23], "smaller": 22, "smart": 7, "snake_cas": 31, "snippet": 34, "so": [0, 3, 4, 5, 6, 7, 22, 31, 34, 35, 38], "socket": 31, "softwar": [0, 22, 38], "solar": [22, 29], "solid": [0, 9], "some": [0, 1, 2, 5, 6, 16, 20, 21, 22, 24, 26, 31, 32, 33, 35], "someon": 31, "someth": [0, 3, 4, 5, 6, 22], "sometim": [0, 15, 22, 23], "somewhat": 22, "soon": [0, 6, 7, 11], "sort": 22, "sound": 22, "sourc": 31, "spacecraft": [0, 5, 8, 24, 29], "spaceflight": 35, "span": [5, 6, 23, 29], "spark": [31, 32], "spawn": [5, 26, 30], "special": [0, 2], "specif": [0, 22, 29, 35], "specifi": [0, 5, 22], "spell": 35, "sphinx": 35, "spice": [13, 29], "spiceypi": 19, "spin": 0, "spread": 5, "squash": 33, "src": 35, "srr_volume_simpl": 5, "ssr": [0, 1, 3, 5, 7], "ssr_max_capac": 7, "ssr_volume_polynomi": [5, 6, 7], "ssr_volume_sampl": [5, 6, 7], "ssr_volume_simpl": [5, 6], "ssr_volume_upon_rate_chang": [5, 6, 7], "ssrmaxcapac": 7, "sss": 20, "stai": [0, 5, 22], "stair": [5, 6], "standard": 29, "star": 29, "start": [4, 5, 6, 8, 9, 31, 37, 40], "starting_mag_mod": 7, "startingmagmod": 7, "state": [0, 7, 9, 22, 26], "statement": 0, "static": [0, 2, 3, 5, 7, 29], "statu": 30, "step": [0, 5, 6, 22, 26], "step_siz": 5, "stick": 31, "still": [5, 22, 35], "stop": 5, "stopwatch": [0, 5], "store": [0, 5], "stori": 33, "straightforward": [5, 7, 22], "strategi": 33, "strength": 23, "strict": 23, "strictli": 0, "string": 0, "strive": 22, "structur": [0, 27], "stub": 1, "style": [0, 31], "subject": [22, 38], "sublicens": 38, "submiss": [33, 37], "submit": 22, "subprocess": 31, "substanti": 38, "subsystem": [13, 22, 23], "subtract": 3, "succeed": 40, "success": [28, 40], "successfulli": 1, "suffici": [5, 23, 31], "suffix": 26, "suggest": 33, "suit": 36, "sum": [2, 5], "summari": 33, "sun": [22, 29], "supersed": 22, "support": [5, 11, 22], "sure": [1, 5, 6, 7, 22, 33, 39, 40], "surpris": 5, "surviv": 22, "swap": 22, "switch": 7, "sygyzi": 29, "symmetri": 29, "synod": 29, "syntact": 22, "syntax": 22, "system": [5, 15, 20, 21, 22, 23, 26, 29, 31, 40], "syzygi": 29, "t": [0, 1, 2, 3, 5, 6, 7, 11, 22, 26, 33], "take": [0, 1, 4, 5, 7, 22, 29, 30], "target": [13, 33], "task": [5, 26, 30, 31], "team": 22, "teas": 0, "technic": 35, "technologi": 38, "tele": 20, "telecom": 13, "telecommun": 20, "telemetri": 22, "tell": [0, 2, 33], "temperatur": 22, "templat": 7, "tempor": 29, "temurin": 40, "tenet": 31, "term": [29, 35], "termin": 40, "tertiari": 29, "test": [0, 4, 8, 9], "text": 35, "than": [2, 3, 5, 31, 33], "thei": [0, 1, 22, 30, 31, 33, 35], "them": [0, 5, 7, 20, 21, 22, 31, 32, 33], "theme": 35, "theori": 24, "therefor": [0, 22], "thi": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 22, 25, 26, 28, 29, 30, 31, 32, 33, 35, 38, 40], "thing": [0, 2, 5, 6, 13, 22, 28, 31, 35], "think": 0, "third": 5, "those": [0, 2, 3, 5, 6, 22, 35, 40], "though": [5, 22, 31, 33], "three": [2, 4, 5, 7], "threshold": [5, 6], "through": [0, 5, 22, 31, 33], "throughout": 5, "throw": 6, "thu": [5, 6], "ti": 5, "tightli": 22, "time": [0, 1, 2, 5, 6, 22, 23, 26, 29, 31, 33], "time_since_last_rate_chang": 5, "timelin": [0, 1, 4, 5, 6], "titlecas": 31, "to_number_in": [5, 29], "todai": [0, 33], "todo": [0, 26, 32], "togeth": [2, 5, 21, 22], "ton": 6, "tool": [5, 21, 23, 36], "toolkit": [19, 29], "top": [0, 1, 5, 7], "tort": 38, "total": [2, 5], "touch": 3, "toward": [20, 22, 35], "tox": 34, "track": [0, 2, 5, 8, 26], "tractabl": 22, "trade": 23, "tradition": [0, 26, 29], "train": 0, "trajectori": 22, "transact": 26, "transaction": 26, "transfer": 5, "transform": 0, "transmit": 22, "transmitt": 20, "trapezoid": 5, "trick": 1, "tricki": 3, "trigger": [5, 22], "trivial": 22, "true": [5, 22, 30], "truli": 5, "trust": 22, "try": [1, 4, 5, 7, 21, 22, 31], "tune": 24, "turn": [5, 22], "tutori": [0, 1, 2, 3, 4, 5, 6, 7, 10, 12, 14, 16, 17, 25, 34, 35, 40], "tweak": 7, "twine": [34, 39], "two": [0, 1, 4, 6, 7, 21, 22, 26, 29, 32, 33], "ty": 22, "type": [0, 1, 2, 3, 4, 5, 7, 22, 29, 31], "typic": [22, 23], "u": [0, 1, 2, 3, 4, 5, 6, 7], "ui": [0, 1, 2, 5, 6, 7], "ultim": 0, "uncertainti": 22, "uncondition": 22, "under": [0, 1, 2, 3, 4, 5, 6, 7, 22], "underflow": 5, "underli": 29, "underscor": 31, "understand": 22, "understood": 31, "undesir": 22, "unexpect": 22, "unfortun": 29, "unintent": 22, "uniqu": 0, "unit": [0, 3, 29], "unless": 26, "unlik": [0, 29], "unnecessari": 5, "unresolv": 33, "unsaf": 22, "unsurpris": 29, "until": [0, 4, 6, 22, 26, 31], "up": [0, 1, 2, 4, 5, 7, 16, 22, 31, 33, 35], "updat": [0, 7, 8, 9, 33], "upgrad": 22, "upload": [1, 4, 6, 7, 26, 31, 39], "upon": [8, 9], "upon_recording_rate_upd": 5, "upper": 5, "us": [0, 1, 2, 5, 6, 7, 8, 9, 13, 15, 22, 29, 32, 33, 34, 35, 37, 38], "usabl": 24, "user": [0, 3, 8, 33, 35], "usual": 22, "v": [24, 33], "valid": [0, 1, 6, 24, 36], "valu": [0, 1, 2, 4, 5, 7, 8, 9, 22, 26, 29], "var": 7, "variabl": [0, 5, 7, 26, 31, 35], "varianc": 15, "variat": [15, 23], "variou": [0, 6], "ve": 26, "vector": 22, "veri": [5, 22, 35], "verif": 22, "verifi": 22, "version": [0, 1, 5, 6, 22, 26, 33, 34], "via": [0, 7, 22, 31, 33], "viabl": 31, "view": [0, 1, 5, 6, 7, 22, 35], "violat": 36, "virtual": 40, "volum": [0, 6, 8, 9, 13], "voyag": 22, "wa": [0, 2, 5, 22, 28, 29], "wai": [1, 5, 6, 16, 22, 26, 29, 32], "wait_until": 30, "walk": 5, "want": [0, 2, 3, 5, 13, 22, 31, 33], "warn": [1, 36], "warranti": 38, "wast": [22, 26], "we": [0, 1, 2, 3, 4, 5, 6, 7, 16, 22, 26, 29, 32, 33], "week": [23, 29], "welcom": [0, 35], "well": [0, 5, 20, 22, 29, 31], "went": 33, "were": [5, 6, 22], "what": [0, 5, 6, 7, 22, 26, 32, 33, 35], "whatev": 7, "when": [0, 1, 2, 3, 4, 5, 6, 7, 16, 21, 22, 31, 33, 35], "whenev": [5, 26], "wheneverupd": 5, "where": [0, 3, 5, 22, 26, 29, 31, 35], "whether": [20, 22, 38], "which": [0, 1, 2, 3, 4, 5, 6, 7, 22, 29, 30, 31, 33], "while": [5, 22, 26, 31], "who": [5, 31, 35], "whole": [16, 22], "whom": 38, "whose": [0, 5, 29], "why": 31, "wiki": 26, "wikipedia": [26, 29], "wise": 5, "within": [0, 1, 3, 7, 8, 9, 22, 29], "without": [0, 22, 31, 38], "won": 7, "word": [0, 2], "wordpress": 26, "work": [5, 6, 22, 26, 29, 33, 35], "wors": 29, "worst": 22, "worth": 31, "would": [0, 5, 6, 21, 22, 31, 33], "wp": 26, "wrap": 5, "write": [0, 8, 16, 22, 26, 31, 33, 34, 35], "written": [0, 22], "wrong": 22, "wrote": 1, "www": [20, 40], "x": [22, 26], "y": 22, "year": 29, "yet": [1, 5, 7, 11], "yield": 29, "you": [0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 16, 24, 27, 29, 32, 33, 34, 35, 37, 40], "your": [1, 4, 5, 7, 8, 9, 13, 26, 28, 29, 32, 33, 34, 39, 40], "zero": [4, 5, 29], "zoom": 6}, "titles": ["Getting Started", "Model Test Drive", "Enumerated and Derived Resources", "Using Current Value in an Effect Model", "Second Look", "Integrating Data Rate", "Integral Method Comparison", "Sim Configuration", "Intro Tutorial: Solid State Recorder", "Tutorials", "Going further", "Build an Aerie-compatible JAR file", "Modeling Data Volume", "User Guides", "How to use pymerlin in Jupyter", "Monte-Carlo analyses", "How to organize your project", "Modeling Power", "Scheduling", "Using spice for geometry", "Modeling Telecom", "Co-Simulation", "Command Errors", "Tuning Fidelity", "Background", "Planning and Scheduling", "Discrete Event Simulation", "API Reference", "pymerlin", "pymerlin.duration", "pymerlin.model_actions", "Architecture", "Common Errors", "Contributing", "Developing pymerlin", "Documentation", "Glossary", "pymerlin", "License", "Publishing to pypi", "Quickstart"], "titleterms": {"1": 5, "2": 5, "3": 5, "4": 5, "But": 31, "The": 26, "about": 31, "activ": [0, 5, 22], "aeri": [11, 31, 35], "aerospac": 35, "an": [3, 11, 22], "analys": 15, "api": [27, 28, 29, 30], "approach": 31, "architectur": 31, "assum": 35, "async": 31, "audienc": 35, "autonom": 22, "avoid": 22, "await": 31, "background": 24, "base": 5, "build": [11, 33, 34], "carlo": 15, "chang": [5, 22], "circular": 32, "class": 29, "co": 21, "code": [33, 37], "command": 22, "commit": 33, "common": 32, "comparison": 6, "compat": 11, "configur": 7, "content": [28, 29, 30], "contribut": [33, 37], "creat": 0, "current": 3, "data": [5, 12, 28, 29], "deriv": [2, 5], "develop": 34, "discret": 26, "do": 22, "document": 35, "drive": 1, "durat": 29, "effect": 3, "enumer": 2, "error": [22, 32], "event": 26, "feedback": 37, "fidel": 23, "file": [11, 16, 22], "first": 0, "from": 5, "function": [28, 30], "further": [10, 21], "geometri": 19, "get": [0, 37], "glossari": [35, 36], "go": 10, "good": 33, "got": 33, "guarante": 22, "guid": 13, "guidelin": 33, "help": 37, "how": [14, 16, 22, 37], "idiom": 31, "import": 32, "importerror": 32, "increas": 5, "instal": [0, 40], "integr": [5, 6, 22], "intro": 8, "jar": [11, 34], "jupyt": 14, "knowledg": 35, "licens": 38, "look": 4, "make": 22, "method": [5, 6, 22], "mission": 0, "model": [0, 1, 3, 12, 17, 20], "model_act": 30, "modul": [29, 30], "mont": 15, "organ": 16, "over": 31, "packag": 28, "partial": 22, "perform": 31, "plan": [22, 25], "polynomi": 5, "power": 17, "pr": 33, "practic": 33, "problem": 33, "program": 35, "project": 16, "provid": 37, "publish": 39, "pull": 33, "pymerlin": [0, 14, 28, 29, 30, 33, 34, 37], "pypi": 39, "python": 31, "question": 33, "quickstart": 40, "rate": 5, "re": 22, "read": 21, "record": 8, "refer": 27, "referenc": 35, "request": 33, "resourc": [0, 2, 5], "review": 33, "round": 31, "safeti": 22, "sampl": 5, "schedul": [18, 25], "second": 4, "sim": 7, "simul": [21, 26], "solid": 8, "sourc": 37, "spacecraft": 22, "spice": 19, "stack": 32, "start": 0, "state": 8, "style": 35, "submit": 33, "submodul": 28, "subsystem": 16, "target": 35, "telecom": 20, "test": [1, 34], "theori": 26, "thread": 31, "trace": 32, "trip": 31, "tune": 23, "tutori": [8, 9], "updat": 5, "upon": 5, "us": [3, 14, 19, 31], "usabl": 22, "user": 13, "v": [22, 31], "valid": 22, "valu": 3, "volum": [5, 12], "what": 31, "within": 5, "you": 22, "your": [0, 16]}}) \ No newline at end of file diff --git a/pymerlin/_internal/_directive_type.py b/pymerlin/_internal/_directive_type.py index 16d63e0..22a118c 100644 --- a/pymerlin/_internal/_directive_type.py +++ b/pymerlin/_internal/_directive_type.py @@ -1,5 +1,7 @@ from pymerlin._internal._globals import models_by_id from pymerlin._internal._input_type import InputType +from pymerlin._internal._serialized_value import from_map_str_serialized_value +from pymerlin._internal._spawn_helpers import activity_wrapper from pymerlin._internal._task import Task from pymerlin._internal._task_factory import TaskFactory @@ -18,7 +20,8 @@ def getOutputType(self): return None def getTaskFactory(self, model_id, args): - return TaskFactory(lambda: Task(self.gateway, models_by_id[model_id], self.activity, args, self.input_topic, self.output_topic)) + task_provider = lambda: activity_wrapper(self.activity, from_map_str_serialized_value(self.gateway, args), models_by_id[model_id][0], self.input_topic, self.output_topic) + return TaskFactory(lambda: Task(self.gateway, models_by_id[model_id][1], task_provider)) class Java: implements = ["gov.nasa.jpl.aerie.merlin.protocol.model.DirectiveType"] diff --git a/pymerlin/_internal/_model_type.py b/pymerlin/_internal/_model_type.py index bf34f60..ca25e6e 100644 --- a/pymerlin/_internal/_model_type.py +++ b/pymerlin/_internal/_model_type.py @@ -8,9 +8,8 @@ from pymerlin._internal._output_type import OutputType from pymerlin._internal._registrar import Registrar from pymerlin._internal._resource import Resource -from pymerlin._internal._task import Task, get_topics +from pymerlin._internal._task import Task from pymerlin._internal._task_factory import TaskFactory -from pymerlin._internal._task_specification import TaskSpecification class ModelType: @@ -30,13 +29,15 @@ def set_gateway(self, gateway): def instantiate(self, start_time, config, builder): registrar = Registrar() - def spawn(child: TaskSpecification): - new_task = Task(self.gateway, (self.model, self.model_type), child, child.args, *get_topics(self.model_type, child.func)) + def spawn(coro): + new_task = Task(self.gateway, self, None) builder.daemon(TaskFactory(lambda: new_task)) with _context(None, spawner=spawn): model = self.model_class(registrar) + model._model_type = self + default_cell_type = CellType(self.gateway) for cell_ref, initial_value, evolution in registrar.cells: cell_type = default_cell_type if evolution is None else CellType(self.gateway, evolution=evolution) diff --git a/pymerlin/_internal/_spawn_helpers.py b/pymerlin/_internal/_spawn_helpers.py new file mode 100644 index 0000000..82a9094 --- /dev/null +++ b/pymerlin/_internal/_spawn_helpers.py @@ -0,0 +1,15 @@ +from pymerlin._internal import _globals + + +async def activity_wrapper(task, args, model, input_topic, output_topic): + if input_topic is not None: + _globals._current_context[0].emit(args, input_topic) + await task.__call__(model, **args) + if output_topic is not None: + _globals._current_context[0].emit({}, output_topic) + +def get_topics(model_type, func): + for activity_func, input_topic, output_topic in model_type.activity_types: + if activity_func is func: + return input_topic, output_topic + return None, None diff --git a/pymerlin/_internal/_task.py b/pymerlin/_internal/_task.py index 8ab104c..003f480 100644 --- a/pymerlin/_internal/_task.py +++ b/pymerlin/_internal/_task.py @@ -13,23 +13,19 @@ class Task: - def __init__(self, gateway, model, activity, args, input_topic=None, output_topic=None): + def __init__(self, gateway, model_type, task_provider): self.gateway = gateway - self.model, self.model_type = model + self.model_type = model_type self.continuation = None self.task_handle = None self.loop = None - self.task_provider = lambda: activity_wrapper(activity, model[0], - from_map_str_serialized_value(gateway, args), - input_topic, output_topic) + self.task_provider = task_provider def step(self, scheduler): - def spawn(child: TaskSpecification | Coroutine): - if type(child) == TaskSpecification: - new_task = Task(self.gateway, (self.model, self.model_type), child, child.args, *get_topics(self.model_type, child.func)) - scheduler.spawn(self.gateway.jvm.gov.nasa.jpl.aerie.merlin.protocol.types.InSpan.Fresh, TaskFactory(lambda: new_task)) - else: - raise Exception(repr(type(child)) + " is not currently supported by spawn") + def spawn(task_provider): + new_task = Task(self.gateway, self.model_type, task_provider) + scheduler.spawn(self.gateway.jvm.gov.nasa.jpl.aerie.merlin.protocol.types.InSpan.Fresh, + TaskFactory(lambda: new_task)) with _context(scheduler, spawn): if self.continuation is None: self.loop = asyncio.new_event_loop() @@ -54,7 +50,7 @@ def spawn(child: TaskSpecification | Coroutine): if type(result) == Awaiting: return TaskStatus.awaiting(self.gateway, Condition(self.gateway, result.condition), self) if type(result) == Calling: - new_task = Task(self.gateway, (self.model, self.model_type), result.child, {}, *get_topics(self.model_type, result.child.func)) + new_task = Task(self.gateway, self.model_type, result.child) return TaskStatus.calling(self.gateway, self.gateway.jvm.gov.nasa.jpl.aerie.merlin.protocol.types.InSpan.Fresh, TaskFactory(lambda: new_task), self) raise Exception("Invalid response from task") @@ -70,18 +66,6 @@ async def exit(self): class Java: implements = ["gov.nasa.jpl.aerie.merlin.protocol.model.Task"] -async def activity_wrapper(task, model, args, input_topic, output_topic): - if input_topic is not None: - _globals._current_context[0].emit({}, input_topic) - await task.__call__(model, **args) - if output_topic is not None: - _globals._current_context[0].emit({}, output_topic) - -def get_topics(model_type, func): - for activity_func, input_topic, output_topic in model_type.activity_types: - if activity_func is func: - return input_topic, output_topic - return None, None def run_task(loop, task_provider): future = loop.create_future() diff --git a/pymerlin/model_actions.py b/pymerlin/model_actions.py index 3af9fa1..b6f85a1 100644 --- a/pymerlin/model_actions.py +++ b/pymerlin/model_actions.py @@ -8,6 +8,11 @@ import pymerlin._internal._task_status import pymerlin.duration import pymerlin._internal._globals +from pymerlin._internal._spawn_helpers import activity_wrapper, get_topics +from pymerlin._internal._task_specification import TaskSpecification + + +# from pymerlin._internal._task import activity_wrapper, get_topics async def delay(duration): @@ -18,16 +23,32 @@ async def delay(duration): return await _yield_with(pymerlin._internal._task_status.Delayed(duration)) -def spawn(child): +def spawn(model, child): """ :param coro: :return: """ - pymerlin._internal._globals._current_context[1](child) + if type(child) is TaskSpecification: + task_provider = lambda: activity_wrapper( + child, + child.args, + model, + *get_topics(model._model_type, child.func)) + pymerlin._internal._globals._current_context[1](task_provider) + else: + pymerlin._internal._globals._current_context[1](lambda: child) -async def call(child): - return await _yield_with(pymerlin._internal._task_status.Calling(child)) +async def call(model, child): + if type(child) is TaskSpecification: + task_provider = lambda: activity_wrapper( + child, + child.args, + model, + *get_topics(model._model_type, child.func)) + return await _yield_with(pymerlin._internal._task_status.Calling(task_provider)) + else: + return await _yield_with(pymerlin._internal._task_status.Calling(lambda: child)) async def wait_until(condition): diff --git a/tests/test_simulation.py b/tests/test_simulation.py index b05062e..096f208 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -1,14 +1,13 @@ import pytest +from py4j.java_gateway import Py4JJavaError from pymerlin import MissionModel +from pymerlin import Schedule +from pymerlin import simulate, Span from pymerlin._internal._decorators import Validation, ValidationResult from pymerlin._internal._registrar import Registrar from pymerlin.duration import Duration, SECONDS -from pymerlin import simulate, Span from pymerlin.model_actions import delay, spawn, call, wait_until -from pymerlin import Schedule, Directive - -from py4j.java_gateway import Py4JJavaError @MissionModel @@ -18,6 +17,7 @@ def __init__(self, registrar: Registrar): self.counter = registrar.cell(0) self.linear = registrar.cell((0, 1), evolution=linear_evolution) + def linear_evolution(x, d): initial = x[0] rate = x[1] @@ -25,24 +25,6 @@ def linear_evolution(x, d): return initial + delta, rate -class LinearCell: - def __init__(self, initial, rate_per_second): - self.initial = initial - self.rate_per_second = rate_per_second - - def step(self, duration): - self.initial += duration.times(self.rate_per_second * 1_000_000) - - def duplicate(self): - return LinearCell(self.initial, self.rate_per_second) - - - -def line(initial, rate_per_second): - return LinearCell(initial, rate_per_second) - - - @TestMissionModel.ActivityType async def noop(mission): pass @@ -135,7 +117,7 @@ def test_spawn_activity(): @TestMissionModel.ActivityType async def activity(mission: TestMissionModel): mission.counter.set(123) - spawn(other_activity(mission=mission)) + spawn(mission, other_activity(mission=mission)) mission.counter.set(345) assert mission.counter.get() == 345 @@ -159,13 +141,13 @@ def test_spawn_task(): @TestMissionModel.ActivityType async def activity(mission: TestMissionModel): mission.counter.set(123) - spawn(anonymous_task(mission=mission)) + spawn(None, subtask(mission=mission)) mission.counter.set(345) assert mission.counter.get() == 345 await delay("00:00:05") assert mission.counter.get() == 678 - async def anonymous_task(mission: TestMissionModel): + async def subtask(mission: TestMissionModel): assert mission.counter.get() == 123 await delay("00:00:01") assert mission.counter.get() == 345 @@ -184,7 +166,7 @@ def test_call(): @TestMissionModel.ActivityType async def activity(mission: TestMissionModel): mission.counter.set(123) - await call(other_activity(mission)) + await call(mission, other_activity(mission)) assert mission.counter.get() == 345 await delay("00:00:01") @@ -201,6 +183,30 @@ async def other_activity(mission: TestMissionModel): Span("other_activity", Duration.ZERO, Duration.SECOND)] +def test_call_task(): + """ + Check that calling a child tas creates no new spans, and that the parent resumes after the child finishes + """ + + @TestMissionModel.ActivityType + async def activity(mission: TestMissionModel): + mission.counter.set(123) + await call(mission, subtask(mission)) + assert mission.counter.get() == 345 + await delay("00:00:01") + + async def subtask(mission: TestMissionModel): + assert mission.counter.get() == 123 + await delay("00:00:01") + assert mission.counter.get() == 123 + mission.counter.set(345) + + profiles, spans, events = simulate(TestMissionModel, Schedule.build(("00:00:00", activity())), + "24:00:00") + assert spans == [Span("activity", Duration.ZERO, Duration.of(2, SECONDS)),] + + + def test_discrete_condition(): """ Check that a task is resumed correctly when a condition becomes true