Correction TP1
Wtf ._.
This commit is contained in:
1
Testing/Temporary/CTestCostData.txt
Normal file
1
Testing/Temporary/CTestCostData.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
---
|
||||||
3
Testing/Temporary/LastTest.log
Normal file
3
Testing/Temporary/LastTest.log
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Start testing: Oct 06 13:14 CEST
|
||||||
|
----------------------------------------------------------
|
||||||
|
End testing: Oct 06 13:14 CEST
|
||||||
@@ -7,14 +7,9 @@
|
|||||||
<Cursor1 position="0" topLine="116" />
|
<Cursor1 position="0" topLine="116" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="src/ItemStock.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="0" topLine="24" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="src/Processor.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="src/Processor.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="2418" topLine="48" />
|
<Cursor1 position="2504" topLine="60" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="src/ProductionOrder.hpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="src/ProductionOrder.hpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
@@ -24,7 +19,7 @@
|
|||||||
</File>
|
</File>
|
||||||
<File name="src/Processor.hpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="1" zoom_2="0">
|
<File name="src/Processor.hpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="1" zoom_2="0">
|
||||||
<Cursor>
|
<Cursor>
|
||||||
<Cursor1 position="2316" topLine="58" />
|
<Cursor1 position="1175" topLine="15" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
<File name="src/Machine.hpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
<File name="src/Machine.hpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
@@ -32,4 +27,9 @@
|
|||||||
<Cursor1 position="0" topLine="6" />
|
<Cursor1 position="0" topLine="6" />
|
||||||
</Cursor>
|
</Cursor>
|
||||||
</File>
|
</File>
|
||||||
|
<File name="src/ItemStock.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="0" topLine="24" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
</CodeBlocks_layout_file>
|
</CodeBlocks_layout_file>
|
||||||
|
|||||||
Binary file not shown.
@@ -1008,5 +1008,4 @@ src/CMakeFiles/factory_core.dir/Processor.cpp.o: \
|
|||||||
/usr/include/c++/13/cxxabi.h \
|
/usr/include/c++/13/cxxabi.h \
|
||||||
/usr/include/x86_64-linux-gnu/c++/13/bits/cxxabi_tweaks.h \
|
/usr/include/x86_64-linux-gnu/c++/13/bits/cxxabi_tweaks.h \
|
||||||
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/Machine.hpp \
|
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/Machine.hpp \
|
||||||
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/ProductionOrder.hpp \
|
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/ProductionOrder.hpp
|
||||||
/usr/include/c++/13/iostream
|
|
||||||
|
|||||||
@@ -25,110 +25,112 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Processor.hpp"
|
#include "Processor.hpp"
|
||||||
#include <iostream> // TODO: Remove this when debug is over
|
|
||||||
|
|
||||||
namespace artis::factory {
|
namespace artis::factory {
|
||||||
|
|
||||||
void Processor::dint(const Time & /* t */) {
|
void Processor::dint(const Time & t) {
|
||||||
// Fonction que gère les évolutions internes de ce modèle
|
switch (_phase) {
|
||||||
switch(this->currentState){
|
case Phase::INIT: {
|
||||||
|
_phase = Phase::WAIT;
|
||||||
case ProcessorState::LOADING:
|
|
||||||
//if ProcessorParameters.load_time > t
|
|
||||||
this->currentState = ProcessorState::PROCESSING;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProcessorState::PROCESSING:
|
|
||||||
//if ProcessorParameters.processing_time > t
|
|
||||||
this->currentState = ProcessorState::UNLOADING;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ProcessorState::UNLOADING:
|
|
||||||
//if ProcessorParameters.unloading_time > t
|
|
||||||
this->currentState = ProcessorState::READY;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ProcessorState::READY:
|
|
||||||
this->currentState = ProcessorState::WAIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
case Phase::READY:
|
||||||
|
_po.reset(nullptr);
|
||||||
|
_phase = Phase::WAIT;
|
||||||
|
break;
|
||||||
|
case Phase::WAIT:
|
||||||
|
assert(false);
|
||||||
|
break;
|
||||||
|
case Phase::LOADING: {
|
||||||
|
_phase = Phase::PROCESSING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Phase::PROCESSING: {
|
||||||
|
_phase = Phase::UNLOADING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Phase::UNLOADING: {
|
||||||
|
_phase = Phase::READY;
|
||||||
|
|
||||||
void Processor::dext(const Time &t, const Time &e, const Bag &bag) {
|
#ifdef WITH_TRACE
|
||||||
std::for_each(bag.begin(), bag.end(), [this, t, e](const ExternalEvent &event) { // [this] capture this et le remet dans la lambda
|
Trace::trace()
|
||||||
// Fonction gérant les réponses du système aux évents passés via event()
|
<< TraceElement(get_name(), t,
|
||||||
|
artis::common::FormalismType::PDEVS,
|
||||||
|
artis::common::FunctionType::DELTA_INT,
|
||||||
|
artis::common::LevelType::USER)
|
||||||
|
<< "FINISH po = " << _po->to_string();
|
||||||
|
Trace::trace().flush();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Processor::dext(const Time &t, const Time & /* e */, const Bag &bag) {
|
||||||
|
std::for_each(bag.begin(), bag.end(), [this, t](const ExternalEvent &event) {
|
||||||
|
if (event.port_index() == inputs::IN) {
|
||||||
uint8_t *data = nullptr;
|
uint8_t *data = nullptr;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
assert(_po == nullptr);
|
||||||
|
|
||||||
event.data()(data);
|
event.data()(data);
|
||||||
this->currentPO = std::make_unique<ProductionOrder>(data, event.data().size());
|
_po = std::make_unique<ProductionOrder>(data, event.data().size());
|
||||||
|
_phase = Phase::LOADING;
|
||||||
|
|
||||||
this->currentState = this->ProcessorState::LOADING;
|
#ifdef WITH_TRACE
|
||||||
|
|
||||||
#ifdef WITH_TRACE
|
|
||||||
Trace::trace()
|
Trace::trace()
|
||||||
<< TraceElement(get_name(), t,
|
<< TraceElement(get_name(), t,
|
||||||
artis::common::FormalismType::PDEVS,
|
artis::common::FormalismType::PDEVS,
|
||||||
artis::common::FunctionType::DELTA_EXT,
|
artis::common::FunctionType::DELTA_EXT,
|
||||||
artis::common::LevelType::USER)
|
artis::common::LevelType::USER)
|
||||||
<< "this->currentPO = " << this->currentPO->to_string();
|
<< "START po = " << _po->to_string();
|
||||||
Trace::trace().flush();
|
Trace::trace().flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Processor::start(const Time &t) {
|
void Processor::start(const Time & /* t */) {
|
||||||
// Démarrage et initialisation
|
// TODO
|
||||||
|
_phase = Phase::INIT;
|
||||||
this->currentState = this->ProcessorState::WAIT; // Prêt à recevoir un Production Order
|
|
||||||
this->startTime = t;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Time Processor::ta(const Time &t) const {
|
Time Processor::ta(const Time & /* t */) const {
|
||||||
// Temps passé dans l'état actuel
|
// TODO
|
||||||
// Inspiré de Router
|
switch (_phase) {
|
||||||
switch(this->currentState){
|
case Phase::INIT:
|
||||||
|
case Phase::READY:
|
||||||
case ProcessorState::WAIT:
|
return 0;
|
||||||
|
case Phase::WAIT:
|
||||||
return artis::common::DoubleTime::infinity;
|
return artis::common::DoubleTime::infinity;
|
||||||
|
case Phase::LOADING:
|
||||||
case ProcessorState::LOADING:
|
return _parameters.load_time;
|
||||||
//return ProcessorParameters.load_time; // I can't understand how to find, use, get or do anything with this var...
|
case Phase::PROCESSING:
|
||||||
return t+0;
|
return _parameters.processing_time;
|
||||||
|
case Phase::UNLOADING:
|
||||||
case ProcessorState::PROCESSING:
|
return _parameters.unload_time;
|
||||||
//return ProcessorParameters.processing_time;
|
|
||||||
return t+0;
|
|
||||||
|
|
||||||
case ProcessorState::UNLOADING:
|
|
||||||
//return ProcessorParameters.unload_time;
|
|
||||||
return t+0;
|
|
||||||
|
|
||||||
case ProcessorState::READY:
|
|
||||||
return artis::common::DoubleTime::infinity;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return t+0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return artis::common::DoubleTime::infinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bag Processor::lambda(const Time & /* t */) const {
|
Bag Processor::lambda(const Time & /* t */) const {
|
||||||
Bag bag;
|
Bag bag;
|
||||||
// L'ensemble des sorties de cet objet
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
if (_phase == Phase::READY) {
|
||||||
|
bag.push_back(ExternalEvent(outputs::OUT, common::event::Value(_po->_buffer, _po->_size)));
|
||||||
|
}
|
||||||
return bag;
|
return bag;
|
||||||
}
|
}
|
||||||
|
|
||||||
artis::common::event::Value Processor::observe(const Time & /* t */, unsigned int /* index */) const {
|
artis::common::event::Value Processor::observe(const Time & /* t */, unsigned int /* index */) const {
|
||||||
// Print de l'état actuel ?
|
return {};
|
||||||
return {"Hello World ?"};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace artis::factory
|
} // namespace artis::factory
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Processor(const std::string &name, const Context<Processor, ProcessorParameters> &context)
|
Processor(const std::string &name, const Context<Processor, ProcessorParameters> &context)
|
||||||
: Dynamics<Processor, ProcessorParameters>(name, context) {
|
: Dynamics<Processor, ProcessorParameters>(name, context), _parameters(context.parameters()) {
|
||||||
input_port({inputs::IN, "in"});
|
input_port({inputs::IN, "in"});
|
||||||
output_port({outputs::OUT, "out"});
|
output_port({outputs::OUT, "out"});
|
||||||
}
|
}
|
||||||
@@ -78,21 +78,43 @@ public:
|
|||||||
|
|
||||||
artis::common::event::Value observe(const Time &t, unsigned int index) const override;
|
artis::common::event::Value observe(const Time &t, unsigned int index) const override;
|
||||||
|
|
||||||
enum ProcessorState{
|
private:
|
||||||
|
|
||||||
|
struct Phase {
|
||||||
|
enum values {
|
||||||
INIT,
|
INIT,
|
||||||
|
READY,
|
||||||
WAIT,
|
WAIT,
|
||||||
LOADING,
|
LOADING,
|
||||||
PROCESSING,
|
PROCESSING,
|
||||||
UNLOADING,
|
UNLOADING
|
||||||
READY
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
static std::string to_string(const values &value) {
|
||||||
// TODO (state)
|
switch (value) {
|
||||||
ProcessorState currentState = ProcessorState::INIT;
|
case INIT:
|
||||||
std::unique_ptr<ProductionOrder> currentPO;
|
return "INIT";
|
||||||
Time startTime = 0;
|
case READY:
|
||||||
Time stepTime = 0;
|
return "READY";
|
||||||
|
case WAIT:
|
||||||
|
return "WAIT";
|
||||||
|
case LOADING:
|
||||||
|
return "LOADING";
|
||||||
|
case PROCESSING:
|
||||||
|
return "PROCESSING";
|
||||||
|
case UNLOADING:
|
||||||
|
return "UNLOADING";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// parameters
|
||||||
|
ProcessorParameters _parameters;
|
||||||
|
|
||||||
|
// state
|
||||||
|
Phase::values _phase;
|
||||||
|
std::unique_ptr<ProductionOrder> _po;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace artis::factory
|
} // namespace artis::factory
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
57557
test/PoolRouter.csv
57557
test/PoolRouter.csv
File diff suppressed because it is too large
Load Diff
BIN
test/test_json
BIN
test/test_json
Binary file not shown.
Reference in New Issue
Block a user