devs-eval-2026/DEVS-Eval huggingface dataset:
Task (Elaboration / Tagged Block (Output)): Implement the sensor output events: add the objects to the corresponding output ports (outPowerLevel, outVisualPerception, etc).
Solution: <%
    output.add(outPowerLevel, powerLevel);
%>!
output event for s1
<%
    output.add(outVisualPerception, perception);
%>!
output event for s2
<%
    output.add(outCapture, image);
%>!
output event for s3
<%
    output.add(outCoordinate, crowdCoordinate);
%>!
Task (Elaboration / Data Type): Define a composite object DroneCoordinate with the attributes x (Abscissa) and y (Ordinate), and declare the corresponding variable.
Solution: A Abscissa has a value!
the range of Abscissa's value is Integer!
use abscissa with type Abscissa!
A Ordinate has a value!
the range of Ordinate's value is Integer!
use ordinate with type Ordinate!
A DroneCoordinate has x and y!
the range of DroneCoordinate's x is Abscissa!
the range of DroneCoordinate's y is Ordinate!
use droneCoordinate with type DroneCoordinate!
Task (Elaboration / Data Type): Define a WaterDepth object with a value attribute of type Integer and declare the corresponding variable.
Solution: A WaterDepth has a value! the range of WaterDepth's value is Integer! use waterDepth with type WaterDepth!
Task (Elaboration / Data Type): Define a WaterThreshold object with a value attribute of type Integer and declare the corresponding variable.
Solution: A WaterThreshold has a value! the range of WaterThreshold's value is Integer! use waterThreshold with type WaterThreshold!
Task (Elaboration / Data Type): Define a DistanceFlown object with a value attribute of type Integer and declare the corresponding variable.
Solution: A DistanceFlown has a value! the range of DistanceFlown's value is Integer! use distanceFlown with type DistanceFlown!
Task (Elaboration / Tagged Block (Init)): Initialize the drone's variables: instantiate Abscissa, Ordinate, DroneCoordinate, WaterDepth, PowerThreshold, DistanceFlown, Image, WaterThreshold, and PowerLevel with a value of 0.
Solution: Initialize variables
<%
java.util.Random generator = new java.util.Random(); //in case of necessity to coordinate generation
int number1 = generator.nextInt(10);
int number2 = generator.nextInt(10);
 abscissa = new Abscissa(new Integer(0));
 ordinate = new Ordinate(new Integer(0));
 droneCoordinate = new DroneCoordinate(new Abscissa(new Integer(0)),new Ordinate(new Integer(0)));
 waterDepth = new WaterDepth(new Integer(0));
 powerThreshold = new PowerThreshold(new Integer(0));
 distanceFlown = new DistanceFlown(new Integer(0));
 image = new Image(new String(),new String());
 waterThreshold = new WaterThreshold(new Integer(0));
 powerLevel = new PowerLevel(new Integer(0));
%>!
Task (Protocol / Port Configuration): Configure the drone to generate output on the Water (WaterDepth), PowerLevel (PowerLevel), Coordinate (DroneCoordinate), and Capture (Image) ports.
Solution: generates output on Water with type WaterDepth!
generates output on PowerLevel with type PowerLevel!
generates output on Coordinate with type DroneCoordinate!
generates output on Capture with type Image!
Task (FDEVS / Cyclic State Machine): Define a cycle s0→s1→s2→s3→s4→s0 where s0 lasts 2 units and the others 1 unit, with outputs in s0, s1, s2, and s3.
Solution: to start hold in s0 for time 2!
after s0 output Water!
from s0 go to s1!
hold in s1 for time 1!
after s1 output PowerLevel!
from s1 go to s2!
hold in s2 for time 1!
after s2 output Coordinate!
from s2 go to s3!
hold in s3 for time 1!
after s3 output Capture!
from s3 go to s4!
hold in s4 for time 1!
from s4 go to s0!
output event for s0
Task (Elaboration / Tagged Block (Output)): Implement the drone's output events: add the objects to the outWater, outPowerLevel, outCoordinate, and outCapture ports.
Solution: <%
    output.add(outWater, waterDepth);
%>!
output event for s1
<%
    output.add(outPowerLevel, powerLevel);
%>!
output event for s2
<%
    output.add(outCoordinate, droneCoordinate);
%>!
output event for s3
<%
    output.add(outCapture, image);
%>!
Task (Elaboration / Variables): Declare four integer counters: countCoordinateReceived, countVisualPerceptionReceived, countperceptionThreshold, and countCaptureReceived.
Solution: use countCoordinateReceived with type int!
use countVisualPerceptionReceived with type int!
use countperceptionThreshold with type int!
use countCaptureReceived with type int!
use mS4MESimulationInterface with type MS4MESimulationInterface!
Task (Elaboration / Variables): Declare a variable mS4MESimulationInterface of type MS4MESimulationInterface.
Solution: use mS4MESimulationInterface with type MS4MESimulationInterface!
Task (Elaboration / Library Import): Add Java libraries (Date, Random, ArrayList, Math) and the DEVS AtomicModel interface.
Solution: add library
<%
import java.util.Date;
import java.util.Calendar;
import java.util.Random;
import java.util.ArrayList;
import static java.lang.Math.*;
import com.ms4systems.devs.core.model.AtomicModel;
%>!
Task (Elaboration / Tagged Block (Init)): Locate the MS4MESimulationInterface instance in the children of the parent model and register the current node.
Solution: Initialize variables
<%
for(AtomicModel e : getParent().getChildren()) {
	if(e instanceof MS4MESimulationInterface) {
		mS4MESimulationInterface = (MS4MESimulationInterface) e;
	}
}
if(mS4MESimulationInterface != null) {
	mS4MESimulationInterface.newNode(this);
}
 java.util.Random generator = new java.util.Random(); //in case of necessity to coordinate generation
 int number1 = generator.nextInt(10);
 int number2 = generator.nextInt(10);
 abscissa = new Abscissa(new Integer(0));
 ordinate = new Ordinate(new Integer(0));
 crowdCoordinate = new CrowdCoordinate(new Abscissa(new Integer(0)),new Ordinate(new Integer(0)));
 image = new Image(new String(),new String());
 powerLevel = new PowerLevel(new Integer(0));
 powerThreshold = new PowerThreshold(new Integer(0));
 perception = new Perception(new Integer(0), new Integer(0),new Integer(6));
 perceptionThreshold = new PerceptionThreshold(new Integer(0));
%>!
Task (Protocol / Port Configuration): Set input/output ports for VisualPerception and Capture, and input only for PowerLevel and Coordinate.
Solution: accepts input on PowerLevel with type PowerLevel!							
accepts input on VisualPerception with type Perception!							
generates output on VisualPerception with type Perception!	        			
accepts input on Capture with type Image!							
generates output on Capture with type Image!	        			
accepts input on Coordinate with type CrowdCoordinate!
Task (FDDEVS / Mixed State Machine): Define sequence s0→s1→s2→s3 (1 unit). s3 waits for Coordinate for s4; s4 waits for VisualPerception for s5.
Solution: to start 
hold in s0 for time 1!
from s0 go to s1! //UNOBSERVABLE : FIXME: system/mediator/architecture parameters may change this guard!         
hold in s1 for time 1!
from s1 go to s2! //UNOBSERVABLE : Valuing         
hold in s2 for time 1!
from s2 go to s3! //UNOBSERVABLE :          
passivate in s3!
when in s3 and receive Coordinate go to s4!
passivate in s4!
when in s4 and receive VisualPerception go to s5!
hold in s5 for time 1!
after s5 output VisualPerception!
Task (FDDEVS / Mixed State Machine): In s5, emit VisualPerception. If the threshold is reached, wait for Capture in s7; otherwise, repeat cycle s9→s2.
Solution: from s5 go to s6!                
hold in s6 for time 1!
from s6 go to s7! //UNOBSERVABLE : IfThenElseBehavior (true case)         
passivate in s7!
when in s7 and receive Capture go to s8!
hold in s8 for time 1!
after s8 output Capture!
from s8 go to s9!                
hold in s9 for time 1!
from s9 go to s2! //UNOBSERVABLE : Repeat loop         
external event for s3 with Coordinate
Task (Elaboration / External Event): In state s3, upon receiving Coordinate, increment the counter, record the rendezvous, and store the data.
Solution: <%
countCoordinateReceived++;
mS4MESimulationInterface.rendezvous(messageList.get(0).getMessageTrace().getPort(), 
	inCoordinate,
	messageList.get(0).getData().hashCode());
crowdCoordinate = messageList.get(0).getData();
%>!
Task (Elaboration / External Event): In state s4, upon receiving VisualPerception, increment the counter, record the rendezvous, and store the perception.
Solution: external event for s4 with VisualPerception
<%
countVisualPerceptionReceived++;
mS4MESimulationInterface.rendezvous(messageList.get(0).getMessageTrace().getPort(), 
	inVisualPerception,
	messageList.get(0).getData().hashCode());
perception = messageList.get(0).getData();
%>!
Task (Elaboration / External Event): In state s7, upon receiving Capture, increment the counter, record the rendezvous, and store the image.
Solution: external event for s7 with Capture
<%
countCaptureReceived++;
mS4MESimulationInterface.rendezvous(messageList.get(0).getMessageTrace().getPort(), 
	inCapture,
	messageList.get(0).getData().hashCode());
image = messageList.get(0).getData();
%>!
Task (Elaboration / Tagged Block (Internal)): In the internal event of s1, instantiate PowerThreshold (20) and PerceptionThreshold (4).
Solution: internal event for s1
<%
powerThreshold = new PowerThreshold(new Integer(20));
perceptionThreshold = new PerceptionThreshold(new Integer(4));
%>!
Task (Elaboration / Non-deterministic): In s6, if the perception reaches the threshold, increment the counter and go to s7; otherwise, go to s9 for 1 unit.
Solution: internal event for s6
<%
if(perception.getValue() >= perceptionThreshold.getValue()) {
	countperceptionThreshold++;
	passivateIn("s7");
}
else {
	holdIn("s9",1.0);
}
%>!
Task (FDDEVS / Dynamic Removal): Configure the model to accept 'Remove' in any state, going to RemoveC, which emits the model itself.
Solution: when in s0 and receive Remove go to RemoveC!
when in s1 and receive Remove go to RemoveC!
when in s2 and receive Remove go to RemoveC!
when in s3 and receive Remove go to RemoveC!
when in s4 and receive Remove go to RemoveC!
when in s5 and receive Remove go to RemoveC!
when in s6 and receive Remove go to RemoveC!
when in s7 and receive Remove go to RemoveC!
when in s8 and receive Remove go to RemoveC!
when in s9 and receive Remove go to RemoveC!

generates output on Remove with type AtomicModelImpl!
hold in RemoveC for time 1!
after RemoveC output Remove!
from RemoveC go to RemoveC!
Task (Elaboration / Additional Code): Add metadata: isMediator = false and typeCons = "Crowd" as public constants.
Solution: add additional code
<%
public final boolean isMediator = false;
public final String typeCons = "Crowd";
%>!
Task (Elaboration / Additional Code): Implement writeCountersData() to save the counters in a CSV in the "result" folder and reset them.
Solution: add additional code
<%
	private File getSrcModelsDirectory() {
		URI dirUri = null;
		File dir = null;
		try {
			dirUri = this.getClass().getResource(".").toURI();
			dir = new File(dirUri);
		} catch (URISyntaxException e) {
		}
		while (dir != null && dir.getParentFile() != null) {
			if (dir.getName().equalsIgnoreCase("bin")) {
				return new File(dir.getParentFile(), "src/Models");
			}
			dir = dir.getParentFile();
		}
		return null;
	}
	public void writeCountersData() {
		String dirPath = getSrcModelsDirectory().getAbsolutePath() + "/result";
		
		if(!new File(dirPath).exists()) {
		new File(dirPath).mkdir();
	}
	try{
		BufferedWriter writer = new BufferedWriter(new FileWriter(dirPath + "/Result.csv",true));
		writer.write(getName() + ";");
		writer.write("countCoordinateReceived = " + Integer.toString(countCoordinateReceived) + ";");
		countCoordinateReceived = 0;
		writer.write("countVisualPerceptionReceived = " + Integer.toString(countVisualPerceptionReceived) + ";");
		countVisualPerceptionReceived = 0;
		writer.write("countCaptureReceived = " + Integer.toString(countCaptureReceived) + ";");
		countCaptureReceived = 0;
		writer.write("countperceptionThreshold = " + Integer.toString(countperceptionThreshold) + ";");
		countperceptionThreshold = 0;
		writer.newLine();
		writer.close();
	}catch(Exception e) {}
	}
%>!
Task (Protocol / Port Configuration): Set up the model to accept input in VisualPerception and Capture, and produce output only in Alert (Image type).
Solution: accepts input on VisualPerception with type Perception! accepts input on Capture with type Image! generates output on Alert with type Image!
Task (FDDEVS / Mixed State Machine): Define the sequence s0→s1→s2→s3. s3 waits for VisualPerception for s4. s4 decides: if it reaches the threshold, it waits for Capture in s5; otherwise, s7→s2.
Solution: to start 
hold in s0 for time 1!
from s0 go to s1! //UNOBSERVABLE : FIXME: system/mediator/architecture parameters may change this guard! 	
hold in s1 for time 1!
from s1 go to s2! //UNOBSERVABLE : Valuing 	
hold in s2 for time 1!
from s2 go to s3! //UNOBSERVABLE :  	
passivate in s3!
when in s3 and receive VisualPerception go to s4!
hold in s4 for time 1!
from s4 go to s5! //UNOBSERVABLE : IfThenElseBehavior (true case) 	
passivate in s5!
when in s5 and receive Capture go to s6!
hold in s6 for time 1!
after s6 output Alert!
from s6 go to s7!		
hold in s7 for time 1!
from s7 go to s2! //UNOBSERVABLE : Repeat loop
Task (Elaboration / Non-deterministic): In the internal event of s4, if the perception reaches the threshold, increment the counter and go to s5; otherwise, go to s7 for 1 unit.
Solution: internal event for s4
<%
if(perception.getValue() >= perceptionThreshold.getValue()) {
	countperceptionThreshold++;
	passivateIn("s5");
}
else {
	holdIn("s7",1.0);
}
%>!
Task (Elaboration / Tagged Block (Output)): In the exit event of state s6, add the image object to the outAlert port.
Solution: output event for s6 <% output.add(outAlert, image); %>!
Task (Elaboration / Additional Code): Declare the model metadata: isMediator = false and typeCons = "CrowdGateway".
Solution: add additional code <% public final boolean isMediator = false; public final String typeCons = "CrowdGateway"; %>!
Task (Elaboration / Additional Code): Implement writeCountersData() saving the three counters in CSV and resetting them after writing.
Solution: add additional code
<%
	private File getSrcModelsDirectory() {
		URI dirUri = null;
		File dir = null;
		try {
			dirUri = this.getClass().getResource(".").toURI();
			dir = new File(dirUri);
		} catch (URISyntaxException e) {
		}
		while (dir != null && dir.getParentFile() != null) {
			if (dir.getName().equalsIgnoreCase("bin")) {
				return new File(dir.getParentFile(), "src/Models");
			}
			dir = dir.getParentFile();
		}
		return null;
	}
	public void writeCountersData() {
		String dirPath = getSrcModelsDirectory().getAbsolutePath() + "/result";
		
		if(!new File(dirPath).exists()) {
		new File(dirPath).mkdir();
	}
	try{
		BufferedWriter writer = new BufferedWriter(new FileWriter(dirPath + "/Result.csv",true));
		writer.write(getName() + ";");
		writer.write("countVisualPerceptionReceived = " + Integer.toString(countVisualPerceptionReceived) + ";");
		countVisualPerceptionReceived = 0;
		writer.write("countCaptureReceived = " + Integer.toString(countCaptureReceived) + ";");
		countCaptureReceived = 0;
		writer.write("countperceptionThreshold = " + Integer.toString(countperceptionThreshold) + ";");
		countperceptionThreshold = 0;
		writer.newLine();
		writer.close();
	}catch(Exception e) {}
	}
%>!
Task (FDDEVS / Dynamic Removal): Configure the model to accept the message "Remove" in states s0 to s7, always transitioning to the state RemoveC.
Solution: when in s0 and receive Remove go to RemoveC!
when in s1 and receive Remove go to RemoveC!
when in s2 and receive Remove go to RemoveC!
when in s3 and receive Remove go to RemoveC!
when in s4 and receive Remove go to RemoveC!
when in s5 and receive Remove go to RemoveC!
when in s6 and receive Remove go to RemoveC!
when in s7 and receive Remove go to RemoveC!

generates output on Remove with type AtomicModelImpl!
hold in RemoveC for time 1!
after RemoveC output Remove!
from RemoveC go to RemoveC!
Task (Protocol / Port Configuration): Set up the model to accept typed inputs in Remove and untyped inputs in ReorganizeArchitecture and various Add commands.
Solution: accepts input on Remove with type AtomicModelImpl!
accepts input on ReorganizeArchitecture!
accepts input on AddSensor!
accepts input on AddGateway!
accepts input on AddCrowd!
accepts input on AddCrowdGateway!
accepts input on AddDrone!
accepts input on AddDroneBasis!
Task (Elaboration / Variables): Declare control variables: toRemove, auxRecConst (list), flagAddData (bool), simulationTime (long), and syncCount (int).
Solution: use toRemove with type AtomicModelImpl!
use auxRecConst with type ArrayList<AtomicModelImpl>!
use flagAddData with type boolean!
use simulationTime with type long!
use syncCount with type int!
use sensors with type ArrayList<AtomicModelImpl>!
use gateways with type ArrayList<AtomicModelImpl>!
use transmitters with type ArrayList<AtomicModelImpl>!
use drones with type ArrayList<AtomicModelImpl>!
use droneBasiss with type ArrayList<AtomicModelImpl>!
use droneTransmitters with type ArrayList<AtomicModelImpl>!
use crowds with type ArrayList<AtomicModelImpl>!
use crowdGateways with type ArrayList<AtomicModelImpl>!
use crowdTransmitters with type ArrayList<AtomicModelImpl>!

use mS4MESimulationInterface with type MS4MESimulationInterface!
Task (Elaboration / Variables): Declare nine ArrayList<AtomicModelImpl> lists for categories such as sensors, gateways, drones, crowds, etc.
Solution: use toRemove with type AtomicModelImpl!
use auxRecConst with type ArrayList<AtomicModelImpl>!
use flagAddData with type boolean!
use simulationTime with type long!
use syncCount with type int!
use sensors with type ArrayList<AtomicModelImpl>!
use gateways with type ArrayList<AtomicModelImpl>!
use transmitters with type ArrayList<AtomicModelImpl>!
use drones with type ArrayList<AtomicModelImpl>!
use droneBasiss with type ArrayList<AtomicModelImpl>!
use droneTransmitters with type ArrayList<AtomicModelImpl>!
use crowds with type ArrayList<AtomicModelImpl>!
use crowdGateways with type ArrayList<AtomicModelImpl>!
use crowdTransmitters with type ArrayList<AtomicModelImpl>!

use mS4MESimulationInterface with type MS4MESimulationInterface!
Task (Elaboration / Additional Code): Declare public static fields for shared lists and private static counters for each type of constituent.
Solution: add additional code
<%
public static ArrayList<AtomicModelImpl> originalConstituents;
public static ArrayList<AtomicModelImpl> constituents;
public static ArrayList<Connection> connections;
private static int contRecSensor;
private static int contRecGateway;
private static int contRecTransmitter;
private static int contRecDrone;
private static int contRecDroneBasis;
private static int contRecDroneTransmitter;
private static int contRecCrowd;
private static int contRecCrowdGateway;
private static int contRecCrowdTransmitter;
%>!
Task (FDDEVS / Controller SM): Set the initial state w8AddOrRemove as passive, which absorbs all structural control messages.
Solution: to start passivate in w8AddOrRemove!
when in w8AddOrRemove and receive WriteData go to sendWriteData!
when in w8AddOrRemove and receive Remove go to w8AddOrRemove!
when in w8AddOrRemove and receive ReorganizeArchitecture go to w8AddOrRemove!
when in w8AddOrRemove and receive AddSensor go to w8AddOrRemove!
when in w8AddOrRemove and receive AddGateway go to w8AddOrRemove!
when in w8AddOrRemove and receive AddCrowd go to w8AddOrRemove!
when in w8AddOrRemove and receive AddCrowdGateway go to w8AddOrRemove!
when in w8AddOrRemove and receive AddDrone go to w8AddOrRemove!
when in w8AddOrRemove and receive AddDroneBasis go to w8AddOrRemove!
Task (FDDEVS / Controller SM): After sendWriteData (1u), emit WriteData and go to sendContinue (1u), which emits Continue and returns to the beginning.
Solution: hold in sendWriteData for time 1!
after sendWriteData output WriteData!
from sendWriteData go to sendContinue!
hold in sendContinue for time 1!
after sendContinue output Continue!
from sendContinue go to w8AddOrRemove!
Task (Elaboration / Tagged Block (Init)): Initialize the DRC: instantiate lists, clear log files, capture the initial time, and locate the simulation interface.
Solution: initialize variables
<%
syncCount = 1;
sensors = new ArrayList<AtomicModelImpl>();
gateways = new ArrayList<AtomicModelImpl>();
transmitters = new ArrayList<AtomicModelImpl>();
drones = new ArrayList<AtomicModelImpl>();
droneBasiss = new ArrayList<AtomicModelImpl>();
droneTransmitters = new ArrayList<AtomicModelImpl>();
crowds = new ArrayList<AtomicModelImpl>();
crowdGateways = new ArrayList<AtomicModelImpl>();
crowdTransmitters = new ArrayList<AtomicModelImpl>();
flagAddData = true;
constituents = new ArrayList<AtomicModelImpl>();
connections = new ArrayList<Connection>();
new File("Result/Result.txt").delete();
simulationTime = System.currentTimeMillis();

for(AtomicModel e : getParent().getChildren()) {
	if(e instanceof MS4MESimulationInterface) {
		mS4MESimulationInterface = (MS4MESimulationInterface) e;
	}
}
if(originalConstituents == null) 
	originalConstituents = initializeConstituents();
%>!
Task (Elaboration / External Event): In the w8AddOrRemove state, upon receiving ReorganizeArchitecture, execute the reorganization operator.
Solution: external event for w8AddOrRemove with ReorganizeArchitecture <% reorganizationOperator(); %>!
Task (Elaboration / External Event): In the w8AddOrRemove state, upon receiving Remove, extract the model and execute the deletion operator.
Solution: external event for w8AddOrRemove with Remove <% toRemove = (AtomicModelImpl) messageList.get(0).getData(); deletionOperator(toRemove); %>!
Task (Elaboration / External Event): Implement six external events for adding constituents, calling additionOperator() with the string of the corresponding type.
Solution: external event for w8AddOrRemove with AddSensor <% additionOperator("sensor"); %>!