diff --git a/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.cpp b/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.cpp index 8b5464cb45..a028f2f69d 100644 --- a/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.cpp +++ b/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.cpp @@ -171,8 +171,8 @@ void DataStorageUnitBase::integrateDataStatus(double currentTime){ //! - if a dataNode exists in storedData vector, integrate and add to current amount if (index != -1) { //! Only perform if this operation will not take the sum below zero - if ((this->storedData[(size_t) index].dataInstanceSum + it->baudRate * (this->currentTimestep)) >= 0) { - this->storedData[(size_t) index].dataInstanceSum += round(it->baudRate * (this->currentTimestep)); + if ((this->storedData[(size_t) index].dataInstanceSum + it->baudRate * this->currentTimestep) >= 0) { + this->storedData[(size_t) index].dataInstanceSum += round(it->baudRate * this->currentTimestep); } //! - if a dataNode does not exist in storedData, add it to storedData, integrate baud rate, and add amount } @@ -213,7 +213,7 @@ int DataStorageUnitBase::messageInStoredData(DataNodeUsageMsgPayload *tmpNodeMsg /*! Sums all of the data in the storedData vector @return double */ -long long int DataStorageUnitBase::sumAllData(){ +int64_t DataStorageUnitBase::sumAllData(){ double dataSum = 0; std::vector::iterator it; @@ -253,7 +253,7 @@ bool DataStorageUnitBase::customReadMessages() @param data //Amount of data to add to the partition @return void */ -void DataStorageUnitBase::setDataBuffer(std::string partitionName, long long int data) +void DataStorageUnitBase::setDataBuffer(std::string partitionName, int64_t data) { dataInstance tmpDataInstance; @@ -288,4 +288,4 @@ void DataStorageUnitBase::setDataBuffer(std::string partitionName, long long int //! - Sum all data in storedData vector this->storedDataSum = this->sumAllData(); -} \ No newline at end of file +} diff --git a/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.h b/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.h index a466b93dea..623424634b 100644 --- a/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.h +++ b/src/simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.h @@ -34,7 +34,7 @@ struct dataInstance { char dataInstanceName[128]; //!< data instance name - long long int dataInstanceSum; //!< data instance sum value, bits + int64_t dataInstanceSum; //!< data instance sum value, bits }; //!< Struct for instances of data stored in a buffer. Includes names and amounts. /*! @brief on-board data handling base class */ @@ -45,7 +45,7 @@ class DataStorageUnitBase: public SysModel { void Reset(uint64_t CurrentSimNanos); void addDataNodeToModel(Message *tmpNodeMsg); //!< Adds dataNode to the storageUnit void UpdateState(uint64_t CurrentSimNanos); - void setDataBuffer(std::string partitionName, long long int data); //!< Adds/removes the data from the partitionName partition once + void setDataBuffer(std::string partitionName, int64_t data); //!< Adds/removes the data from the partitionName partition once protected: void writeMessages(uint64_t CurrentClock); @@ -55,18 +55,18 @@ class DataStorageUnitBase: public SysModel { virtual void customWriteMessages(uint64_t CurrentClock); //!< custom Write method, similar to customSelfInit. virtual bool customReadMessages(); //!< Custom read method, similar to customSelfInit; returns `true' by default. int messageInStoredData(DataNodeUsageMsgPayload *tmpNodeMsg); //!< Returns index of the dataName if it's already in storedData - long long int sumAllData(); //!< Sums all of the data in the storedData vector + int64_t sumAllData(); //!< Sums all of the data in the storedData vector public: std::vector> nodeDataUseInMsgs; //!< Vector of data node input message names Message storageUnitDataOutMsg; //!< Vector of message names to be written out by the storage unit - long long int storageCapacity; //!< Storage capacity of the storage unit + int64_t storageCapacity; //!< Storage capacity of the storage unit BSKLogger bskLogger; //!< logging variable protected: DataStorageStatusMsgPayload storageStatusMsg; //!< class variable std::vector nodeBaudMsgs; //!< class variable - long long int storedDataSum; //!< [bits] Stored data in bits. + int64_t storedDataSum; //!< [bits] Stored data in bits. std::vector storedData; //!< Vector of data. Represents the makeup of the data buffer. double previousTime; //!< Previous time used for integration double currentTimestep;//!< [s] Timestep duration in seconds. diff --git a/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.cpp b/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.cpp index 86c3da297f..7ceebe3168 100644 --- a/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.cpp +++ b/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.cpp @@ -68,10 +68,10 @@ void PartitionedStorageUnit::addPartition(std::string dataName){ @param data //Vector of data to be added to each partition in partitionNames @return void */ -void PartitionedStorageUnit::setDataBuffer(std::vector partitionNames, std::vector data){ +void PartitionedStorageUnit::setDataBuffer(std::vector partitionNames, std::vector data){ for (int i = 0; i < partitionNames.size(); i++) { PartitionedStorageUnit::DataStorageUnitBase::setDataBuffer(partitionNames[i], data[i]); } -} \ No newline at end of file +} diff --git a/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.h b/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.h index d7814563a5..305c6a3716 100644 --- a/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.h +++ b/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.h @@ -30,7 +30,7 @@ class PartitionedStorageUnit: public DataStorageUnitBase { PartitionedStorageUnit(); ~PartitionedStorageUnit(); void addPartition(std::string dataName); - void setDataBuffer(std::vector partitionNames, std::vector data); //!< Adds/removes the data from the partitionNames partitions + void setDataBuffer(std::vector partitionNames, std::vector data); //!< Adds/removes the data from the partitionNames partitions private: void customReset(uint64_t CurrentClock) override; diff --git a/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.i b/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.i index 2c5810fdf9..6e80dd8749 100644 --- a/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.i +++ b/src/simulation/onboardDataHandling/storageUnit/partitionedStorageUnit.i @@ -39,15 +39,15 @@ from Basilisk.architecture.swig_common_model import * // giving a type error when assigning storageCapacity or adding data through // setDataBuffer. This maps that float and vector of floats to long int in // C++ in this module. -%typemap(in) long long int { - $1 = static_cast(PyFloat_AsDouble($input)); +%typemap(in) int64_t { + $1 = static_cast(PyFloat_AsDouble($input)); } -%typemap(in) std::vector (std::vector temp) { +%typemap(in) std::vector (std::vector temp) { size_t size = PyList_Size($input); temp.reserve(size); for (size_t i = 0; i < size; ++i) { PyObject* item = PyList_GetItem($input, i); - temp.push_back(static_cast(PyFloat_AsDouble(item))); + temp.push_back(static_cast(PyFloat_AsDouble(item))); } $1 = temp; } diff --git a/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.cpp b/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.cpp index 761f975b13..8243196df1 100644 --- a/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.cpp +++ b/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.cpp @@ -65,8 +65,8 @@ void SimpleStorageUnit::integrateDataStatus(double currentTime){ } else if ((this->storedDataSum + round(it->baudRate * this->currentTimestep) < this->storageCapacity) || (it->baudRate <= 0)){ //! - Only perform the operation if it will not result in less than 0 data - if ((this->storedData[0].dataInstanceSum + it->baudRate * (this->currentTimestep)) >= 0){ - this->storedData[0].dataInstanceSum += round(it->baudRate * (this->currentTimestep)); + if ((this->storedData[0].dataInstanceSum + it->baudRate * this->currentTimestep) >= 0){ + this->storedData[0].dataInstanceSum += round(it->baudRate * this->currentTimestep); } } this->netBaud += it->baudRate; @@ -84,7 +84,7 @@ void SimpleStorageUnit::integrateDataStatus(double currentTime){ @param data //Data to be added to the "STORED DATA" partition @return void */ -void SimpleStorageUnit::setDataBuffer(long long int data){ +void SimpleStorageUnit::setDataBuffer(int64_t data){ std::string partitionName = "STORED DATA"; SimpleStorageUnit::DataStorageUnitBase::setDataBuffer(partitionName, data); -} \ No newline at end of file +} diff --git a/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.h b/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.h index e64deedd1b..c98056abc3 100644 --- a/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.h +++ b/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.h @@ -30,7 +30,7 @@ class SimpleStorageUnit: public DataStorageUnitBase { public: SimpleStorageUnit(); ~SimpleStorageUnit(); - void setDataBuffer(long long int data); //!< Method to add/remove data from the storage unit once + void setDataBuffer(int64_t data); //!< Method to add/remove data from the storage unit once private: void customReset(uint64_t CurrentClock); //!< Custom Reset method diff --git a/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.i b/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.i index f5c0345bba..d173c8508f 100644 --- a/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.i +++ b/src/simulation/onboardDataHandling/storageUnit/simpleStorageUnit.i @@ -36,8 +36,8 @@ from Basilisk.architecture.swig_common_model import * //When using scientific notation in Python (1E9), it is interpreted as float // giving a type error when assigning storageCapacity or using setDataBuffer. // This maps that float to long int in C++ in this module. -%typemap(in) long long int { - $1 = static_cast(PyFloat_AsDouble($input)); +%typemap(in) int64_t { + $1 = static_cast(PyFloat_AsDouble($input)); } %include "simulation/onboardDataHandling/_GeneralModuleFiles/dataStorageUnitBase.h"