<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
<X3D profile='Immersive' version='3.3 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' http://www.web3d.org/specifications/x3d-3.3.xsd '>
<head>
<meta name='titlecontent='SeaWebBuoyPrototype.x3d'/>
<meta name='descriptioncontent='A prototype of a SeaWeb buoy.'/>
<meta name='creatorcontent='Oliver Tan and Don Brutzman'/>
<meta name='createdcontent='3 June 2004'/>
<meta name='modifiedcontent='20 October 2019'/>
<meta name='subjectcontent='Buoy, SeaWeb'/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyPrototype.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!-- -->
<Scene>
<ExternProtoDeclare name='AcousticTransmissionCylinderappinfo='AcousticTransmissionCylinder visualizes the pulse width of cylindrical propagation with has a receding inner radius and a (maximum outer radius .'
  url=' "AcousticTransmissionCylinderPrototype.x3d#AcousticTransmissionCylinder" "https://savage.nps.edu/Savage/CommunicationsAndSensors/SeaWeb/AcousticTransmissionCylinderPrototype.x3d#AcousticTransmissionCylinder" "AcousticTransmissionCylinderPrototype.wrl#AcousticTransmissionCylinder" "https://savage.nps.edu/Savage/CommunicationsAndSensors/SeaWeb/AcousticTransmissionCylinderPrototype.wrl#AcousticTransmissionCylinder" '>
<field name='startTransmissiontype='SFBoolaccessType='inputOnly'
 appinfo='Upon receipt of a boolean true event start a single (not continuous) transmission'/>

<field name='startContinuousTransmissionstype='SFBoolaccessType='inputOnly'
 appinfo='Upon receipt of a boolean true event start continuous transmissions'/>

<field name='set_rangetype='SFFloataccessType='inputOnly'
 appinfo='Propagation range in meters'/>

<field name='defaultRangetype='SFFloataccessType='initializeOnly'
 appinfo='Default propagation range in meters'/>

<field name='transmissionPropagationSpeedtype='SFFloataccessType='initializeOnly'
 appinfo='Speed in meters / second'/>

<field name='set_transmissionDurationtype='SFFloataccessType='inputOnly'
 appinfo='Duration in seconds'/>

<field name='transmissionDurationtype='SFFloataccessType='initializeOnly'
 appinfo='Duration in seconds'/>

<field name='heighttype='SFFloataccessType='initializeOnly'
 appinfo='Height of cylinder in meters'/>

<field name='set_colortype='SFColoraccessType='inputOnly'
 appinfo='Color of cylinder'/>

<field name='colortype='SFColoraccessType='initializeOnly'
 appinfo='Default color of cylinder'/>

<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
<field name='beamCounttype='SFInt32accessType='initializeOnly'
 appinfo='number of segmented sections in 360-degree cylindrical beam'/>

<field name='set_beamCounttype='SFInt32accessType='inputOnly'
 appinfo='Number of segmented sections in 360-degree cylindrical beam'/>
</ExternProtoDeclare>
<ExternProtoDeclare name='BeamCylinderappinfo='Produce wireframe or transparent beam cylinders. Typical uses include propeller/thruster water flow or line-of-sight sonar/radar/light beams. Negative range values invert base and apex at same relative location. Default: beam with apex at (0 0 0) and base of radius 1 in x-z plane at (1 0 0).'
  url=' "../../CommunicationsAndSensors/Beam/BeamCylinderPrototype.x3d#BeamCylinder" "https://savage.nps.edu/Savage/CommunicationsAndSensors/Beam/BeamCylinderPrototype.x3d#BeamCylinder" "../../CommunicationsAndSensors/Beam/BeamCylinderPrototype.wrl#BeamCylinder" "https://savage.nps.edu/Savage/CommunicationsAndSensors/Beam/BeamCylinderPrototype.wrl#BeamCylinder" '>
<field name='contacttype='SFBoolaccessType='inputOnly'
 appinfo='(communications) is transmitted signal in contact with receiver or (sensor) is a target return detected?'/>

<field name='rangetype='SFFloataccessType='inputOnly'
 appinfo='distance in meters along x axis'/>

<field name='defaultRangetype='SFFloataccessType='initializeOnly'
 appinfo='distance in meters used until eventIn range sent'/>

<field name='wireframetype='SFBoolaccessType='initializeOnly'
 appinfo='whether wireframe beam is drawn'/>

<field name='solidtype='SFBoolaccessType='initializeOnly'
 appinfo='whether solid beam is drawn'/>

<field name='beamHeighttype='SFFloataccessType='initializeOnly'
 appinfo='meters across vertical y axis'/>

<field name='beamWidthtype='SFFloataccessType='initializeOnly'
 appinfo='meters across horizontal z axis'/>

<field name='contactColortype='SFColoraccessType='initializeOnly'
 appinfo='rendering color when contact=true'/>

<field name='noContactColortype='SFColoraccessType='initializeOnly'
 appinfo='rendering color when contact=false'/>

<field name='transparencytype='SFFloataccessType='inputOutput'
 appinfo='1 = fully transparent wireframe only'/>
</ExternProtoDeclare>
<ExternProtoDeclare name='FlyingTextappinfo='Visualize message transfer between two points as flying text'
  url=' "../../../Savage/Tools/Animation/FlyingTextPrototype.x3d#FlyingText" "https://savage.nps.edu/Savage/Tools/Animation/FlyingTextPrototype.x3d#FlyingText" "../../../Savage/Tools/Animation/FlyingTextPrototype.wrl#FlyingText" "https://savage.nps.edu/Savage/Tools/Animation/FlyingTextPrototype.wrl#FlyingText" '>
<field name='waypointstype='MFVec3faccessType='initializeOnly'/>
<field name='set_waypointstype='MFVec3faccessType='inputOnly'/>
<field name='timeIntervalstype='MFTimeaccessType='initializeOnly'/>
<field name='set_timeIntervalstype='MFTimeaccessType='inputOnly'/>
<field name='textMessagetype='MFStringaccessType='initializeOnly'/>
<field name='set_textMessagetype='MFStringaccessType='inputOnly'/>
<field name='visibletype='SFBoolaccessType='initializeOnly'/>
<field name='set_visibletype='SFBoolaccessType='inputOnly'/>
<field name='looptype='SFBoolaccessType='initializeOnly'/>
<field name='axisOfRotationtype='SFVec3faccessType='initializeOnly'/>
<field name='timeSensorEnabledtype='SFBoolaccessType='initializeOnly'/>
<field name='startTimetype='SFTimeaccessType='inputOutput'/>
<field name='set_startTimetype='SFTimeaccessType='inputOnly'/>
<field name='stopTimetype='SFTimeaccessType='inputOutput'/>
<field name='set_stopTimetype='SFTimeaccessType='inputOnly'/>
<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
<field name='textDiffuseColortype='SFColoraccessType='inputOutput'/>
<field name='fontStyletype='SFNodeaccessType='inputOutput'/>
</ExternProtoDeclare>
<ExternProtoDeclare name='TimeDelaySensorappinfo='TimeSensor functionality commences after delayInterval pause'
  url=' "../../../Savage/Tools/Animation/TimeDelaySensorPrototype.x3d#TimeDelaySensor" "https://savage.nps.edu/Savage/Tools/Animation/TimeDelaySensorPrototype.x3d#TimeDelaySensor" "../../../Savage/Tools/Animation/TimeDelaySensorPrototype.wrl#TimeDelaySensor" "https://savage.nps.edu/Savage/Tools/Animation/TimeDelaySensorPrototype.wrl#TimeDelaySensor" '>
<field name='startTimetype='SFTimeaccessType='inputOutput'/>
<field name='enabledtype='SFBoolaccessType='inputOutput'/>
<field name='delayIntervaltype='SFTimeaccessType='inputOutput'
 appinfo='seconds'/>

<field name='delayCompleteTimetype='SFTimeaccessType='outputOnly'/>
<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
</ExternProtoDeclare>
<ProtoDeclare name='SeaWebBuoyappinfo='SeaWeb acoustic-radio gateway communications buoy'>
<ProtoInterface>
<field name='set_positiontype='SFVec3faccessType='inputOnly'
 appinfo='Position of buoy.'/>

<field name='positiontype='SFVec3fvalue='0 0 0accessType='initializeOnly'
 appinfo='Position of buoy.'/>

<field name='set_targetPositiontype='SFVec3faccessType='inputOnly'
 appinfo='Position of target of transmission.'/>

<field name='targetPositiontype='SFVec3fvalue='0 0 0accessType='initializeOnly'
 appinfo='Position of target of transmission.'/>

<field name='set_targetIdNumbertype='SFInt32accessType='inputOnly'
 appinfo='Id number of target.'/>

<field name='targetIdNumbertype='SFInt32value='-1accessType='initializeOnly'
 appinfo='Id number of target.'/>

<field name='set_enabledtype='SFBoolaccessType='inputOnly'
 appinfo='Enable buoy for transmission.'/>

<field name='enabledtype='SFBoolvalue='trueaccessType='initializeOnly'
 appinfo='Enable buoy for transmission.'/>

<field name='set_activatedtype='SFBoolaccessType='inputOnly'
 appinfo='Start transmission.'/>

<field name='activatedtype='SFBoolvalue='falseaccessType='initializeOnly'
 appinfo='Start transmission.'/>

<field name='set_transmissionDurationtype='SFFloataccessType='inputOnly'
 appinfo='Duration in seconds needed to transmit message (does not include transmissionTimeDelay or propagation delay).'/>

<field name='transmissionDurationtype='SFFloatvalue='5accessType='initializeOnly'
 appinfo='Duration in seconds needed to transmit message (does not include transmissionTimeDelay or propagation delay).'/>

<field name='set_transmissionTimeDelaytype='SFTimeaccessType='inputOnly'
 appinfo='Time delay before transmission begins.'/>

<field name='transmissionTimeDelaytype='SFTimevalue='2accessType='initializeOnly'
 appinfo='Time delay before transmission begins.'/>

<field name='set_directionalTransmissiontype='SFBoolaccessType='inputOnly'
 appinfo='Select between directional (true) or omni-directional (false) transmission.'/>

<field name='directionalTransmissiontype='SFBoolvalue='falseaccessType='initializeOnly'
 appinfo='Select between directional (true) or omni-directional (false) transmission.'/>

<field name='set_buoyTypetype='SFStringaccessType='inputOnly'
 appinfo='Determine which buoy type to use. "Racom" for Racom Buoy. "Telesonar" for Telesonar Repeater.'/>

<field name='buoyTypetype='SFStringvalue='RacomaccessType='initializeOnly'
 appinfo='Determine which buoy type to use. "Racom" for Racom Buoy. "Telesonar" for Telesonar Repeater.'/>

<field name='set_soundSpeedInWatertype='SFFloataccessType='inputOnly'
 appinfo='Sound speed in water default value 1500 m/s'/>

<field name='soundSpeedInWatertype='SFFloatvalue='1500accessType='initializeOnly'
 appinfo='Sound speed in water default value 1500 m/s'/>

<field name='set_textMessagetype='MFStringaccessType='inputOnly'/>
<field name='textMessagetype='MFStringaccessType='initializeOnly'/>
<field name='textMessageColortype='SFColorvalue='0.1 0.7 0.7accessType='inputOutput'/>
<field name='set_descriptiontype='SFStringaccessType='inputOnly'/>
<field name='descriptiontype='SFStringvalue='SeaWeb BuoyaccessType='initializeOnly'/>
<field name='traceEnabledtype='SFBoolvalue='falseaccessType='initializeOnly'/>
</ProtoInterface>
<ProtoBody>
<Group bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Viewpoint DEF='SeaWebBuoyViewpointdescription='SeaWeb Buoyposition='0 0 15'/>
<Transform DEF='RepeaterBuoyTransformbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<IS>
<connect nodeField='set_translationprotoField='set_position'/>
<connect nodeField='translationprotoField='position'/>
</IS>
<Switch DEF='BuoyGeometrySwitchwhichChoice='0bboxCenter='0 0 0bboxSize='-1 -1 -1'> </Switch>
<Switch DEF='TransmissionGeometrySwitchwhichChoice='0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- ROUTE information for AcousticTransmissionCylinderInstance node:  [from RepeaterBuoyControlScript.propagationDistance to set_range ] -->
<ProtoInstance name='AcousticTransmissionCylinderDEF='AcousticTransmissionCylinderInstance'>
<fieldValue name='defaultRangevalue='1000'/>
<fieldValue name='transmissionPropagationSpeedvalue='1500'/>
<fieldValue name='heightvalue='1'/>
<fieldValue name='colorvalue='1 1 0.2'/>
<IS>
<connect nodeField='transmissionDurationprotoField='transmissionDuration'/>
<connect nodeField='set_transmissionDurationprotoField='set_transmissionDuration'/>
<connect nodeField='traceEnabledprotoField='traceEnabled'/>
</IS>
</ProtoInstance>
<!-- ROUTE information for BeamCylinderRotation node:  [from RepeaterBuoyControlScript.beamRotation to set_rotation ] -->
<Transform DEF='BeamCylinderRotationbboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- ROUTE information for BeamCylinderInstance node:  [from BeamCylinderInterpolator.value_changed to range ] -->
<ProtoInstance name='BeamCylinderDEF='BeamCylinderInstance'>
<fieldValue name='defaultRangevalue='0'/>
<fieldValue name='beamHeightvalue='1'/>
<fieldValue name='beamWidthvalue='0.5'/>
<fieldValue name='transparencyvalue='0.2'/>
<fieldValue name='wireframevalue='true'/>
<fieldValue name='solidvalue='true'/>
</ProtoInstance>
</Transform>
</Switch>
<Transform DEF='FlyingTextTransformtranslation='0 2 0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<!-- ROUTE information for FlyingTextInstance node:  [from RepeaterBuoyControlScript.activationTime to set_startTime ] -->
<ProtoInstance name='FlyingTextDEF='FlyingTextInstance'>
<fieldValue name='visiblevalue='false'/>
<IS>
<connect nodeField='set_textMessageprotoField='set_textMessage'/>
<connect nodeField='textMessageprotoField='textMessage'/>
<connect nodeField='textDiffuseColorprotoField='textMessageColor'/>
<connect nodeField='traceEnabledprotoField='traceEnabled'/>
</IS>
</ProtoInstance>
</Transform>
<Transform DEF='TextLabelTransformtranslation='0 -2 0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Billboard axisOfRotation='0 0 0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance>
<Material>
<IS>
<connect nodeField='diffuseColorprotoField='textMessageColor'/>
</IS>
</Material>
</Appearance>
<Text DEF='TextLabel'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
</Billboard>
</Transform>
</Transform>
<!-- ROUTE information for BeamCylinderAnimation node:  [from DelayTimer.delayCompleteTime to set_startTime ] [from RepeaterBuoyControlScript.activeDuration to cycleInterval ] [from fraction_changed to BeamCylinderInterpolator.set_fraction ] -->
<TimeSensor DEF='BeamCylinderAnimation'/>
<!-- ROUTE information for BeamCylinderInterpolator node:  [from BeamCylinderAnimation.fraction_changed to set_fraction ] [from value_changed to BeamCylinderInstance.range ] -->
<ScalarInterpolator DEF='BeamCylinderInterpolatorkey='0 0.5 0.999 1keyValue='0 10 10 0'/>
<ROUTE fromNode='BeamCylinderAnimationfromField='fraction_changedtoNode='BeamCylinderInterpolatortoField='set_fraction'/>
<ROUTE fromNode='BeamCylinderInterpolatorfromField='value_changedtoNode='BeamCylinderInstancetoField='range'/>
<!-- ROUTE information for DelayTimer node:  [from RepeaterBuoyControlScript.activationTime to startTime ] [from delayCompleteTime to RepeaterBuoyControlScript.delayCompleted ] [from delayCompleteTime to BeamCylinderAnimation.set_startTime ] -->
<ProtoInstance name='TimeDelaySensorDEF='DelayTimer'/>
<!-- ROUTE information for RepeaterBuoyControlScript node:  [from DelayTimer.delayCompleteTime to delayCompleted ] [from activationTime to DelayTimer.startTime ] [from activationTime to FlyingTextInstance.set_startTime ] [from propagationDistance to AcousticTransmissionCylinderInstance.set_range ] [from beamRotation to BeamCylinderRotation.set_rotation ] [from activeDuration to BeamCylinderAnimation.cycleInterval ] -->
<Script DEF='RepeaterBuoyControlScriptdirectOutput='true'>
<field name='set_positiontype='SFVec3faccessType='inputOnly'
 appinfo='Position of buoy.'/>

<field name='positiontype='SFVec3faccessType='initializeOnly'
 appinfo='Position of buoy.'/>

<field name='set_targetPositiontype='SFVec3faccessType='inputOnly'
 appinfo='Position of target of transmission.'/>

<field name='targetPositiontype='SFVec3faccessType='initializeOnly'
 appinfo='Position of target of transmission.'/>

<field name='targetIdNumbertype='SFInt32accessType='initializeOnly'
 appinfo='Id number of target.'/>

<field name='set_targetIdNumbertype='SFInt32accessType='inputOnly'
 appinfo='Id number of target.'/>

<field name='set_enabledtype='SFBoolaccessType='inputOnly'
 appinfo='Enable buoy for transmission.'/>

<field name='enabledtype='SFBoolaccessType='initializeOnly'
 appinfo='Enable buoy for transmission.'/>

<field name='set_activatedtype='SFBoolaccessType='inputOnly'
 appinfo='Start transmission.'/>

<field name='activatedtype='SFBoolaccessType='initializeOnly'
 appinfo='Start transmission.'/>

<field name='activationTimetype='SFTimeaccessType='outputOnly'
 appinfo='Start transmission.'/>

<field name='set_transmissionDurationtype='SFFloataccessType='inputOnly'
 appinfo='Duration in seconds needed to transmit message'/>

<field name='transmissionDurationtype='SFFloataccessType='initializeOnly'
 appinfo='Duration in seconds needed to transmit message'/>

<field name='transmissionTimeDelaytype='SFTimeaccessType='initializeOnly'
 appinfo='Time delay before transmission begins.'/>

<field name='set_transmissionTimeDelaytype='SFTimeaccessType='inputOnly'
 appinfo='Time delay before transmission begins.'/>

<field name='directionalTransmissiontype='SFBoolaccessType='initializeOnly'
 appinfo='Select between directional (true) or omni-directional (false) transmission.'/>

<field name='set_directionalTransmissiontype='SFBoolaccessType='inputOnly'
 appinfo='Select between directional (true) or omni-directional (false) transmission.'/>

<field name='delayCompletedtype='SFTimeaccessType='inputOnly'/>
<field name='acousticTransmissionCylindertype='SFNodeaccessType='initializeOnly'>
<ProtoInstance USE='AcousticTransmissionCylinderInstance'/>
</field>
<field name='beamCylinderInterpolatortype='SFNodeaccessType='initializeOnly'>
<ScalarInterpolator USE='BeamCylinderInterpolator'/>
</field>
<field name='flyingTexttype='SFNodeaccessType='initializeOnly'>
<ProtoInstance USE='FlyingTextInstance'/>
</field>
<field name='geometrySwitchtype='SFNodeaccessType='initializeOnly'>
<Switch USE='BuoyGeometrySwitchwhichChoice='-1bboxCenter='0 0 0bboxSize='-1 -1 -1'/>
</field>
<field name='transmissionGeometrySwitchtype='SFNodeaccessType='initializeOnly'>
<Switch USE='TransmissionGeometrySwitchwhichChoice='-1bboxCenter='0 0 0bboxSize='-1 -1 -1'/>
</field>
<field name='delayTimertype='SFNodeaccessType='initializeOnly'>
<ProtoInstance USE='DelayTimer'/>
</field>
<field name='set_buoyTypetype='SFStringaccessType='inputOnly'
 appinfo='Determine which buoy type to use. "Racom" for Racom Buoy. "Telesonar" for Telesonar Repeater.'/>

<field name='buoyTypetype='SFStringaccessType='initializeOnly'
 appinfo='Determine which buoy type to use. "Racom" for Racom Buoy. "Telesonar" for Telesonar Repeater.'/>

<field name='set_soundSpeedInWatertype='SFFloataccessType='inputOnly'
 appinfo='Sound speed in water default value 1500 m/s'/>

<field name='soundSpeedInWatertype='SFFloataccessType='initializeOnly'
 appinfo='Sound speed in water default value 1500 m/s'/>

<field name='set_descriptiontype='SFStringaccessType='inputOnly'/>
<field name='descriptiontype='SFStringaccessType='initializeOnly'/>
<field name='propagationDistancetype='SFFloataccessType='outputOnly'/>
<field name='propagationDurationtype='SFTimeaccessType='outputOnly'/>
<field name='activeDurationtype='SFTimeaccessType='outputOnly'/>
<field name='totalDurationtype='SFTimeaccessType='outputOnly'/>
<field name='beamRotationtype='SFRotationaccessType='outputOnly'/>
<field name='TextLabelNodetype='SFNodeaccessType='initializeOnly'>
<Text USE='TextLabel'/>
</field>
<field name='SeaWebBuoyViewpointNodetype='SFNodeaccessType='initializeOnly'>
<Viewpoint USE='SeaWebBuoyViewpoint'/>
</field>
<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
<IS>
<connect nodeField='set_positionprotoField='set_position'/>
<connect nodeField='positionprotoField='position'/>
<connect nodeField='set_targetPositionprotoField='set_targetPosition'/>
<connect nodeField='targetPositionprotoField='targetPosition'/>
<connect nodeField='targetIdNumberprotoField='targetIdNumber'/>
<connect nodeField='set_targetIdNumberprotoField='set_targetIdNumber'/>
<connect nodeField='set_enabledprotoField='set_enabled'/>
<connect nodeField='enabledprotoField='enabled'/>
<connect nodeField='set_activatedprotoField='set_activated'/>
<connect nodeField='activatedprotoField='activated'/>
<connect nodeField='set_transmissionDurationprotoField='set_transmissionDuration'/>
<connect nodeField='transmissionDurationprotoField='transmissionDuration'/>
<connect nodeField='transmissionTimeDelayprotoField='transmissionTimeDelay'/>
<connect nodeField='set_transmissionTimeDelayprotoField='set_transmissionTimeDelay'/>
<connect nodeField='directionalTransmissionprotoField='directionalTransmission'/>
<connect nodeField='set_directionalTransmissionprotoField='set_directionalTransmission'/>
<connect nodeField='set_buoyTypeprotoField='set_buoyType'/>
<connect nodeField='buoyTypeprotoField='buoyType'/>
<connect nodeField='set_soundSpeedInWaterprotoField='set_soundSpeedInWater'/>
<connect nodeField='soundSpeedInWaterprotoField='soundSpeedInWater'/>
<connect nodeField='set_descriptionprotoField='set_description'/>
<connect nodeField='descriptionprotoField='description'/>
<connect nodeField='traceEnabledprotoField='traceEnabled'/>
</IS>
<![CDATA[
            
ecmascript:

function initialize()
{
	// invoke trace routines, if enabled
	set_buoyType (buoyType, timestamp);
	set_directionalTransmission (directionalTransmission);
	process_position_updates ();
	initializeTextLabel ();
	tracePrint('====================== initialize() complete ======================');
}
function initializeTextLabel ()
{
	TextLabelNode.string = new MFString (description, 'location (' + position + ')');
	tracePrint('TextLabelNode.string=' + TextLabelNode.string);
}
function set_buoyType(stringValue, timestamp)
{
	buoyType = stringValue;
	tracePrint ('buoyType = ' + buoyType);
	if      (buoyType=='Racom')
    {
		geometrySwitch.whichChoice = 0;
	}
	else if (buoyType== 'Telesonar')
    {
		geometrySwitch.whichChoice = 1;
	}
    else
    {
		alwaysPrint ('unrecognized buoyType=' + buoyType + ' [allowed choices:  Racom Telesonar]');
		geometrySwitch.whichChoice = -1; // none
	}
	updateSeaWebBuoyViewpointDescription ();
}
function updateSeaWebBuoyViewpointDescription ()
{
	SeaWebBuoyViewpointNode.description = description + ' (' + position + ')';
}
function set_soundSpeedInWater(value, timestamp)
{
	soundSpeedInWater = value;
	tracePrint('soundSpeedInWater = ' + soundSpeedInWater);
	process_position_updates ();
}
function set_position(positionValue, timestamp)
{
	position = positionValue;
	tracePrint('position = ' + position);
	process_position_updates();
	updateSeaWebBuoyViewpointDescription ();
}
function set_targetPosition(positionValue, timestamp)
{
	targetPosition = positionValue;
	tracePrint('targetPosition = ' + targetPosition);
	process_position_updates();
}
function set_transmissionDuration(value, timestamp)
{
	transmissionDuration = value;
	tracePrint('transmissionDuration     = ' + transmissionDuration);
	process_position_updates ();
}
function set_description(value, timestamp)
{
	tracePrint('new description = ' + value);
	description = value;
	updateSeaWebBuoyViewpointDescription ();
}
function process_position_updates(timestamp)
{
	tracePrint('process_position_updates()...');
	tracePrint('transmissionTimeDelay    = ' + transmissionTimeDelay);
	relativeTargetPosition = new SFVec3f();
	relativeTargetPosition.x = targetPosition.x - position.x;
	relativeTargetPosition.y = targetPosition.y - position.y;
	relativeTargetPosition.z = targetPosition.z - position.z;
	tracePrint('relativeTargetPosition = ' + relativeTargetPosition);

	// propagationDistance also sets range for AcousticTransmissionCylinderInstance
	propagationDistance = 	Math.sqrt(
				(relativeTargetPosition.x) * (relativeTargetPosition.x) +
				(relativeTargetPosition.y) * (relativeTargetPosition.y) +
				(relativeTargetPosition.z) * (relativeTargetPosition.z));
	tracePrint('propagationDistance = ' + propagationDistance);

	propagationDuration = propagationDistance / soundSpeedInWater;
	tracePrint('propagationDuration    = ' + propagationDuration);
	activeDuration = propagationDuration + transmissionDuration;
	totalDuration = transmissionTimeDelay + propagationDuration + transmissionDuration;
	tracePrint('totalDuration    = ' + totalDuration);

	beamCylinderInterpolator.key = new MFFloat (0, transmissionTimeDelay/totalDuration,
		(transmissionTimeDelay + propagationDuration)/totalDuration, 0.99, 1);
	beamCylinderInterpolator.keyValue = new MFFloat (0, 0, propagationDistance, propagationDistance, 0);
	tracePrint('beamCylinderInterpolator.key = ' + beamCylinderInterpolator.key);
	tracePrint('beamCylinderInterpolator.keyValue = ' + beamCylinderInterpolator.keyValue);
	beamRotation = new SFRotation (new SFVec3f (1, 0, 0), relativeTargetPosition.normalize());

	flyingText.timeIntervals = new MFTime(transmissionTimeDelay, propagationDuration + transmissionDuration);
	tracePrint('flyingText.timeIntervals = ' + flyingText.timeIntervals);
	// popup text without motion during transmissionTimeDelay
	flyingText.waypoints = new MFVec3f(new SFVec3f(0,0,0), new SFVec3f(0,0,0), relativeTargetPosition);
	tracePrint('flyingText.waypoints = ' + flyingText.waypoints);
	tracePrint('...process_position_updates() complete.');
}
function set_enabled(value, timestamp)
{
	enabled = value;
	tracePrint('enabled = ' + enabled);
}
function set_activated(value, timestamp)
{
	if (enabled)
	{
		process_position_updates(); // ensure up to date
		if (directionalTransmission)
		{
		//	beamCylinder.contact = true;
		}
		else
		{
			// start delay timer, which will later trigger acousticTransmissionCylinder
		//	acousticTransmissionCylinder.startTransmission = true;
		}

		if (value == true)
		{
			delayTimer.delayInterval = transmissionTimeDelay;
			tracePrint('delayTimer.delayInterval = ' + delayTimer.delayInterval);
			activationTime = timestamp; // start DelayTimer, BeamCylinderAnimation, FlyingText startTime
			tracePrint('activated at ' + activationTime);
		}
	}
}
function set_targetIdNumber(value, timestamp)
{
	targetIdNumber = value;
	tracePrint('targetIdNumber = ' + targetIdNumber);
}
function set_directionalTransmission(value, timestamp)
{
	directionalTransmission = value;
	tracePrint('directionalTransmission = ' + directionalTransmission);

	if (directionalTransmission)
	{
		transmissionGeometrySwitch.whichChoice = 1;
	}
	else
	{
		transmissionGeometrySwitch.whichChoice = 0;
	}
}
function set_transmissionTimeDelay(value, timestamp)
{
	if (value < 0.0)
	{
		alwaysPrint('error, illegal transmissionTimeDelay = ' + transmissionTimeDelay +
			', reset to 0');
		transmissionTimeDelay = 0.0;
	}
	else
	{
		transmissionTimeDelay = value;
	}
	tracePrint('transmissionTimeDelay = ' + transmissionTimeDelay);
	process_position_updates ();
}
function delayCompleted(value, timestamp)
{
	if (directionalTransmission)
	{
	//	beamCylinder.range = 0;
	}
	else
	{
		acousticTransmissionCylinder.startTransmission = true;
	}
	tracePrint('delayTimer delayCompleted at ' + timestamp);
}
function alwaysPrint(string)
{
	Browser.print ('[SeaWebBuoyPrototype ' + description + '] ' + string);
}
function tracePrint(string)
{
	if (traceEnabled)
		Browser.print ('[SeaWebBuoyPrototype ' + description + '] ' + string);
}

          
]]>
</Script>
<ROUTE fromNode='RepeaterBuoyControlScriptfromField='activationTimetoNode='DelayTimertoField='startTime'/>
<ROUTE fromNode='DelayTimerfromField='delayCompleteTimetoNode='RepeaterBuoyControlScripttoField='delayCompleted'/>
<ROUTE fromNode='DelayTimerfromField='delayCompleteTimetoNode='BeamCylinderAnimationtoField='set_startTime'/>
<ROUTE fromNode='RepeaterBuoyControlScriptfromField='activationTimetoNode='FlyingTextInstancetoField='set_startTime'/>
<ROUTE fromNode='RepeaterBuoyControlScriptfromField='propagationDistancetoNode='AcousticTransmissionCylinderInstancetoField='set_range'/>
<ROUTE fromNode='RepeaterBuoyControlScriptfromField='beamRotationtoNode='BeamCylinderRotationtoField='set_rotation'/>
<ROUTE fromNode='RepeaterBuoyControlScriptfromField='activeDurationtoNode='BeamCylinderAnimationtoField='cycleInterval'/>
</Group>
</ProtoBody>
</ProtoDeclare>
<!-- ==================== -->
<!-- Viewable geometry for this scene is anchored text that links to an example showing ExternProtoDeclare usage of a SeaWeb buoy. -->
<WorldInfo info='"A SeaWeb buoy."title='SeaWebBuoyPrototype'/>
<Viewpoint description='SeaWebBuoy prototype definitionposition='0 0 15'/>
<Transform translation='-3 0 0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Anchor description='SeaWeb buoy examplebboxCenter='0 0 0bboxSize='-1 -1 -1'
  url=' "SeaWebBuoyExample.x3d" "https://savage.nps.edu/Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyExample.x3d" "SeaWebBuoyExample.wrl" "https://savage.nps.edu/Savage/CommunicationsAndSensors/SeaWeb/SeaWebBuoyExample.wrl" '>
<Shape bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<Appearance>
<Material diffuseColor='0 1 1emissiveColor='0 1 1'/>
</Appearance>
<Text string='"SeaWebBuoyPrototype" "is a Prototype definition file." "" "To see an example scene" "click this text and view" "SeaWebBuoyExample."'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
</Anchor>
</Transform>
<Transform translation='5 0 0bboxCenter='0 0 0bboxSize='-1 -1 -1'>
<ProtoInstance name='SeaWebBuoy'>
<fieldValue name='descriptionvalue='Example buoy'/>
</ProtoInstance>
</Transform>
</Scene>
</X3D>
<!--

Index for ExternProtoDeclare definitions : AcousticTransmissionCylinder, BeamCylinder, FlyingText, TimeDelaySensor

Index for ProtoDeclare definition : SeaWebBuoy

Index for DEF nodes : AcousticTransmissionCylinderInstance, BeamCylinderAnimation, BeamCylinderInstance, BeamCylinderInterpolator, BeamCylinderRotation, BuoyGeometrySwitch, DelayTimer, FlyingTextInstance, FlyingTextTransform, RacomBuoy, RepeaterBuoyControlScript, RepeaterBuoyTransform, SeaWebBuoyViewpoint, TelesonarRepeater, TextLabel, TextLabelTransform, TransmissionGeometrySwitch

Index for Viewpoint images : Viewpoint_1, Viewpoint_2, SeaWebBuoyViewpoint
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

<!-- Additional help information about X3D scenes: X3D Resources, X3D Scene Authoring Hints and X3D Tooltips -->