Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #85: Set initial storage level #87

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bsk_rl/envs/general_satellite_tasking/simulation/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,12 +841,15 @@ def _set_instrument(
self.task_name, self.instrument, ModelPriority=priority
)

@default_args(dataStorageCapacity=20 * 8e6, storageUnitValidCheck=True)
@default_args(
dataStorageCapacity=20 * 8e6, storageUnitValidCheck=True, storageInit=0
)
def _set_storage_unit(
self,
dataStorageCapacity: int,
priority: int = 699,
storageUnitValidCheck: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still work how we wanted with the change to integers? I think so, but not sure if the floating point error was part of that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. The storage is not supposed to go over its limit anymore due to changes in the baseStorageUnit module (using integers and how it checks for free space). But storageValidCheck will still check if the storage unit is at its maximum capacity. So, I believe it still has the expected behavior.

storageInit: int = 0,
**kwargs,
) -> None:
"""Configure the storage unit and its buffers.
Expand All @@ -856,13 +859,15 @@ def _set_storage_unit(
priority: Model priority.
storageUnitValidCheck: If True, check that the storage level is below the
storage capacity.
setStorageInit: Initial storage level [bits]
"""
self.storageUnit = simpleStorageUnit.SimpleStorageUnit()
self.storageUnit.ModelTag = "storageUnit" + self.satellite.id
self.storageUnit.storageCapacity = dataStorageCapacity # bits
self.storageUnit.addDataNodeToModel(self.instrument.nodeDataOutMsg)
self.storageUnit.addDataNodeToModel(self.transmitter.nodeDataOutMsg)
self.storageUnitValidCheck = storageUnitValidCheck
self.storageUnit.setDataBuffer(storageInit)

# Add the storage unit to the transmitter
self.transmitter.addStorageUnitToTransmitter(
Expand Down