-
.
OEM module installed on early Guralp GPS antennas (model GPS25 25-LVS).
Mating connector JST ZHR-12.
Connector on GPS module: JST S12B-ZR -
.
Esempio base di tesbench standalone per prove di verilog. CODICE// http://www.testbench.in/TB_08_CLOCK_GENERATOR.html
// https://www.chipverify.com/verilog/verilog-testbench
module template_tb;
reg clk, clk_2, reset; // registri che piloto io nel testbench
integer no_of_clocks; // definisco un intero
parameter CLOCK_PERIOD = 5; // definisco un parametro
// i task possono contenere operatori di ritardo #
task reset_release();
#2
reset <= 1;
endtask
initial
no_of_clocks = 0;
initial
begin
clk <= 1'b0;
clk_2 <= 0;
reset <= 1; // reset attivo basso, giusto per indicare che ho uno stato non definito all'inizio
#5
// oppure potevo chiamare la funzione init();
reset <= 0; // attivo il reset
reset_release(); // e qui chiamo la funzione che mi rilascia il reset
end
always
begin
#10 clk <= ~clk;
end
// in questo modo clk_2 commuta a ogni fronte di salita del clock principale
always@(posedge clk)
begin
no_of_clocks = no_of_clocks+1;
clk_2 <= ~clk_2;
end
endmodule // dichiarazione fine modulo tb -
.
Il formato miniseed viene invece salvato utilizzando mseedputaway.c, MSEEDPA_next_ev.
Originale:CODICEsprintf (mseed_filename, "%s/%04d_%02d_%02d_%02d%02d_%02.0f.msd", output_dir, event_year, event_month, event_day, event_hour, event_min, event_sec);
Modificato io:CODICEsprintf (mseed_filename, "%s/%04d_%02d_%02d_%02d%02d_%02.0f.mseed", output_dir, event_year, event_month, event_day, event_hour, event_min, event_sec); -
.
Note:
il file sac viene creato nella funzione sacputaway.c, funzione SACPABase_end_scnl.
Io ho modificato il codice originaleCODICEsprintf (FileList[FileIndex].filename, "%s.%s.%s.%s", SAC_szSta, SAC_szChan, SAC_szNet, SAC_szLoc);
con il codice:CODICEsprintf (FileList[FileIndex].filename, "%s.%s.%s.%s.sac", SAC_szSta, SAC_szChan, SAC_szNet, SAC_szLoc);
Edited by duemilaventivalvoleturbo - 5/4/2024, 16:13 -
.
Esempio di calcolo CRC16 utilizzato per il Modbus.
Esempio tratto dalla documentazione Modbus e utilizzata per PZEM-004TCODICE//#define Poly 0x8005
#define Poly 0xA001
void CRC2 (void)
{
unsigned char msg[22]={0x01, 0x04, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00};
unsigned short CRC16, chk;
unsigned char N, i, u, dummyUchar;
unsigned char BYTE;
#define msglen 6 // numero di caratteri del messaggio
printf("messaggio: ");
for (i=0; i<msglen; i++)
{
printf("%02X ", msg[i]);
}
printf("\r\n\r\n");
CRC16 = 0xFFFF; // inizializzo il registro CRC
i = 0;
while(i<msglen)
{
printf("\t\t\t\t");
PrintBinary2(CRC16, 16);
printf("\r\n");
BYTE = msg[i];
printf("XOR %dst character\t\t", i+1);
PrintBinary2(BYTE, 16);
printf("\r\n");
printf("\t\t\t\t---------------------------------------\r\n");
CRC16 ^= BYTE;
printf("\t\t\t\t");
PrintBinary2(CRC16, 16);
printf("\r\n");
for (N=1; N<9; N++)
{
printf("\t\tMove %d\t\t", N);
if (CRC16 & 0x01)
{
CRC16 = CRC16 >> 1;
PrintBinary2(CRC16, 16);
printf("|1\r\n");
printf("\t\t\t\t");
PrintBinary2(Poly, 16);
printf("\t(poly 0x%04X)\r\n", Poly);
CRC16 ^= Poly;
printf("\t\t\t\t");
PrintBinary2(CRC16, 16);
printf("\t(CRC xor poly)\r\n");
if (N == 8)
{
printf("\r\n\r\n");
}
}
else
{
CRC16 = CRC16 >> 1;
PrintBinary2(CRC16, 16);
printf("|0\r\n");
}
}
i++;
}
printf("CRC: %04X\r\n", CRC16);
}CODICEsysop@sysop-ThinkCentre-M910s:~/ew/earthworm_7.10/src/mycustom/master$ onsite
messaggio: 01 04 00 00 00 0A
1111 1111 1111 1111
XOR 1st character 0000 0000 0000 0001
---------------------------------------
1111 1111 1111 1110
Move 1 0111 1111 1111 1111|0
Move 2 0011 1111 1111 1111|1
1010 0000 0000 0001 (poly 0xA001)
1001 1111 1111 1110 (CRC xor poly)
Move 3 0100 1111 1111 1111|0
Move 4 0010 0111 1111 1111|1
1010 0000 0000 0001 (poly 0xA001)
1000 0111 1111 1110 (CRC xor poly)
Move 5 0100 0011 1111 1111|0
Move 6 0010 0001 1111 1111|1
1010 0000 0000 0001 (poly 0xA001)
1000 0001 1111 1110 (CRC xor poly)
Move 7 0100 0000 1111 1111|0
Move 8 0010 0000 0111 1111|1
1010 0000 0000 0001 (poly 0xA001)
1000 0000 0111 1110 (CRC xor poly)
1000 0000 0111 1110
XOR 2st character 0000 0000 0000 0100
---------------------------------------
1000 0000 0111 1010
Move 1 0100 0000 0011 1101|0
Move 2 0010 0000 0001 1110|1
1010 0000 0000 0001 (poly 0xA001)
1000 0000 0001 1111 (CRC xor poly)
Move 3 0100 0000 0000 1111|1
1010 0000 0000 0001 (poly 0xA001)
1110 0000 0000 1110 (CRC xor poly)
Move 4 0111 0000 0000 0111|0
Move 5 0011 1000 0000 0011|1
1010 0000 0000 0001 (poly 0xA001)
1001 1000 0000 0010 (CRC xor poly)
Move 6 0100 1100 0000 0001|0
Move 7 0010 0110 0000 0000|1
1010 0000 0000 0001 (poly 0xA001)
1000 0110 0000 0001 (CRC xor poly)
Move 8 0100 0011 0000 0000|1
1010 0000 0000 0001 (poly 0xA001)
1110 0011 0000 0001 (CRC xor poly)
1110 0011 0000 0001
XOR 3st character 0000 0000 0000 0000
---------------------------------------
1110 0011 0000 0001
Move 1 0111 0001 1000 0000|1
1010 0000 0000 0001 (poly 0xA001)
1101 0001 1000 0001 (CRC xor poly)
Move 2 0110 1000 1100 0000|1
1010 0000 0000 0001 (poly 0xA001)
1100 1000 1100 0001 (CRC xor poly)
Move 3 0110 0100 0110 0000|1
1010 0000 0000 0001 (poly 0xA001)
1100 0100 0110 0001 (CRC xor poly)
Move 4 0110 0010 0011 0000|1
1010 0000 0000 0001 (poly 0xA001)
1100 0010 0011 0001 (CRC xor poly)
Move 5 0110 0001 0001 1000|1
1010 0000 0000 0001 (poly 0xA001)
1100 0001 0001 1001 (CRC xor poly)
Move 6 0110 0000 1000 1100|1
1010 0000 0000 0001 (poly 0xA001)
1100 0000 1000 1101 (CRC xor poly)
Move 7 0110 0000 0100 0110|1
1010 0000 0000 0001 (poly 0xA001)
1100 0000 0100 0111 (CRC xor poly)
Move 8 0110 0000 0010 0011|1
1010 0000 0000 0001 (poly 0xA001)
1100 0000 0010 0010 (CRC xor poly)
1100 0000 0010 0010
XOR 4st character 0000 0000 0000 0000
---------------------------------------
1100 0000 0010 0010
Move 1 0110 0000 0001 0001|0
Move 2 0011 0000 0000 1000|1
1010 0000 0000 0001 (poly 0xA001)
1001 0000 0000 1001 (CRC xor poly)
Move 3 0100 1000 0000 0100|1
1010 0000 0000 0001 (poly 0xA001)
1110 1000 0000 0101 (CRC xor poly)
Move 4 0111 0100 0000 0010|1
1010 0000 0000 0001 (poly 0xA001)
1101 0100 0000 0011 (CRC xor poly)
Move 5 0110 1010 0000 0001|1
1010 0000 0000 0001 (poly 0xA001)
1100 1010 0000 0000 (CRC xor poly)
Move 6 0110 0101 0000 0000|0
Move 7 0011 0010 1000 0000|0
Move 8 0001 1001 0100 0000|0
0001 1001 0100 0000
XOR 5st character 0000 0000 0000 0000
---------------------------------------
0001 1001 0100 0000
Move 1 0000 1100 1010 0000|0
Move 2 0000 0110 0101 0000|0
Move 3 0000 0011 0010 1000|0
Move 4 0000 0001 1001 0100|0
Move 5 0000 0000 1100 1010|0
Move 6 0000 0000 0110 0101|0
Move 7 0000 0000 0011 0010|1
1010 0000 0000 0001 (poly 0xA001)
1010 0000 0011 0011 (CRC xor poly)
Move 8 0101 0000 0001 1001|1
1010 0000 0000 0001 (poly 0xA001)
1111 0000 0001 1000 (CRC xor poly)
1111 0000 0001 1000
XOR 6st character 0000 0000 0000 1010
---------------------------------------
1111 0000 0001 0010
Move 1 0111 1000 0000 1001|0
Move 2 0011 1100 0000 0100|1
1010 0000 0000 0001 (poly 0xA001)
1001 1100 0000 0101 (CRC xor poly)
Move 3 0100 1110 0000 0010|1
1010 0000 0000 0001 (poly 0xA001)
1110 1110 0000 0011 (CRC xor poly)
Move 4 0111 0111 0000 0001|1
1010 0000 0000 0001 (poly 0xA001)
1101 0111 0000 0000 (CRC xor poly)
Move 5 0110 1011 1000 0000|0
Move 6 0011 0101 1100 0000|0
Move 7 0001 1010 1110 0000|0
Move 8 0000 1101 0111 0000|0
CRC: 0D70
01 04 00 00 00 0A: SlaveID 1, funzione 04, registro base 0x0000, 10 bytes, CRC 0x70 0x0D
La sequenza completa sarà
01 04 00 00 00 0A 70 0D
Il CRC viene calcolato su tutti i bytes prima del CRC, per verificare il CRC lato ricevitore dovrò calcolare il CRC di tutta la sequenza ricevuta (CRC compreso) che dovrà darmi risultato 0. -
.
Quando vado a scaricare dei dati dal Suricat mi viene creato un singolo file mseed contenente le 3 componenti.
L'ora è riferita al 1970 e solitamente la location non viene letta da SeisGram2K in quanto lettere minuscole.CODICE# Qui vado ad aprire un file mseed preso dal Suicat (singolo mseed per differenti tracce), salvo ogni componente su mseed e aggiorno la data
from obspy import UTCDateTime
from obspy.clients.fdsn import Client
import obspy
from obspy import *
from obspy.signal.invsim import corn_freq_2_paz
from obspy.io.xseed import Parser
from obspy import read, read_inventory
import matplotlib.pyplot as plt
from obspy.core import read
from scipy import integrate
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import datetime
import sys
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import datetime
from obspy.core import read
import obspy
from obspy import *
from obspy.core import utcdatetime
#from obspy.signal import bandpass
#from numpy import mean, sqrt, square, arange
import operator
import sys
from obspy.signal.trigger import classic_sta_lta
from obspy.signal.trigger import carl_sta_trig
import pylab
import copy
from scipy import signal
import os
import time
import math
from scipy import integrate
from obspy import read
#import plotly.plotly as py
#import plotly.graph_objs as go
from obspy.signal.trigger import classic_sta_lta, plot_trigger
#intanto vado a leggere la traccia in SAC
from math import*
# esempio di utilizzo: get_pga 567777 hnz.mseed hnn.mseed hne.mseed
# il primo rappresenta la sensitivity (solitamente i counts richiesti per 1g o per 1 m/s^2)
# sensitivity nominale Titan: 4.0e+06 [counts] = 1 [m/s^2]
# sensitivity nominale Titan: 3.2e+08 [counts] = 1 [m/s]
filename = sys.argv[1]
date = sys.argv[2]
if len(sys.argv) < 3:
print("\r\nusage: python mseed_shrink PIPPO.mseed SuricatDate")
print("example: python mseed_shrink PIPPO.mseed 2024-03-27T21:15:00.0")
else:
waveforms = read(filename)
for stream in waveforms:
loc = stream.stats.location.upper() # converto a uppercase
stream.stats.location = loc
stream.stats.starttime = date
filename = ("%s.%s.%s.%s.%04d%02d%02d_%02d%02d.mseed" % (stream.stats.network, stream.stats.station, stream.stats.channel, loc, stream.stats.starttime.year, stream.stats.starttime.month, stream.stats.starttime.day, stream.stats.starttime.hour, stream.stats.starttime.minute))
stream.write(filename, format="MSEED")
Io parto da questo file:
OX_TOS1_channelName1_2024-03-27_GMT_21.15.00_00h_10m_00s.mseed
e creo dei singoli files miniseed (uno per componente):
python suricat_mseed_shrink_1.0a.py OX_TOS1_channelName1_2024-03-27_GMT_21.15.00_00h_10m_00s.mseed 2024-03-27T21:15:00.0
con timestamp a partire dalla data indicata. -
.
Data locale: 2024-03-27 22:19:37
Data UTC: 2024-03-27 21:19:37
Magnitudo: 4.6 ± 0.3
Località: 5 km SSO di Socchieve (Udine)
Tipo di localizzazione: rivista da un sismologo
Data (UTC): 2024-03-27 21:19:37
Lat., Long. 46.3583, 12.8080
Profondità (km): 10.22
Orid: 168945
Edited by duemilaventivalvoleturbo - 28/3/2024, 14:23 -
.
Definisco una struttura ma non so di preciso quante me ne servono.
Se conosco il numero posso definirne un numero massimo, come per gli array:
unsigned char pippo[33];
ma potrei avere un numero definito, come per esempio i modi di un edificio.CODICE#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
// gcc -o pippo main.c -I.
// dichiarazione della struttura
typedef struct
{
unsigned char pippo;
unsigned int pluto;
} Mystruct;
Mystruct *Gigi = NULL;
// contatori
unsigned char MyCounter = 0;
unsigned char MaxValue = 0;
int main()
{
unsigned char i;
size_t size;
for (i=0; i<2; i++)
{
if (MyCounter >= MaxValue)
{
MaxValue++;
size = MaxValue * sizeof( Mystruct );
Gigi = (Mystruct *) realloc(Gigi, size);
if( Gigi == NULL )
{
printf("ERROR, exiting!\r\n");
exit( -1 );
}
}
Gigi[MyCounter].pippo = i+3;
MyCounter++;
}
printf("\r\n");
printf("read %d entries:\r\n", MaxValue);
// uso il for se so giĆ quante iterazioni ho di sicuro
for (i=0; i<2; i++)
{
Mystruct *next = &(Gigi[i]);
printf("#%d: %d\r\n", i, next->pippo);
}
free(Gigi);
return(0);
} -
.
Mio riassunto formule. -
.
Pubblicazione:
COMPARISON OF FOUR NUMERICAL METHODS FOR CALCULATING SEISMIC DYNAMIC RESPONSE OF SDOF SYSTEM
Xing JIN, Qiang MA and Shanyou LI
13 th World Conference on Earthquake Engineering
Vancouver, B.C., Canada
August 1-6, 2004
Paper No. 2889 -
.
On-Site Early Warning and Rapid Damage Forecasting Using Single Stations: Outcomes
from the REAKT Project
by S. Parolai, D. Bindi, T. Boxberger, C. Milkereit, K. Fleming, and
M. Pittore -
.
Test -
.
Earthworm v7.10
Custom slink2ew module with scnl remap (for hardcoded location/network codes, to be remapped without using additional earthworm module)
examples:
In this case all incoming streams from station GRDI will be remapped to station PALM.
Send_scnl_remap GRDI * * * PALM * * * # send all component of GRDI, but remap station name to PALM
In this case all channells HHx, from station M0105 will be remapped to station REPE, channels SHx
while all channels HNx will be remapped to station REPE without changing channel name
Send_scnl_remap M0105 HH? * * REPE S?? * * # converto sia il codice stazione che quello canale (per HH)
Send_scnl_remap M0105 HN? * * REPE * * * # converto sia il codice stazione che quello canale (per HH)
Every stream is procedded once:
Send_scnl_remap GRDI * * * PALM * * *
Send_scnl_remap GRDI HNZ * * GRDI SNZ * *
in this case all GRDI channels will be remapped to PALM, then second rule will be discarded. -
.
werwrewr -
.
SeedLink server for Kinimetrics Etna and K2 digitizers based on SBC Raspberry Pi