Startup
This commit is contained in:
+7
-8
@@ -30,20 +30,14 @@
|
||||
<Component id="panelImageCounter" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="153" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelImageCounter" min="-2" pref="74" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="74" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -51,6 +45,11 @@
|
||||
</Group>
|
||||
<EmptySpace pref="63" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="panelImageCounter" min="-2" pref="74" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
|
||||
+6
-6
@@ -192,21 +192,21 @@ public class Omega extends Panel {
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(77, 77, 77)
|
||||
.addComponent(panelImageCounter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(26, Short.MAX_VALUE))
|
||||
.addContainerGap(153, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(panelImageCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 74, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonStart)
|
||||
.addComponent(buttonAbort))
|
||||
.addContainerGap(63, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(panelImageCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import random
|
||||
|
||||
|
||||
class SimulatedDiode(ReadonlyRegisterBase):
|
||||
|
||||
def __init__(self, name):
|
||||
ReadonlyRegisterBase.__init__(self, name)
|
||||
self.x=0.0
|
||||
self.y=0.0
|
||||
self.radius=0.125
|
||||
self.amplitude = 600.0
|
||||
self.offset=200.0
|
||||
self.border = 0.025
|
||||
|
||||
def doRead(self):
|
||||
x,y = scx.position, scy.position
|
||||
noise = random.random() * self.amplitude/100.0
|
||||
d = math.hypot(x-self.x, y-self.y)
|
||||
#print d
|
||||
if d>self.radius:
|
||||
return self.offset + noise
|
||||
elif d< (self.radius - self.border ):
|
||||
return self.offset + noise + self.amplitude
|
||||
else :
|
||||
return self.offset + noise + self.amplitude *(self.radius - d)/self.border
|
||||
|
||||
def set_center(self, x, y):
|
||||
self.x, self.y = x, y
|
||||
@@ -2,3 +2,11 @@
|
||||
# Deployment specific global definitions - executed after startup.py
|
||||
###################################################################################################
|
||||
|
||||
|
||||
|
||||
#Devices
|
||||
run("devices/SimulatedDiode")
|
||||
simulatedDiode = SimulatedDiode("scd_sim")
|
||||
add_device(simulatedDiode, True)
|
||||
simulatedDiode.polling=500
|
||||
|
||||
Reference in New Issue
Block a user