package FoldableDrill {
	private import Hierarchy::*;
	private import ScalarValues::*;

	enum def Enum_1 {
		enum OPEN;
		enum CLOSE;
	}

	enum def Enum_2 {
		enum OPEN;
		enum CLOSE;
		enum IDLE;
	}

	part def FoldableDrill {
		in attribute command : Enum_1;

		part drill : Drill;
		part cavity : DrillCavity;
		part controller : Controller;
		bind command = controller.command;
		connect drill.sensed_value to controller.drill_sensed_value;
		connect cavity.sensed_value to controller.door_sensed_value;
		connect controller.drill_operation to drill.operation;
		connect controller.door_operation to cavity.operation;
	}

	part def Drill {
		in attribute operation : Enum_2;
		out attribute sensed_value : Integer;

		part hinge : DrillFoldHinge;
		part drill_motor : ElectricMotor;
		part drill_angle_sensor : AngleSensor;
		connect hinge.percentage to drill_angle_sensor.value;
		connect drill_motor.torque to hinge.torque;
		bind drill_angle_sensor.sensed_value = sensed_value;
		bind operation = drill_motor.operation;
	}

	part def DrillFoldHinge {
		in attribute torque : Integer;
		out attribute percentage : Integer;

	}

	part def ElectricMotor {
		in attribute operation : Enum_2;
		out attribute torque : Integer;

	}

	part def AngleSensor {
		in attribute value : Integer;
		out attribute sensed_value : Integer;

	}

	part def DrillCavity {
		in attribute operation : Enum_2;
		out attribute sensed_value : Integer;

		part door : DrillCavityDoor;
		part door_motor : ElectricMotor;
		part door_angle_sensor : AngleSensor;
		connect door.percentage to door_angle_sensor.value;
		connect door_motor.torque to door.torque;
		bind door_angle_sensor.sensed_value = sensed_value;
		bind operation = door_motor.operation;
	}

	part def DrillCavityDoor {
		in attribute torque : Integer;
		out attribute percentage : Integer;

	}

	part def Controller {
		in attribute command : Enum_1;
		in attribute drill_sensed_value : Integer;
		in attribute door_sensed_value : Integer;
		out attribute drill_operation : Enum_2;
		out attribute door_operation : Enum_2;

	}

	part foldableDrill : FoldableDrill, SystemComponent {
	}
}