Exemplo n.º 1
0
        /// <summary>
        /// Track a value
        /// </summary>
        /// <param name="nodeId">Node ID</param>
        /// <param name="blockName">Memory block name</param>
        /// <param name="blockOffset">Offset in given memory block</param>
        /// <param name="trackInterval">Track value each x steps</param>
        /// <returns>Result ID</returns>
        public int TrackValue(int nodeId, string blockName = "Output", int blockOffset = 0, uint trackInterval = 10)
        {
            MonitorFunc valueMonitor = x =>
            {
                float   value  = GetValues(nodeId, blockName)[blockOffset];
                float[] record = new float[2] {
                    SimulationHandler.SimulationStep, value
                };
                return(record);
            };

            Tuple <int, uint, MonitorFunc> rec = new Tuple <int, uint, MonitorFunc>(m_resultIdCounter++, trackInterval, valueMonitor);

            m_monitors.Add(rec);
            m_results[rec.Item1] = new List <float[]>();
            MyLog.INFO.WriteLine(blockName + "[" + blockOffset + "]@" + nodeId + "is now being tracked with ID " + (m_resultIdCounter - 1));
            return(m_resultIdCounter - 1);
        }
Exemplo n.º 2
0
 public static void SetMonitorCallback(MonitorFunc callback)
 {
     glfwSetMonitorCallback(Marshal.GetFunctionPointerForDelegate(callback));
 }
Exemplo n.º 3
0
 public static extern MonitorFunc SetMonitorCallback(MonitorFunc callback);