Here is a basic example of a tilter code for the System C35CX Compac for food packaging in modified atmosphere (M.A.P.):
“`c
#include
SC_MODULE(Tilter) {
// Inputs
sc_in start;
sc_in stop;
sc_in tilt_up;
sc_in tilt_down;
// Outputs
sc_out tilt_up_active;
sc_out tilt_down_active;
sc_out tilt_up_done;
sc_out tilt_down_done;
// Internal variables
bool is_tilting_up;
bool is_tilting_down;
// Constructor
SC_CTOR(Tilter) {
// Register process for tilter functionality
SC_THREAD(tilterProcess);
sensitive << start.pos();
}
// Tilter process
void tilterProcess() {
// Initialize internal variables
is_tilting_up = false;
is_tilting_down = false;
while (true) {
wait();
// Check if start signal is received
if (start) {
while (true) {
// Check if stop signal is received
if (stop) {
stopTilting();
break;
}
// Check if tilt up signal is received
if (tilt_up && !is_tilting_up && !is_tilting_down) {
tiltUp();
}
// Check if tilt down signal is received
if (tilt_down && !is_tilting_down && !is_tilting_up) {
tiltDown();
}
// Simulate tilting process
if (is_tilting_up) {
// Implement tilting up functionality here
// Simulate tilting duration
wait(10, SC_MS);
stopTilting();
}
if (is_tilting_down) {
// Implement tilting down functionality here
// Simulate tilting duration
wait(10, SC_MS);
stopTilting();
}
}
}
}
}
// Stop tilting process
void stopTilting() {
is_tilting_up = false;
is_tilting_down = false;
tilt_up_active.write(false);
tilt_down_active.write(false);
tilt_up_done.write(false);
tilt_down_done.write(false);
}
// Start tilt up process
void tiltUp() {
is_tilting_up = true;
tilt_up_active.write(true);
tilt_down_active.write(false);
tilt_up_done.write(false);
tilt_down_done.write(false);
}
// Start tilt down process
void tiltDown() {
is_tilting_down = true;
tilt_up_active.write(false);
tilt_down_active.write(true);
tilt_up_done.write(false);
tilt_down_done.write(false);
}
};
```
This code defines a `Tilter` module in SystemC that receives input signals `start`, `stop`, `tilt_up`, and `tilt_down` from the System C35CX Compac machine. It also provides output signals `tilt_up_active`, `tilt_down_active`, `tilt_up_done`, and `tilt_down_done` to indicate the current state of the tilter.
The tilter process is implemented in the `tilterProcess` function, which waits for the `start` signal and then continuously checks for other signals. If the `stop` signal is received, the tilter process stops tilting. If the `tilt_up` signal is received and the tilter is not currently tilting, it starts the tilt up process. Similarly, if the `tilt_down` signal is received and the tilter is not currently tilting, it starts the tilt down process.
The tilting functionality is simulated by waiting for a fixed duration of 10 milliseconds in this example. You can replace the corresponding sections with the actual implementation for tilting up and tilting down in your System C35CX Compac machine.
The `stopTilting`, `tiltUp`, and `tiltDown` functions handle the state changes and update the output signals accordingly.
Please note that this is a basic example and you may need to modify it according to your specific requirements and the functionality of the System C35CX Compac machine.Packing System
#System #C35CX #Compac #food #packaging #modified #atmosphere #M.A.P